Commit e824c998 authored by André Anjos's avatar André Anjos 💬
Browse files

Merge branch 'change_loop_parts_name' into 'master'

Change loop parts name

See merge request !58
parents a749c91c 878f6c20
Pipeline #32969 passed with stages
in 19 minutes and 56 seconds
......@@ -216,7 +216,7 @@ class Runner(object):
if hasattr(self.obj, "prepare"):
if self.algorithm.type in [
Algorithm.AUTONOMOUS,
Algorithm.AUTONOMOUS_LOOP_USER,
Algorithm.AUTONOMOUS_LOOP_PROCESSOR,
]:
self.prepared = loader.run(
self.obj, "prepare", self.exc, data_loaders.secondaries()
......@@ -451,10 +451,10 @@ class Algorithm(object):
LEGACY = "legacy"
SEQUENTIAL = "sequential"
AUTONOMOUS = "autonomous"
SEQUENTIAL_LOOP = "sequential_loop"
AUTONOMOUS_LOOP = "autonomous_loop"
SEQUENTIAL_LOOP_USER = "sequential_loop_user"
AUTONOMOUS_LOOP_USER = "autonomous_loop_user"
SEQUENTIAL_LOOP_EVALUATOR = "sequential_loop_evaluator"
AUTONOMOUS_LOOP_EVALUATOR = "autonomous_loop_evaluator"
SEQUENTIAL_LOOP_PROCESSOR = "sequential_loop_processor"
AUTONOMOUS_LOOP_PROCESSOR = "autonomous_loop_processor"
dataformat_klass = dataformat.DataFormat
......@@ -698,8 +698,8 @@ class Algorithm(object):
""" Returns whether the algorithm is in the autonomous category"""
return self.type in [
Algorithm.AUTONOMOUS,
Algorithm.AUTONOMOUS_LOOP,
Algorithm.AUTONOMOUS_LOOP_USER,
Algorithm.AUTONOMOUS_LOOP_EVALUATOR,
Algorithm.AUTONOMOUS_LOOP_PROCESSOR,
]
@property
......@@ -707,13 +707,16 @@ class Algorithm(object):
""" Returns whether the algorithm is in the sequential category"""
return self.type in [
Algorithm.SEQUENTIAL,
Algorithm.SEQUENTIAL_LOOP,
Algorithm.SEQUENTIAL_LOOP_USER,
Algorithm.SEQUENTIAL_LOOP_EVALUATOR,
Algorithm.SEQUENTIAL_LOOP_PROCESSOR,
]
@property
def is_loop(self):
return self.type in [Algorithm.SEQUENTIAL_LOOP, Algorithm.AUTONOMOUS_LOOP]
return self.type in [
Algorithm.SEQUENTIAL_LOOP_EVALUATOR,
Algorithm.AUTONOMOUS_LOOP_EVALUATOR,
]
@language.setter
def language(self, value):
......
......@@ -2,7 +2,7 @@
"schema_version": 3,
"language": "python",
"api_version": 2,
"type": "autonomous_loop",
"type": "autonomous_loop_evaluator",
"groups": [
{
"inputs": {
......
......@@ -2,7 +2,7 @@
"schema_version": 3,
"language": "python",
"api_version": 2,
"type": "autonomous_loop_user",
"type": "autonomous_loop_processor",
"splittable": false,
"groups": [
{
......
......@@ -2,7 +2,7 @@
"schema_version": 3,
"language": "python",
"api_version": 2,
"type": "sequential_loop",
"type": "sequential_loop_evaluator",
"groups": [
{
"inputs": {
......
......@@ -2,7 +2,7 @@
"schema_version": 3,
"language": "python",
"api_version": 2,
"type": "sequential_loop_user",
"type": "sequential_loop_processor",
"splittable": false,
"groups": [
{
......
......@@ -73,21 +73,21 @@ class TestLegacyAPI_Loading(unittest.TestCase):
def test_raises_syntax_error(self):
algorithm = Algorithm(prefix, "legacy/syntax_error/1")
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
with self.assertRaises(SyntaxError):
algorithm.runner()
def test_raises_runtime_error(self):
algorithm = Algorithm(prefix, "legacy/syntax_error/1")
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
with self.assertRaises(RuntimeError):
algorithm.runner(exc=RuntimeError)
def test_missing_class_raises(self):
algorithm = Algorithm(prefix, "legacy/no_class/1")
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
with self.assertRaises(AttributeError):
algorithm.runner()
......@@ -102,7 +102,7 @@ class TestLegacyAPI_Loading(unittest.TestCase):
def test_load_valid_algorithm(self):
algorithm = Algorithm(prefix, "legacy/valid_algorithm/1")
self.assertEqual(algorithm.name, "legacy/valid_algorithm/1")
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
self.assertFalse(algorithm.errors)
self.assertFalse(algorithm.results) # it is not an analyzer
......@@ -120,7 +120,7 @@ class TestLegacyAPI_Loading(unittest.TestCase):
def test_load_valid_analyser(self):
algorithm = Algorithm(prefix, "legacy/valid_analysis/1")
self.assertEqual(algorithm.name, "legacy/valid_analysis/1")
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
self.assertFalse(algorithm.errors)
self.assertFalse(algorithm.output_map) # it is an analyzer
......@@ -147,16 +147,16 @@ class TestLegacyAPI_Loading(unittest.TestCase):
def test_hash(self):
algorithm = Algorithm(prefix, "legacy/valid_analysis/1")
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
self.assertEqual(len(algorithm.hash()), 64)
v2 = Algorithm(prefix, "legacy/valid_analysis/2") # only doc changes
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
self.assertEqual(algorithm.hash(), v2.hash())
def test_no_description(self):
algorithm = Algorithm(prefix, "legacy/no_doc/1")
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
self.assertTrue(algorithm.description is None)
self.assertTrue(algorithm.documentation is None)
......@@ -168,7 +168,7 @@ class TestLegacyAPI_Loading(unittest.TestCase):
def test_description(self):
algorithm = Algorithm(prefix, "legacy/valid_analysis/2") # only doc changes
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
self.assertTrue(isinstance(algorithm.description, six.string_types))
self.assertTrue(len(algorithm.description) > 0)
self.assertTrue(algorithm.documentation is None)
......@@ -176,7 +176,7 @@ class TestLegacyAPI_Loading(unittest.TestCase):
def test_analyzer_format(self):
algorithm_name = "legacy/valid_analysis/1"
algorithm = Algorithm(prefix, algorithm_name)
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
dataformat = algorithm.result_dataformat()
self.assertTrue(dataformat.valid)
......@@ -191,7 +191,7 @@ class TestSequentialAPI_Loading(unittest.TestCase):
def test_load_valid_algorithm(self):
algorithm = Algorithm(prefix, "sequential/valid_algorithm/1")
self.assertEqual(algorithm.name, "sequential/valid_algorithm/1")
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
self.assertFalse(algorithm.errors)
self.assertFalse(algorithm.results) # it is not an analyzer
......@@ -209,7 +209,7 @@ class TestSequentialAPI_Loading(unittest.TestCase):
def test_load_valid_analyser(self):
algorithm = Algorithm(prefix, "sequential/valid_analysis/1")
self.assertEqual(algorithm.name, "sequential/valid_analysis/1")
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
self.assertFalse(algorithm.errors)
self.assertFalse(algorithm.output_map) # it is an analyzer
......@@ -234,10 +234,10 @@ class TestSequentialAPI_Loading(unittest.TestCase):
self.assertFalse(runnable.ready)
self.assertFalse(runnable.prepared)
def test_load_valid_loop(self):
algorithm = Algorithm(prefix, "sequential/loop/1")
self.assertEqual(algorithm.name, "sequential/loop/1")
self.assertTrue(algorithm.valid)
def test_load_valid_loop_evaluator(self):
algorithm = Algorithm(prefix, "sequential/loop_evaluator/1")
self.assertEqual(algorithm.name, "sequential/loop_evaluator/1")
self.assertTrue(algorithm.valid, algorithm.errors)
self.assertFalse(algorithm.errors)
self.assertFalse(algorithm.results) # it is not an analyzer
......@@ -246,16 +246,16 @@ class TestSequentialAPI_Loading(unittest.TestCase):
self.assertTrue(algorithm.output_map)
self.assertEqual(algorithm.schema_version, 3)
self.assertEqual(algorithm.api_version, 2)
self.assertEqual(algorithm.type, Algorithm.SEQUENTIAL_LOOP)
self.assertEqual(algorithm.type, Algorithm.SEQUENTIAL_LOOP_EVALUATOR)
runnable = algorithm.runner()
self.assertFalse(runnable.ready)
self.assertTrue(runnable.prepared)
def test_load_valid_loop_user(self):
algorithm = Algorithm(prefix, "sequential/loop_user/1")
self.assertEqual(algorithm.name, "sequential/loop_user/1")
self.assertTrue(algorithm.valid)
def test_load_valid_loop_processor(self):
algorithm = Algorithm(prefix, "sequential/loop_processor/1")
self.assertEqual(algorithm.name, "sequential/loop_processor/1")
self.assertTrue(algorithm.valid, algorithm.errors)
self.assertFalse(algorithm.errors)
self.assertFalse(algorithm.results) # it is not an analyzer
......@@ -264,7 +264,7 @@ class TestSequentialAPI_Loading(unittest.TestCase):
self.assertTrue(algorithm.output_map)
self.assertEqual(algorithm.schema_version, 3)
self.assertEqual(algorithm.api_version, 2)
self.assertEqual(algorithm.type, Algorithm.SEQUENTIAL_LOOP_USER)
self.assertEqual(algorithm.type, Algorithm.SEQUENTIAL_LOOP_PROCESSOR)
runnable = algorithm.runner()
self.assertTrue(runnable.ready)
......@@ -278,7 +278,7 @@ class TestAutonomousAPI_Loading(unittest.TestCase):
def test_load_valid_algorithm(self):
algorithm = Algorithm(prefix, "autonomous/valid_algorithm/1")
self.assertEqual(algorithm.name, "autonomous/valid_algorithm/1")
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
self.assertFalse(algorithm.errors)
self.assertFalse(algorithm.results) # it is not an analyzer
......@@ -296,7 +296,7 @@ class TestAutonomousAPI_Loading(unittest.TestCase):
def test_load_valid_analyser(self):
algorithm = Algorithm(prefix, "autonomous/valid_analysis/1")
self.assertEqual(algorithm.name, "autonomous/valid_analysis/1")
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
self.assertFalse(algorithm.errors)
self.assertFalse(algorithm.output_map) # it is an analyzer
......@@ -321,10 +321,10 @@ class TestAutonomousAPI_Loading(unittest.TestCase):
self.assertFalse(runnable.ready)
self.assertFalse(runnable.prepared)
def test_load_valid_loop(self):
algorithm = Algorithm(prefix, "autonomous/loop/1")
self.assertEqual(algorithm.name, "autonomous/loop/1")
self.assertTrue(algorithm.valid)
def test_load_valid_loop_evaluator(self):
algorithm = Algorithm(prefix, "autonomous/loop_evaluator/1")
self.assertEqual(algorithm.name, "autonomous/loop_evaluator/1")
self.assertTrue(algorithm.valid, algorithm.errors)
self.assertFalse(algorithm.errors)
self.assertFalse(algorithm.results) # it is not an analyzer
......@@ -333,7 +333,7 @@ class TestAutonomousAPI_Loading(unittest.TestCase):
self.assertTrue(algorithm.output_map)
self.assertEqual(algorithm.schema_version, 3)
self.assertEqual(algorithm.api_version, 2)
self.assertEqual(algorithm.type, Algorithm.AUTONOMOUS_LOOP)
self.assertEqual(algorithm.type, Algorithm.AUTONOMOUS_LOOP_EVALUATOR)
runnable = algorithm.runner()
self.assertFalse(runnable.ready)
......@@ -341,10 +341,10 @@ class TestAutonomousAPI_Loading(unittest.TestCase):
runnable.prepared
) # loop/1 has no prepare method so is prepared
def test_load_valid_loop_user(self):
algorithm = Algorithm(prefix, "autonomous/loop_user/1")
self.assertEqual(algorithm.name, "autonomous/loop_user/1")
self.assertTrue(algorithm.valid)
def test_load_valid_loop_processor(self):
algorithm = Algorithm(prefix, "autonomous/loop_processor/1")
self.assertEqual(algorithm.name, "autonomous/loop_processor/1")
self.assertTrue(algorithm.valid, algorithm.errors)
self.assertFalse(algorithm.errors)
self.assertFalse(algorithm.results) # it is not an analyzer
......@@ -353,7 +353,7 @@ class TestAutonomousAPI_Loading(unittest.TestCase):
self.assertTrue(algorithm.output_map)
self.assertEqual(algorithm.schema_version, 3)
self.assertEqual(algorithm.api_version, 2)
self.assertEqual(algorithm.type, Algorithm.AUTONOMOUS_LOOP_USER)
self.assertEqual(algorithm.type, Algorithm.AUTONOMOUS_LOOP_PROCESSOR)
runnable = algorithm.runner()
self.assertTrue(runnable.ready)
......@@ -370,7 +370,7 @@ class TestLegacyAPI_Setup(unittest.TestCase):
def test_setup_crashing_algorithm(self):
algorithm = Algorithm(prefix, self.username + "/setup_crash/1")
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
runnable = algorithm.runner()
self.assertFalse(runnable.ready)
......@@ -380,7 +380,7 @@ class TestLegacyAPI_Setup(unittest.TestCase):
def test_setup_failing_algorithm(self):
algorithm = Algorithm(prefix, self.username + "/setup_fail/1")
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
runnable = algorithm.runner()
self.assertFalse(runnable.ready)
......@@ -389,7 +389,7 @@ class TestLegacyAPI_Setup(unittest.TestCase):
def test_setup_nonparametrized_algorithm(self):
algorithm = Algorithm(prefix, self.username + "/no_setup/1")
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
runnable = algorithm.runner()
self.assertTrue(runnable.ready)
......@@ -398,7 +398,7 @@ class TestLegacyAPI_Setup(unittest.TestCase):
def test_setup_parametrized_algorithm_default_values(self):
algorithm = Algorithm(prefix, self.username + "/parametrized/1")
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
runnable = algorithm.runner()
self.assertFalse(runnable.ready)
......@@ -430,7 +430,7 @@ class TestLegacyAPI_Setup(unittest.TestCase):
def test_setup_parametrized_algorithm_customized_values(self):
algorithm = Algorithm(prefix, self.username + "/parametrized/1")
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
runnable = algorithm.runner()
self.assertFalse(runnable.ready)
......@@ -474,7 +474,7 @@ class TestLegacyAPI_Setup(unittest.TestCase):
def test_setup_parametrized_algorithm_out_of_range_value(self):
algorithm = Algorithm(prefix, self.username + "/parametrized/1")
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
runnable = algorithm.runner()
self.assertFalse(runnable.ready)
......@@ -484,7 +484,7 @@ class TestLegacyAPI_Setup(unittest.TestCase):
def test_setup_parametrized_algorithm_invalid_choice_value(self):
algorithm = Algorithm(prefix, self.username + "/parametrized/1")
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
runnable = algorithm.runner()
self.assertFalse(runnable.ready)
......@@ -517,7 +517,7 @@ class TestAutonomousAPI_Setup(TestLegacyAPI_Setup):
class TestLegacyAPI_Prepare(unittest.TestCase):
def test_always_prepared(self):
algorithm = Algorithm(prefix, "legacy/valid_algorithm/1")
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
runnable = algorithm.runner()
self.assertTrue(runnable.prepared)
......@@ -530,7 +530,7 @@ class TestLegacyAPI_Prepare(unittest.TestCase):
log_messages = log_handler.messages
algorithm = Algorithm(prefix, "legacy/prepare/1")
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
runnable = algorithm.runner()
self.assertTrue(runnable.prepared)
......@@ -555,7 +555,7 @@ class TestSequentialAPI_Prepare(unittest.TestCase):
def test_prepare_crashing_algorithm(self):
algorithm = Algorithm(prefix, self.username + "/prepare_crash/1")
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
runnable = algorithm.runner()
self.assertTrue(runnable.ready)
......@@ -567,7 +567,7 @@ class TestSequentialAPI_Prepare(unittest.TestCase):
def test_prepare_failing_algorithm(self):
algorithm = Algorithm(prefix, self.username + "/prepare_fail/1")
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
runnable = algorithm.runner()
self.assertTrue(runnable.ready)
......@@ -578,7 +578,7 @@ class TestSequentialAPI_Prepare(unittest.TestCase):
def test_no_preparation_algorithm(self):
algorithm = Algorithm(prefix, self.username + "/no_prepare/1")
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
runnable = algorithm.runner()
self.assertTrue(runnable.ready)
......@@ -678,7 +678,7 @@ class TestLegacyAPI_Process(TestExecutionBase):
def test_process_crashing_algorithm(self):
algorithm = Algorithm(prefix, "legacy/process_crash/1")
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
runnable = algorithm.runner()
self.assertTrue(runnable.ready)
......@@ -864,7 +864,7 @@ class TestSequentialAPI_Process(TestExecutionBase):
def test_process_crashing_algorithm(self):
algorithm = Algorithm(prefix, "sequential/process_crash/1")
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
runnable = algorithm.runner()
self.assertTrue(runnable.ready)
......@@ -1108,7 +1108,7 @@ class TestAutonomousAPI_Process(TestExecutionBase):
def test_process_crashing_algorithm(self):
algorithm = Algorithm(prefix, "autonomous/process_crash/1")
self.assertTrue(algorithm.valid)
self.assertTrue(algorithm.valid, algorithm.errors)
runnable = algorithm.runner()
self.assertTrue(runnable.ready)
......
......@@ -247,14 +247,15 @@ class TestExecution(unittest.TestCase):
self.assertEqual(start, i)
self.assertEqual(end, i)
def test_autonomous_loop_user(self):
self.process("autonomous/loop_user/1", "autonomous/loop/1")
def test_autonomous_loop_processor(self):
self.process("autonomous/loop_processor/1", "autonomous/loop_evaluator/1")
def test_sequential_loop_user(self):
self.process("sequential/loop_user/1", "sequential/loop/1")
def test_sequential_loop_processor(self):
self.process("sequential/loop_processor/1", "sequential/loop_evaluator/1")
def test_autonomous_loop_invalid_validate_output(self):
with self.assertRaises(RemoteException):
self.process(
"autonomous/loop_user/1", "autonomous/invalid_loop_validate_output/1"
"autonomous/loop_processor/1",
"autonomous/invalid_loop_validate_output/1",
)
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