Commit a256027a authored by Daniele Venzano's avatar Daniele Venzano

Add optional field to specify amount of SHM in bytes

parent 07fdce15
......@@ -129,7 +129,12 @@
"min",
"max"
]
}
},
"shm_size": {
"type": "number",
"multipleOf": 1.0,
"minimum": 0
},
},
"additionalProperties": false,
"required": [
......
......@@ -61,12 +61,17 @@ class ResourceReservation:
def __init__(self, data):
self.memory = ResourceLimits(data['memory'], "bytes")
self.cores = ResourceLimits(data['cores'], 'units')
if 'shm' in data:
self.shm = data['shm_size']
else:
self.shm = 0
def __add__(self, other):
if isinstance(other, ResourceReservation):
res = {
'memory': self.memory + other.memory,
'cores': self.cores + other.cores
'cores': self.cores + other.cores,
'shm': self.shm + other.shm
}
return ResourceReservation(res)
else:
......
......@@ -99,7 +99,7 @@ class DockerClient:
for volume in service_instance.volumes:
if volume.type == "host_directory":
assert isinstance(volume, VolumeDescriptionHostPath)
run_args['volumes'][volume.path] = {'bind': volume.mount_point, 'mode': ("ro" if volume.readonly else "rw")}
run_args['volumes'][volume.path] = {'bi nd': volume.mount_point, 'mode': ("ro" if volume.readonly else "rw")}
else:
log.error('Docker backend does not support volume type {}'.format(volume.type))
......@@ -112,6 +112,9 @@ class DockerClient:
if service_instance.core_limit is not None:
run_args['cpu_quota'] = int(100000 * service_instance.core_limit.min)
if service_instance.shm_size > 0:
run_args['shm_size'] = service_instance.shm_size
if get_conf().gelf_address != '':
run_args['log_config'] = {
"type": "gelf",
......
......@@ -45,6 +45,8 @@ class ServiceInstance:
if self.core_limit.max > get_conf().max_core_limit:
self.core_limit = get_conf().max_core_limit
self.shm_size = service.resource_reservation.shm
self.labels = {
'zoe.execution.name': execution.name,
'zoe.execution.id': str(execution.id),
......
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