Skip to content

Commit b211944

Browse files
committed
Instance stop timeout
1 parent fc9cd64 commit b211944

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

spython/instance/cmd/stop.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
from spython.logger import bot
99

1010

11-
def stop(self, name=None, sudo=False):
11+
def stop(self, name=None, sudo=False, timeout=10):
1212
"""stop an instance. This is done by default when an instance is created.
1313
1414
Parameters
1515
==========
1616
name: a name for the instance
1717
sudo: if the user wants to run the command with sudo
18+
timeout: forcebly kill non-stopped instance after specified timeout
19+
in seconds (default 10)
1820
1921
USAGE:
2022
singularity [...] instance.stop [...] <instance name>
@@ -27,7 +29,7 @@ def stop(self, name=None, sudo=False):
2729
subgroup = "instance.stop"
2830

2931
if "version 3" in self.version():
30-
subgroup = ["instance", "stop"]
32+
subgroup = ["instance", "stop", "-t", str(timeout)]
3133

3234
cmd = self._init_command(subgroup)
3335

0 commit comments

Comments
 (0)