Commit c4a41385 authored by Daniele Venzano's avatar Daniele Venzano

Rename "priority" field into "size" to better reflect its actual purpose

parent 61a11f50
{
"name": "aml-lab",
"priority": 512,
"size": 512,
"services": [
{
"docker_image": "docker-registry:5000/zapps/spark2-master",
......
......@@ -35,12 +35,12 @@ required, boolean
Must be set to False if potentially this application could run forever. For example a Jupyter notebook will never end (must be terminated explicitly by the user), so needs to have this value set to ``false``. A Spark job instead will finish by itself, so for batch ZApps set this value to ``true``.
priority
^^^^^^^^
size
^^^^
required, number [0, 1024)
required, number >= 0
For now this value is unused.
This value is used by the Elastic scheduler as an hint to the application size.
disable_autorestart
^^^^^^^^^^^^^^^^^^^
......@@ -204,7 +204,7 @@ Example
"name": "Jupyter notebook",
"version": 2,
"will_end": false,
"priority": 512,
"size": 512,
"services": [
{
"name": "jupyter",
......
{
"name": "nginx",
"priority": 512,
"size": 512,
"services": [
{
"docker_image": "nginx:alpine",
......
......@@ -15,9 +15,8 @@ export class ServiceDescription implements Serializable<ServiceDescription> {
name: string;
willEnd: boolean;
priority: number;
size: number;
version: number;
requiresBinary: boolean;
services: Service[];
rawObject: Object;
......@@ -37,8 +36,8 @@ export class ServiceDescription implements Serializable<ServiceDescription> {
this.willEnd = input.will_end;
}
if (input.hasOwnProperty('priority')) {
this.priority = input.priority;
if (input.hasOwnProperty('size')) {
this.size = input.size;
}
if (input.hasOwnProperty('version')) {
......
......@@ -35,7 +35,7 @@ def app_validate(data):
:param data: a dictionary containing an application description
:return: None if the application description is correct
"""
required_keys = ['name', 'will_end', 'priority', 'version']
required_keys = ['name', 'will_end', 'size', 'version']
for k in required_keys:
if k not in data:
raise InvalidApplicationDescription(msg="Missing required key: %s" % k)
......@@ -53,11 +53,11 @@ def app_validate(data):
raise InvalidApplicationDescription(msg="will_end field must be a boolean")
try:
priority = int(data['priority'])
size = int(data['size'])
except ValueError:
raise InvalidApplicationDescription(msg="priority field must be an int")
if priority < 0 or priority > 1024:
raise InvalidApplicationDescription(msg="priority must be between 0 and 1024")
raise InvalidApplicationDescription(msg="size field must be an int")
if size < 0:
raise InvalidApplicationDescription(msg="size must be between 0 and 1024")
if 'services' not in data:
raise InvalidApplicationDescription(msg='the application should contain a list of services')
......
......@@ -65,7 +65,7 @@ class Execution:
self._status = d['status']
self.error_message = d['error_message']
self.priority = self.description['priority']
self.size = self.description['size']
self.termination_lock = threading.Lock()
......
......@@ -35,7 +35,7 @@ class TestApplicationsMethods(unittest.TestCase):
self.app_validate_data = {
"name": "test name",
"will_end": True,
"priority": 3,
"size": 3,
"version": current_version,
"services": []
}
......
......@@ -109,10 +109,10 @@ class ZoeElasticScheduler:
if exec_data.last_time_scheduled == 0:
progress = 0
else:
last_progress = (time.time() - exec_data.last_time_scheduled) / ((execution.services_count / execution.running_services_count) * execution.priority)
last_progress = (time.time() - exec_data.last_time_scheduled) / ((execution.services_count / execution.running_services_count) * execution.size)
exec_data.progress_sequence.append(last_progress)
progress = sum(exec_data.progress_sequence)
remaining_execution_time = (1 - progress) * execution.priority
remaining_execution_time = (1 - progress) * execution.size
execution.size = remaining_execution_time * execution.services_count
def _pop_all_with_same_size(self):
......
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