Commit 5d06a773 authored by Daniele Venzano's avatar Daniele Venzano

Add the possibility of overriding the working directory for services

parent 8201df86
......@@ -143,6 +143,20 @@ number
Relative ordering for service startup. Zoe will start first services with a lower value. Note that Zoe will not wait for the service to be up and running before starting the next in the list.
command
^^^^^^^
string or null
Overrides the command to execute inside the service container. If set to null, the command set at image creation time will be executed.
work_dir
^^^^^^^^
string
This entry is optional. If set, its value will be used as the work directory where the command is executed.
ports
^^^^^
......
......@@ -142,6 +142,9 @@
{ "type": "string", "minLength": 1 },
{ "type": "null" }
]
},
"work_dir": {
"type": "string", "minLength": 1
}
},
"additionalProperties": false,
......
......@@ -21,7 +21,7 @@
<div class="scheduler_queue">
{% for id in stats['queue'] %}
<div class="queue_item" id="{{ id }}">
<a href="{{ reverse_url('execution_inspect', id) }}">{{ id }}</a>
<a href="{{ reverse_url('execution_inspect', id) }}">{{ id }}</a> ({{ executions_in_queue[id].user_id }})
{% for service in executions_in_queue[id].services %}
{% if service.essential %}
<div class="service essential {{ 'running' if service.status == service.ACTIVE_STATUS }}">
......
......@@ -141,6 +141,11 @@ class Service:
except KeyError:
self.command = None
try:
self.work_dir = self.description['work_dir']
except KeyError:
self.work_dir = None
try:
self.resource_reservation = ResourceReservation(self.description['resources'])
except KeyError:
......
......@@ -17,7 +17,7 @@
import collections
from zoe_lib.state import Service, Execution
from zoe_lib.state import Service, Execution, VolumeDescriptionHostPath
from zoe_lib.config import get_conf
import zoe_master.backends.common
......@@ -60,6 +60,8 @@ class ServiceInstance:
self.command = service.command
self.work_dir = service.work_dir
self.image_name = service.image_name
self.ports = []
......
......@@ -209,6 +209,7 @@ class SwarmClient:
network_disabled=False,
network_mode=get_conf().overlay_network_name,
ports=port_bindings,
working_dir=service_instance.work_dir,
volumes=volumes)
except docker.errors.ImageNotFound:
raise ZoeException(message='Image not found')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment