Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and **Merged pull requests**. Critical items to know are:
The versions coincide with releases on pypi.

## [0.0.x](https://github.com/singularityhub/singularity-compose/tree/master) (0.0.x)
- singularity-compose down supporting timeout (0.0.20)
- command, ability to associate arguments to the instance's startscript (0.0.19)
- depends\_on, check circular dependencies at startup and shutdown in reverse order (0.0.18)
- resolv.conf, etc.hosts generated if needed, network disabled non-sudo users (0.0.17)
Expand Down
7 changes: 7 additions & 0 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@ To stop a custom set, just specify them:
$ singularity-compose down nginx
```

It is also possible to specify a timeout (as for singularity instance stop)
in order to kill instances after the specified number of seconds:

```bash
singularity-compose down -t 100
```

## Logs

You can of course view logs for all instances, or just specific named ones:
Expand Down
9 changes: 9 additions & 0 deletions scompose/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,15 @@ def get_parser():

down = subparsers.add_parser("down", help="stop instances")

down.add_argument(
"--timeout",
"-t",
dest="timeout",
type=int,
help="force kill non stopped instances after specified seconds",
default=None,
)

execute = subparsers.add_parser("exec", help="execute a command to an instance")

run = subparsers.add_parser("run", help="run an instance runscript.")
Expand Down
2 changes: 1 addition & 1 deletion scompose/client/down.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ def main(args, parser, extra):
)

# Create instances, and if none specified, create all
project.down(args.names)
project.down(args.names, args.timeout)
4 changes: 2 additions & 2 deletions scompose/project/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,13 +353,13 @@ def get(self):
self.instance = instance
break

def stop(self):
def stop(self, timeout=None):
"""delete the instance, if it exists. Singularity doesn't have delete
or remove commands, everyting is a stop.
"""
if self.instance:
bot.info("Stopping %s" % self)
self.instance.stop(sudo=self.sudo)
self.instance.stop(sudo=self.sudo, timeout=timeout)
self.instance = None

# Networking
Expand Down
4 changes: 2 additions & 2 deletions scompose/project/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ def view_config(self):

# Down

def down(self, names=None):
def down(self, names=None, timeout=None):
"""stop one or more instances. If no names are provided, bring them
all down.

Expand All @@ -373,7 +373,7 @@ def down(self, names=None):
names.reverse()

for instance in self.iter_instances(names):
instance.stop()
instance.stop(timeout=timeout)

# Create

Expand Down
4 changes: 2 additions & 2 deletions scompose/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

"""

__version__ = "0.0.19"
__version__ = "0.0.20"
AUTHOR = "Vanessa Sochat"
AUTHOR_EMAIL = "vsochat@stanford.edu"
NAME = "singularity-compose"
Expand All @@ -22,7 +22,7 @@


INSTALL_REQUIRES = (
("spython", {"min_version": "0.0.69"}),
("spython", {"min_version": "0.0.77"}),
("pyaml", {"min_version": "5.1.1"}),
)

Expand Down