Commit cc0e0b23 authored by Maverick Chardet's avatar Maverick Chardet
Browse files

Bumped version to 0.1.1.

Added requirements to requirements.txt.
Improved Madeus assembly: ability to get accurate running time
with the run function, added a run_timeout function to take advantage
of Concerto's synchronize_timeout.
Added typing information to Concerto's synchronize_timeout.
Fixed concerto_config.json in parallel and sequential tests for
local usage.
parent 2c8bdfe9
......@@ -324,7 +324,7 @@ class Assembly(object):
"\n".join(["- %s" % str(ins) for ins in self.instructions_queue.queue])))
self.instructions_queue.join()
def synchronize_timeout(self, time):
def synchronize_timeout(self, time: int):
from concerto.utility import timeout
finished = False
with timeout(time):
......
from abc import ABCMeta, abstractmethod
from typing import Dict, Tuple, List, Set
from typing import Dict, Tuple, List
from concerto.assembly import Assembly
from concerto.reconfiguration import Reconfiguration
from concerto.madeus.madeus_component import MadeusComponent, _MadeusConcertoComponent
class MadeusAssembly(Assembly):
class MadeusAssembly(Assembly, metaclass=ABCMeta):
@abstractmethod
def create(self):
pass
......@@ -36,10 +36,42 @@ class MadeusAssembly(Assembly):
self._reconf.wait_all()
def get_concerto_reconfiguration(self):
"""
Returns the Concerto reconfiguration object generated by the Madeus abstraction layer.
:return: a Concerto reconfiguration.
"""
return self._reconf
def run(self, auto_synchronize=True):
self.run_reconfiguration(self.get_concerto_reconfiguration())
def run(self, auto_synchronize: bool = True):
"""
Runs the Concerto deployment.
:param auto_synchronize: If True (default), will block until the deployment is over and return the
deployment execution time. If False, will return the start time of the deployment and return immediately.
:return: Deployment time if auto_synchronize is true (default), start time of the deployment (as given by
time.perf_counter) if auto_synchronize is False.
"""
from time import perf_counter
reconf = self.get_concerto_reconfiguration()
start_time = perf_counter()
self.run_reconfiguration(reconf)
if auto_synchronize:
self.synchronize()
end_time = perf_counter()
self.terminate()
return end_time-start_time
else:
return start_time
def run_timeout(self, max_time: int):
"""
Runs the Concerto deployment with an integer timeout.
:param max_time: Maximum deployment time.
:return: A tuple (finished, debug_info, running_time) where finished is true iff the timeout wasn't reached,
debug_info contains the debug info (string) if the timeout was reached and None otherwise, and running_time
is a float containing the running time.
"""
from time import perf_counter
start_time = self.run(auto_synchronize=False)
finished, debug_info = self.synchronize_timeout(max_time)
end_time = perf_counter()
return finished, debug_info, end_time-start_time
......@@ -8,7 +8,7 @@ with open("README.md", "r") as fh:
setup(
name="concerto",
version="0.0.1",
version="0.1.1",
description="Preliminary implementation in Python 3 of the Concerto reconfiguration model.",
long_description=long_description,
long_description_content_type="text/markdown",
......
{
"list_nb_components": [1, 5, 25, 100],
"list_nb_parallel_transitions": [1, 5, 25, 100],
"list_nb_components": [1, 5],
"list_nb_parallel_transitions": [1, 5],
"nb_repeats": 5,
"remote_hosts": []
"remote_hosts": [],
"sleep_time": 1
}
{
"list_chain_length": [1, 5, 25, 100],
"list_chain_length": [1, 5],
"nb_repeats": 5
}
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