diff --git a/SpiffWorkflow/bpmn/serializer/default/workflow.py b/SpiffWorkflow/bpmn/serializer/default/workflow.py index c8d073bf..a26ceb0b 100644 --- a/SpiffWorkflow/bpmn/serializer/default/workflow.py +++ b/SpiffWorkflow/bpmn/serializer/default/workflow.py @@ -76,12 +76,14 @@ def to_dict(self, workflow): 'correlations': workflow.correlations, 'last_task': str(workflow.last_task.id) if workflow.last_task is not None else None, 'success': workflow.success, + 'completed': workflow.completed, 'tasks': self.mapping_to_dict(workflow.tasks), 'root': str(workflow.task_tree.id), } def set_default_attributes(self, workflow, dct): workflow.success = dct['success'] + workflow.completed = dct.get('completed', False) workflow.correlations = dct.pop('correlations', {}) if isinstance(dct['last_task'], str): workflow.last_task = workflow.tasks.get(UUID(dct['last_task'])) diff --git a/SpiffWorkflow/bpmn/specs/data_spec.py b/SpiffWorkflow/bpmn/specs/data_spec.py index bb9a0af5..4150c641 100644 --- a/SpiffWorkflow/bpmn/specs/data_spec.py +++ b/SpiffWorkflow/bpmn/specs/data_spec.py @@ -22,7 +22,7 @@ from SpiffWorkflow.bpmn.exceptions import WorkflowDataException -data_log = logging.getLogger('spiff.data') +logger = logging.getLogger('spiff.data') class BpmnDataSpecification: @@ -73,7 +73,7 @@ def get(self, my_task): raise WorkflowDataException(message, my_task, data_input=self) my_task.data[self.bpmn_id] = deepcopy(wf.data_objects[self.bpmn_id]) - data_log.info(f'Read workflow variable {self.bpmn_id}', extra=my_task.log_info()) + logger.info(f'Read workflow variable', extra=my_task.collect_log_extras({'bpmn_id': self.bpmn_id})) def set(self, my_task): """Copy a value from the task data to the workflow data""" @@ -88,7 +88,7 @@ def set(self, my_task): wf.data_objects[self.bpmn_id] = deepcopy(my_task.data[self.bpmn_id]) del my_task.data[self.bpmn_id] - data_log.info(f'Set workflow variable {self.bpmn_id}', extra=my_task.log_info()) + logger.info(f'Set workflow variable', extra=my_task.collect_log_extras({'bpmn_id': self.bpmn_id})) def delete(self, my_task): my_task.data.pop(self.bpmn_id, None) diff --git a/SpiffWorkflow/bpmn/specs/mixins/events/end_event.py b/SpiffWorkflow/bpmn/specs/mixins/events/end_event.py index f3a55a1d..8aa2838e 100644 --- a/SpiffWorkflow/bpmn/specs/mixins/events/end_event.py +++ b/SpiffWorkflow/bpmn/specs/mixins/events/end_event.py @@ -17,7 +17,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA -from SpiffWorkflow.util.task import TaskState, TaskFilter +from SpiffWorkflow.util.task import TaskState from SpiffWorkflow.bpmn.specs.event_definitions.simple import TerminateEventDefinition, CancelEventDefinition from .event_types import ThrowingEvent @@ -46,11 +46,10 @@ def _on_complete_hook(self, my_task): super(EndEvent, self)._on_complete_hook(my_task) if isinstance(self.event_definition, TerminateEventDefinition): - # We are finished. Set the workflow data and cancel all tasks - my_task.workflow.set_data(**my_task.data) - for task in my_task.workflow.get_tasks(task_filter=TaskFilter(state=TaskState.NOT_FINISHED_MASK)): + for task in my_task.workflow.get_tasks(state=TaskState.NOT_FINISHED_MASK): task.cancel() + my_task.workflow._mark_complete(my_task) elif isinstance(self.event_definition, CancelEventDefinition): my_task.workflow.cancel() diff --git a/SpiffWorkflow/bpmn/specs/mixins/events/event_types.py b/SpiffWorkflow/bpmn/specs/mixins/events/event_types.py index 4c6137b3..bd5095fc 100644 --- a/SpiffWorkflow/bpmn/specs/mixins/events/event_types.py +++ b/SpiffWorkflow/bpmn/specs/mixins/events/event_types.py @@ -45,7 +45,6 @@ def catch(self, my_task, event): definition, at which point we can update our task's state. """ self.event_definition.catch(my_task, event) - my_task.last_state_change = time.time() my_task._set_state(TaskState.WAITING) def _update_hook(self, my_task): diff --git a/SpiffWorkflow/bpmn/specs/mixins/subworkflow_task.py b/SpiffWorkflow/bpmn/specs/mixins/subworkflow_task.py index 97c71a0c..ab97861c 100644 --- a/SpiffWorkflow/bpmn/specs/mixins/subworkflow_task.py +++ b/SpiffWorkflow/bpmn/specs/mixins/subworkflow_task.py @@ -56,7 +56,7 @@ def _update_hook(self, my_task): self.start_workflow(my_task) my_task._set_state(TaskState.STARTED) else: - return subprocess.is_completed() + return subprocess.completed def _on_cancel(self, my_task): subworkflow = my_task.workflow.top_workflow.get_subprocess(my_task) diff --git a/SpiffWorkflow/bpmn/util/diff.py b/SpiffWorkflow/bpmn/util/diff.py index 8c8a0c5e..0f0d1b6a 100644 --- a/SpiffWorkflow/bpmn/util/diff.py +++ b/SpiffWorkflow/bpmn/util/diff.py @@ -112,7 +112,6 @@ def _aligned(self, original, candidates): all(first is not None and first.name == second.name for first, second in zip(subs, candidates)) def _compare_task_specs(self, spec, candidate): - s1 = self._registry.convert(spec) s2 = self._registry.convert(candidate) if s1.get('typename') != s2.get('typename'): diff --git a/SpiffWorkflow/bpmn/util/subworkflow.py b/SpiffWorkflow/bpmn/util/subworkflow.py index 056a18fb..54674fa2 100644 --- a/SpiffWorkflow/bpmn/util/subworkflow.py +++ b/SpiffWorkflow/bpmn/util/subworkflow.py @@ -39,11 +39,11 @@ def get_tasks_iterator(self, first_task=None, **kwargs): class BpmnSubWorkflow(BpmnBaseWorkflow): def __init__(self, spec, parent_task_id, top_workflow, **kwargs): - super().__init__(spec, **kwargs) self.parent_task_id = parent_task_id self.top_workflow = top_workflow self.correlations = {} self.depth = self._calculate_depth() + super().__init__(spec, **kwargs) @property def script_engine(self): diff --git a/SpiffWorkflow/bpmn/workflow.py b/SpiffWorkflow/bpmn/workflow.py index f4b0ecd6..b2cc95cc 100644 --- a/SpiffWorkflow/bpmn/workflow.py +++ b/SpiffWorkflow/bpmn/workflow.py @@ -99,7 +99,7 @@ def delete_subprocess(self, my_task): return tasks def get_active_subprocesses(self): - return [sp for sp in self.subprocesses.values() if not sp.is_completed()] + return [sp for sp in self.subprocesses.values() if not sp.completed] def catch(self, event): """ diff --git a/SpiffWorkflow/operators.py b/SpiffWorkflow/operators.py index 2071861d..0049c7b6 100644 --- a/SpiffWorkflow/operators.py +++ b/SpiffWorkflow/operators.py @@ -20,7 +20,7 @@ import logging import re -logger = logging.getLogger('spiff') +logger = logging.getLogger('spiff.task') class Term(object): @@ -182,7 +182,7 @@ def valueof(scope, op, default=None): return default elif isinstance(op, Attrib): if op.name not in scope.data: - logger.debug("Attrib('{op.name}') not present in task data", extra=scope.log_info({'data': scope.data})) + logger.debug("Attrib('{op.name}') not present in task data", extra=scope.collect_log_extras({'data': scope.data})) return scope.get_data(op.name, default) elif isinstance(op, PathAttrib): if not op.path: @@ -191,7 +191,7 @@ def valueof(scope, op, default=None): data = scope.data for part in parts: if part not in data: - logger.debug(f"PathAttrib('{op.name}') not present in task data", extra=scope.log_info({'data': scope.data})) + logger.debug(f"PathAttrib('{op.name}') not present in task data", extra=scope.collect_log_extras({'data': scope.data})) return default data = data[part] # move down the path return data diff --git a/SpiffWorkflow/specs/SubWorkflow.py b/SpiffWorkflow/specs/SubWorkflow.py index ccf27cac..9267d58c 100644 --- a/SpiffWorkflow/specs/SubWorkflow.py +++ b/SpiffWorkflow/specs/SubWorkflow.py @@ -122,7 +122,7 @@ def _update_hook(self, my_task): subworkflow = my_task._get_internal_data('subworkflow') if subworkflow is None: self._create_subworkflow(my_task) - elif subworkflow.is_completed(): + elif subworkflow.completed: my_task.complete() def _on_subworkflow_completed(self, subworkflow, my_task): diff --git a/SpiffWorkflow/specs/Transform.py b/SpiffWorkflow/specs/Transform.py index 585fdcb4..5921f88e 100644 --- a/SpiffWorkflow/specs/Transform.py +++ b/SpiffWorkflow/specs/Transform.py @@ -21,7 +21,7 @@ from .base import TaskSpec -logger = logging.getLogger('spiff') +logger = logging.getLogger('spiff.task') class Transform(TaskSpec): @@ -56,7 +56,7 @@ def _update_hook(self, my_task): if self.transforms: for transform in self.transforms: - logger.debug('Execute transform', extra=my_task.log_info({'transform': transform})) + logger.debug('Execute transform', extra=my_task.collect_log_extras({'transform': transform})) exec(transform) return True diff --git a/SpiffWorkflow/task.py b/SpiffWorkflow/task.py index 1d09540f..bf0d0f58 100644 --- a/SpiffWorkflow/task.py +++ b/SpiffWorkflow/task.py @@ -27,9 +27,7 @@ from .util.deep_merge import DeepMerge from .exceptions import WorkflowException -logger = logging.getLogger('spiff') -metrics = logging.getLogger('spiff.metrics') -data_log = logging.getLogger('spiff.data') +logger = logging.getLogger('spiff.task') class Task(object): @@ -100,7 +98,6 @@ def state(self): @state.setter def state(self, value): - if value < self._state: raise WorkflowException( 'state went from %s to %s!' % (TaskState.get_name(self._state), TaskState.get_name(value)), @@ -173,6 +170,7 @@ def reset_branch(self, data): Returns: list(`Task`): tasks removed from the tree """ + logger.info(f'Branch reset', extra=self.collect_log_extras()) self.internal_data = {} self.data = deepcopy(self.parent.data) if data is None else data descendants = [t for t in self] @@ -294,11 +292,15 @@ def _set_state(self, value): """Force set the state on a task""" if value != self.state: - logger.info(f'State change to {TaskState.get_name(value)}', extra=self.log_info()) + elapsed = time.time() - self.last_state_change self.last_state_change = time.time() self._state = value + logger.info( + f'State changed to {TaskState.get_name(value)}', + extra=self.collect_log_extras({'elapsed': elapsed}) + ) else: - logger.debug(f'State set to {TaskState.get_name(value)}', extra=self.log_info()) + logger.debug(f'State set to {TaskState.get_name(value)}', extra=self.collect_log_extras()) def _assign_new_thread_id(self, recursive=True): """Assigns a new thread id to the task.""" @@ -347,11 +349,6 @@ def run(self): """ start = time.time() retval = self.task_spec._run(self) - extra = self.log_info({ - 'action': 'Complete', - 'elapsed': time.time() - start - }) - metrics.debug('', extra=extra) if retval is None: self._set_state(TaskState.STARTED) elif retval is False: @@ -374,7 +371,6 @@ def complete(self): """Marks this task complete.""" self._set_state(TaskState.COMPLETED) self.task_spec._on_complete(self) - self.workflow.last_task = self def error(self): """Marks this task as error.""" @@ -388,17 +384,25 @@ def trigger(self, *args): """ self.task_spec._on_trigger(self, *args) - def log_info(self, dct=None): + def collect_log_extras(self, dct=None): """Return logging details for this task""" - extra = dct or {} - extra.update({ + extra = { 'workflow_spec': self.workflow.spec.name, 'task_spec': self.task_spec.name, 'task_id': self.id, 'task_type': self.task_spec.__class__.__name__, - 'data': self.data if logger.level < 20 else None, - 'internal_data': self.internal_data if logger.level <= 10 else None, - }) + 'state': TaskState.get_name(self._state), + 'last_state_change': self.last_state_change, + 'elapsed': 0, + 'parent': None if self.parent is None else self.parent.id, + } + if dct is not None: + extra.update(dct) + if logger.level < 20: + extra.update({ + 'data': self.data if logger.level < 20 else None, + 'internal_data': self.internal_data if logger.level < 20 else None, + }) return extra def __iter__(self): diff --git a/SpiffWorkflow/workflow.py b/SpiffWorkflow/workflow.py index 50615155..a67d5f7b 100644 --- a/SpiffWorkflow/workflow.py +++ b/SpiffWorkflow/workflow.py @@ -25,7 +25,7 @@ from .util.event import Event from .exceptions import TaskNotFoundException, WorkflowException -logger = logging.getLogger('spiff') +logger = logging.getLogger('spiff.workflow') class Workflow(object): @@ -64,8 +64,8 @@ def __init__(self, workflow_spec, deserializing=False): if not deserializing: self.task_tree = Task(self, self.spec.start, state=TaskState.FUTURE) self.task_tree.task_spec._predict(self.task_tree, mask=TaskState.NOT_FINISHED_MASK) + logger.info('Initialized workflow', extra=self.collect_log_extras()) self.task_tree._ready() - logger.info('Initialize', extra=self.log_info()) def is_completed(self): """Checks whether the workflow is complete. @@ -73,15 +73,13 @@ def is_completed(self): Returns: bool: True if the workflow has no unfinished tasks """ - if self.completed: - return True - iter = TaskIterator(self.task_tree, state=TaskState.NOT_FINISHED_MASK) - try: - next(iter) - except StopIteration: - self.completed = True - return True - return False + if not self.completed: + iter = TaskIterator(self.task_tree, state=TaskState.NOT_FINISHED_MASK) + try: + next(iter) + except StopIteration: + self.completed = True + return self.completed def manual_input_required(self): """Checks whether the workflow requires manual input. @@ -215,13 +213,14 @@ def cancel(self, success=False): list(`Task`): the cancelled tasks """ self.success = success - cancel = [] + self.completed = True + logger.info(f'Workflow cancelled', extra=self.collect_log_extras()) + cancelled = [] for task in TaskIterator(self.task_tree, state=TaskState.NOT_FINISHED_MASK): - cancel.append(task) - for task in cancel: + cancelled.append(task) + for task in cancelled: task.cancel() - logger.info(f'Cancel with {len(cancel)} remaining', extra=self.log_info()) - return cancel + return cancelled def set_data(self, **kwargs): """Defines the given attribute/value pairs.""" @@ -247,23 +246,23 @@ def reset_from_task_id(self, task_id, data=None): task_id: the id of the task to reset to data (dict): optionally replace the data (if None, data will be copied from the parent task) - Returns: + Returns: extra.update( list(`Task`): tasks removed from the tree """ task = self.get_task_from_id(task_id) self.last_task = task.parent return task.reset_branch(data) - def log_info(self, dct=None): + def collect_log_extras(self, dct=None): """Return logging details for this workflow""" extra = dct or {} extra.update({ 'workflow_spec': self.spec.name, - 'task_spec': None, - 'task_type': None, - 'task_id': None, - 'data': None, + 'success': self.success, + 'completed': self.completed, }) + if logger.level < 20: + extra.update({'tasks': [t.id for t in Workflow.get_tasks(self)]}) return extra def _predict(self, mask=TaskState.NOT_FINISHED_MASK): @@ -273,12 +272,13 @@ def _predict(self, mask=TaskState.NOT_FINISHED_MASK): def _task_completed_notify(self, task): """Called whenever a task completes""" + self.last_task = task if task.task_spec.name == 'End': - self.data.update(task.data) - self.update_waiting_tasks() - if self.completed_event.n_subscribers() > 0 and self.is_completed(): - # Since is_completed() is expensive it makes sense to bail out if calling it is not necessary. + self._mark_complete(task) + if self.completed: self.completed_event(self) + else: + self.update_waiting_tasks() def _remove_task(self, task_id): task = self.tasks[task_id] @@ -287,6 +287,11 @@ def _remove_task(self, task_id): task.parent._children.remove(task.id) self.tasks.pop(task_id) + def _mark_complete(self, task): + logger.info('Workflow completed', extra=self.collect_log_extras()) + self.data.update(task.data) + self.completed = True + def _get_mutex(self, name): """Get or create a mutex""" if name not in self.locks: diff --git a/doc/bpmn/logging.rst b/doc/bpmn/logging.rst index 0b30bc28..e854f76d 100644 --- a/doc/bpmn/logging.rst +++ b/doc/bpmn/logging.rst @@ -2,44 +2,50 @@ Logging ======= Spiff provides several loggers: - - the :code:`spiff` logger, which emits messages when a workflow is initialized and when tasks change state - - the :code:`spiff.metrics` logger, which emits messages containing the elapsed duration of tasks -All log entries created during the course of running a workflow contain the following extra attributes: + - the :code:`spiff.workflow` logger, which emits messages when actions are taken on a workflow + - the :code:`spiff.task` logger, which emits messages when tasks change state -- :code:`workflow_spec`: the name of the current workflow spec -- :code:`task_spec`: the name of the task spec -- :code:`task_id`: the ID of the task) -- :code:`task_type`: the name of the task's spec's class +Records emitted at the :code:`INFO` level, with addtional attributes available for debugging if the level is lower. -If the log level is less than 20: +Log entries emitted by the :code:`spiff.workflow` logger contain the following extra atributes: -- :code:`data` the task data (this can be quite large and is only made available for debugging purposes) +- :code:`workflow_spec`: the name of the spec for this workflow +- :code:`completed`: whether the workflow has completed +- :code:`success`: the value of the :code:`success` attribute -If the log level is less than or equal to 10: +If the log level is less than 20, records include the following extra attribute: -- :code:`internal_data`: the task internal data (only available at DEBUG or below because it is not typically useful) +- :code:`tasks`: a list of the task ids in the workflow -The metrics logger additionally provides and only emits messages at the DEBUG level: +Log entries emitted by the :code:`spiff.task` logger contain the following extra attributes: -- :code:`elapsed`: the time it took the task to run after (ie, the duration of the :code:`task.run` method) +- :code:`workflow_spec`: the name of the spec for this workflow +- :code:`task_spec`: the name of the spec for this task +- :code:`task_id`: the ID of the task) +- :code:`task_type`: the name of the task's spec's class +- :code:`state`: the name of the tasks :code:`TaskState` +- :code:`last_state_chsnge`: the timestamp at which the state change was made +- :code:`elapsed`: the elapsed time since the previous state transition +- :code:`parent`: the id of the task's parent -In our command line UI (:app:`cli/subcommands.py`), we've added a few of these extra attributes to the log records: +If the log level is less than 20, records include the following extra attributes: -.. code-block:: python +- :code:`data` the task data +- :code:`internal_data`: the task internal data + +Log entries containing task data and internal data can be quite large, so use with caution! - spiff_logger = logging.getLogger('spiff') - spiff_handler = logging.StreamHandler() - spiff_handler.setFormatter('%(asctime)s [%(name)s:%(levelname)s] (%(workflow_spec)s:%(task_spec)s) %(message)s') - spiff_logger.addHandler(spiff_handler) +In our command line UI (:app:`cli/subcommands.py`), we've added a few of these extra attributes to the log records: - metrics_logger = logging.getLogger('spiff.metrics') - metrics_handler = logging.StreamHandler() - metrics_handler.setFormatter('%(asctime)s [%(name)s:%(levelname)s] (%(workflow_spec)s:%(task_spec)s) %(elasped)s') - metrics_logger.addHandler(metrics_handler) +.. code-block:: python -In the configuration module :app:`spiff/file.py` that appears in many examples, we set the level of the :code:`spiff` -logger to :code:`INFO`, so that we'll see messages about task state changes, but we ignore the metrics log; however, -the configuration could easily be changed to include it (it can, however generate a high volume of very large records, -so consider yourself warned!). + task_logger = logging.getLogger('spiff.task') + task_handler = logging.StreamHandler() + task_handler.setFormatter(logging.Formatter('%(asctime)s [%(name)s:%(levelname)s] (%(workflow_spec)s:%(task_spec)s) %(message)s')) + task_logger.addHandler(task_handler) + wf_logger = logging.getLogger('spiff.workflow') + wf_handler = logging.StreamHandler() + wf_handler.setFormatter(logging.Formatter('%(asctime)s [%(name)s:%(levelname)s] (%(workflow_spec)s) %(message)s')) + wf_logger.addHandler(wf_handler) diff --git a/tests/SpiffWorkflow/bpmn/CallActivityTest.py b/tests/SpiffWorkflow/bpmn/CallActivityTest.py index 28da02fa..1a71770d 100644 --- a/tests/SpiffWorkflow/bpmn/CallActivityTest.py +++ b/tests/SpiffWorkflow/bpmn/CallActivityTest.py @@ -25,7 +25,7 @@ class CustomScriptEngine(PythonScriptEngine): self.workflow = BpmnWorkflow(self.spec, self.subprocesses, script_engine=CustomScriptEngine()) self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) self.assertIsInstance(self.workflow.script_engine, CustomScriptEngine) # Get the subworkflow @@ -40,7 +40,7 @@ def test_call_activity_allows_removal_of_data(self): # data should be removed in the final output as well. self.workflow = BpmnWorkflow(self.spec, self.subprocesses) self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) self.assertNotIn('remove_this_var', self.workflow.last_task.data.keys()) def test_call_activity_errors_include_task_trace(self): diff --git a/tests/SpiffWorkflow/bpmn/CollaborationTest.py b/tests/SpiffWorkflow/bpmn/CollaborationTest.py index 6e834247..080472f3 100644 --- a/tests/SpiffWorkflow/bpmn/CollaborationTest.py +++ b/tests/SpiffWorkflow/bpmn/CollaborationTest.py @@ -69,7 +69,7 @@ def testBpmnMessage(self): self.assertEqual(receive.state, TaskState.COMPLETED) self.assertEqual(self.workflow.last_task.data, {'from_name': 'Peggy', 'lover_name': 'Peggy', 'other_nonsense': 1001}) self.assertEqual(self.workflow.correlations, {'lover':{'lover_name':'Peggy'}}) - self.assertEqual(self.workflow.is_completed(), True) + self.assertEqual(self.workflow.completed, True) def testCorrelation(self): diff --git a/tests/SpiffWorkflow/bpmn/DataObjectTest.py b/tests/SpiffWorkflow/bpmn/DataObjectTest.py index 03e164ed..a9836a41 100644 --- a/tests/SpiffWorkflow/bpmn/DataObjectTest.py +++ b/tests/SpiffWorkflow/bpmn/DataObjectTest.py @@ -102,7 +102,7 @@ def testExpression(self): task.run() # The gateway depends on the value of the data object self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) completed = [task.task_spec.name for task in self.workflow.get_tasks()] self.assertIn('yes', completed) self.assertNotIn('no', completed) diff --git a/tests/SpiffWorkflow/bpmn/InclusiveGatewayTest.py b/tests/SpiffWorkflow/bpmn/InclusiveGatewayTest.py index b22de8bc..add2e8c0 100644 --- a/tests/SpiffWorkflow/bpmn/InclusiveGatewayTest.py +++ b/tests/SpiffWorkflow/bpmn/InclusiveGatewayTest.py @@ -14,14 +14,14 @@ def setUp(self): def testDefaultConditionOnly(self): self.set_data({'v': -1, 'u': -1, 'w': -1}) self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) self.assertDictEqual(self.workflow.data, {'v': 0, 'u': -1, 'w': -1}) def testDefaultConditionOnlySaveRestore(self): self.set_data({'v': -1, 'u': -1, 'w': -1}) self.save_restore() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) self.assertDictEqual(self.workflow.data, {'v': 0, 'u': -1, 'w': -1}) def testNoPathFromSecondGateway(self): @@ -38,7 +38,7 @@ def testParallelCondition(self): self.assertTrue(self.workflow.get_next_task(spec_name='u_plus_v').state, TaskState.READY) self.assertTrue(self.workflow.get_next_task(spec_name='w_plus_v').state, TaskState.READY) self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) self.assertDictEqual(self.workflow.data, {'v': 0, 'u': 1, 'w': 1}) def set_data(self, value): diff --git a/tests/SpiffWorkflow/bpmn/NestedProcessesTest.py b/tests/SpiffWorkflow/bpmn/NestedProcessesTest.py index 6431dbdd..ace55b6b 100644 --- a/tests/SpiffWorkflow/bpmn/NestedProcessesTest.py +++ b/tests/SpiffWorkflow/bpmn/NestedProcessesTest.py @@ -21,7 +21,7 @@ def testRunThroughHappy(self): self.complete_task('Action2', True) self.assertEqual(1, len(self.workflow.get_tasks(state=TaskState.READY))) self.complete_task('Action3', True) - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) def testResetToTop(self): @@ -37,7 +37,7 @@ def testResetToTop(self): self.complete_task('Action2') self.complete_task('Action3') - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) def testResetToIntermediate(self): @@ -54,7 +54,7 @@ def testResetToIntermediate(self): task.run() self.complete_task('Action3') - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) def testResetToSubworkflow(self): @@ -71,7 +71,7 @@ def testResetToSubworkflow(self): self.assertEqual(task.state, TaskState.STARTED) self.complete_task('Action2', True) self.complete_task('Action3', True) - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) def complete_task(self, name, save_restore=False): self.do_next_named_step(name) diff --git a/tests/SpiffWorkflow/bpmn/ParallelMultiInstanceTest.py b/tests/SpiffWorkflow/bpmn/ParallelMultiInstanceTest.py index 46b9bf61..88254d0f 100644 --- a/tests/SpiffWorkflow/bpmn/ParallelMultiInstanceTest.py +++ b/tests/SpiffWorkflow/bpmn/ParallelMultiInstanceTest.py @@ -47,7 +47,7 @@ def set_io_and_run_workflow(self, data, data_input=None, data_output=None, save_ self.assertEqual(len(task_info['completed']), 3) self.assertEqual(len(task_info['running']), 0) self.assertEqual(len(task_info['future']), 0) - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) def run_workflow_with_condition(self, data): @@ -66,7 +66,7 @@ def run_workflow_with_condition(self, data): self.workflow.do_engine_steps() self.workflow.refresh_waiting_tasks() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) self.assertEqual(len([ t for t in ready_tasks if t.state == TaskState.CANCELLED]), 2) @@ -169,7 +169,7 @@ def testEmptyCollection(self): start = self.workflow.get_next_task(end_at_spec='Start') start.data = {'input_data': []} self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) self.assertDictEqual(self.workflow.data, {'input_data': [], 'output_data': []}) def testCondition(self): diff --git a/tests/SpiffWorkflow/bpmn/PythonScriptEngineEnvironmentTest.py b/tests/SpiffWorkflow/bpmn/PythonScriptEngineEnvironmentTest.py index 2d2c894d..2137cb6f 100644 --- a/tests/SpiffWorkflow/bpmn/PythonScriptEngineEnvironmentTest.py +++ b/tests/SpiffWorkflow/bpmn/PythonScriptEngineEnvironmentTest.py @@ -108,4 +108,4 @@ def testStartedState(self): self.workflow.do_engine_steps() end = self.workflow.get_next_task(spec_name='End') self.assertDictEqual(end.data, {'x': 1, 'y': 2, 'z': 3}) - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) diff --git a/tests/SpiffWorkflow/bpmn/PythonScriptEngineTest.py b/tests/SpiffWorkflow/bpmn/PythonScriptEngineTest.py index 3bf4fcf9..52a4eb7e 100644 --- a/tests/SpiffWorkflow/bpmn/PythonScriptEngineTest.py +++ b/tests/SpiffWorkflow/bpmn/PythonScriptEngineTest.py @@ -31,7 +31,7 @@ def testNoDataPollution(self): when it should not be there""" startTask = self.workflow.get_tasks(state=TaskState.READY)[0] self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) self.assertTrue("testvar" in self.workflow.last_task.data) self.assertFalse("testvar" in startTask.data) diff --git a/tests/SpiffWorkflow/bpmn/ResetSubProcessTest.py b/tests/SpiffWorkflow/bpmn/ResetSubProcessTest.py index 2a4d8072..0909c73d 100644 --- a/tests/SpiffWorkflow/bpmn/ResetSubProcessTest.py +++ b/tests/SpiffWorkflow/bpmn/ResetSubProcessTest.py @@ -72,4 +72,4 @@ def actualTest(self, save_restore=False): self.assertEqual(task.task_spec.name,'Task2') task.run() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) diff --git a/tests/SpiffWorkflow/bpmn/ResetTokenOnBoundaryEventTest.py b/tests/SpiffWorkflow/bpmn/ResetTokenOnBoundaryEventTest.py index d36d92ab..1ae3a8eb 100644 --- a/tests/SpiffWorkflow/bpmn/ResetTokenOnBoundaryEventTest.py +++ b/tests/SpiffWorkflow/bpmn/ResetTokenOnBoundaryEventTest.py @@ -49,7 +49,7 @@ def reset_to_outer_workflow(self, save_restore=False): # Ensure the workflow can be completed without being stuck on stranded tasks self.complete_workflow() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) def reset_to_subprocess(self, save_restore=False): @@ -74,7 +74,7 @@ def reset_to_subprocess(self, save_restore=False): # Ensure the workflow can be completed without being stuck on stranded tasks self.complete_workflow() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) def advance_to_task(self, name): diff --git a/tests/SpiffWorkflow/bpmn/SequentialMultiInstanceTest.py b/tests/SpiffWorkflow/bpmn/SequentialMultiInstanceTest.py index 1bb728a0..3f93ee28 100644 --- a/tests/SpiffWorkflow/bpmn/SequentialMultiInstanceTest.py +++ b/tests/SpiffWorkflow/bpmn/SequentialMultiInstanceTest.py @@ -53,7 +53,7 @@ def set_io_and_run_workflow(self, data, data_input=None, data_output=None, save_ instance = info['instance'] self.assertEqual(task_info['instance_map'][instance], str(child.id)) self.assertEqual(len(children), 3) - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) def run_workflow_with_condition(self, data, condition): @@ -80,7 +80,7 @@ def run_workflow_with_condition(self, data, condition): self.workflow.do_engine_steps() children = self.workflow.get_tasks(spec_name='any_task [child]') self.assertEqual(len(children), 2) - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) class SequentialMultiInstanceExistingOutputTest(BaseTestCase): @@ -182,7 +182,7 @@ def testEmptyCollection(self): start = self.workflow.task_tree start.data = {'input_data': []} self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) self.assertDictEqual(self.workflow.data, {'input_data': [], 'output_data': []}) def testCondition(self): diff --git a/tests/SpiffWorkflow/bpmn/StandardLoopTest.py b/tests/SpiffWorkflow/bpmn/StandardLoopTest.py index 1c813d65..2a0c30de 100644 --- a/tests/SpiffWorkflow/bpmn/StandardLoopTest.py +++ b/tests/SpiffWorkflow/bpmn/StandardLoopTest.py @@ -39,7 +39,7 @@ def testLoopMaximum(self): self.assertEqual(task_info['iterations_remaining'], 0) self.assertEqual(len(task_info['instance_map']), 3) - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) def testLoopCondition(self): @@ -54,7 +54,7 @@ def testLoopCondition(self): ready_tasks[0].run() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) def testSkipLoop(self): @@ -64,7 +64,7 @@ def testSkipLoop(self): self.workflow.do_engine_steps() self.workflow.refresh_waiting_tasks() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) class ParseStandardLoop(BpmnWorkflowTestCase): diff --git a/tests/SpiffWorkflow/bpmn/events/ActionManagementTest.py b/tests/SpiffWorkflow/bpmn/events/ActionManagementTest.py index a3d0df1a..b98a013c 100644 --- a/tests/SpiffWorkflow/bpmn/events/ActionManagementTest.py +++ b/tests/SpiffWorkflow/bpmn/events/ActionManagementTest.py @@ -50,7 +50,7 @@ def testRunThroughHappy(self): self.do_next_named_step("Complete Work", choice="Done") self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) def testRunThroughOverdue(self): self.do_next_exclusive_step("Review Action", choice='Approve') @@ -89,13 +89,13 @@ def testRunThroughOverdue(self): self.do_next_named_step("Complete Work", choice="Done") self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) def testRunThroughCancel(self): self.do_next_exclusive_step("Review Action", choice='Cancel') self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) def testRunThroughCancelAfterApproved(self): self.do_next_exclusive_step("Review Action", choice='Approve') @@ -104,7 +104,7 @@ def testRunThroughCancelAfterApproved(self): self.do_next_named_step("Cancel Action (if necessary)") self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) self.assertEqual('ACTION CANCELLED', self.workflow.get_data('script_output')) def testRunThroughCancelAfterWorkStarted(self): @@ -127,5 +127,5 @@ def testRunThroughCancelAfterWorkStarted(self): self.do_next_named_step("Cancel Action (if necessary)") self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) self.assertEqual('ACTION CANCELLED', self.workflow.get_data('script_output')) diff --git a/tests/SpiffWorkflow/bpmn/events/CallActivityEscalationTest.py b/tests/SpiffWorkflow/bpmn/events/CallActivityEscalationTest.py index 28d125bb..8ac57b9e 100644 --- a/tests/SpiffWorkflow/bpmn/events/CallActivityEscalationTest.py +++ b/tests/SpiffWorkflow/bpmn/events/CallActivityEscalationTest.py @@ -51,7 +51,7 @@ def testShouldEscalate(self): self.workflow.do_engine_steps() self.save_restore() self.workflow.run_all() - self.assertEqual(True, self.workflow.is_completed()) + self.assertEqual(True, self.workflow.completed) self.assertEqual(True, 'EndEvent_specific1_noninterrupting_normal' in completed_set) self.assertEqual(True, 'EndEvent_specific1_noninterrupting_escalated' in completed_set) @@ -81,7 +81,7 @@ def testShouldNotEscalate(self): self.workflow.do_engine_steps() self.save_restore() self.workflow.run_all() - self.assertEqual(True, self.workflow.is_completed()) + self.assertEqual(True, self.workflow.completed) self.assertEqual(True, 'EndEvent_specific1_noninterrupting_normal' in completed_set) self.assertEqual(True, 'EndEvent_specific1_noninterrupting_escalated' not in completed_set) @@ -109,7 +109,7 @@ def testMissingVariable(self): self.workflow.do_engine_steps() self.save_restore() self.workflow.run_all() - self.assertEqual(True, self.workflow.is_completed()) + self.assertEqual(True, self.workflow.completed) self.assertEqual(True, 'EndEvent_specific1_noninterrupting_normal' in completed_set) self.assertEqual(True, 'EndEvent_specific1_noninterrupting_escalated' not in completed_set) diff --git a/tests/SpiffWorkflow/bpmn/events/ConditionalEventTest.py b/tests/SpiffWorkflow/bpmn/events/ConditionalEventTest.py index 2e39b181..4a93e170 100644 --- a/tests/SpiffWorkflow/bpmn/events/ConditionalEventTest.py +++ b/tests/SpiffWorkflow/bpmn/events/ConditionalEventTest.py @@ -24,7 +24,7 @@ def testIntermediateEvent(self): # Completion of A results in event being updated self.assertEqual(event.state, TaskState.READY) self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) def testBoundaryEvent(self): spec, subprocesses = self.load_workflow_spec('conditional_event.bpmn', 'boundary') @@ -40,5 +40,5 @@ def testBoundaryEvent(self): self.workflow.do_engine_steps() d = self.workflow.get_next_task(spec_name='task_d') self.assertEqual(d.state, TaskState.CANCELLED) - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) diff --git a/tests/SpiffWorkflow/bpmn/events/EventBasedGatewayTest.py b/tests/SpiffWorkflow/bpmn/events/EventBasedGatewayTest.py index 9d735b9c..ae46a163 100644 --- a/tests/SpiffWorkflow/bpmn/events/EventBasedGatewayTest.py +++ b/tests/SpiffWorkflow/bpmn/events/EventBasedGatewayTest.py @@ -31,7 +31,7 @@ def actual_test(self, save_restore=False): self.workflow.catch(BpmnEvent(MessageEventDefinition('message_1'), {})) self.workflow.do_engine_steps() self.workflow.refresh_waiting_tasks() - self.assertEqual(self.workflow.is_completed(), True) + self.assertEqual(self.workflow.completed, True) self.assertEqual(self.workflow.get_next_task(spec_name='message_1_event').state, TaskState.COMPLETED) self.assertEqual(self.workflow.get_next_task(spec_name='message_2_event').state, TaskState.CANCELLED) self.assertEqual(self.workflow.get_next_task(spec_name='timer_event').state, TaskState.CANCELLED) @@ -45,7 +45,7 @@ def testTimeout(self): self.workflow.catch(BpmnEvent(timer_event_definition)) self.workflow.refresh_waiting_tasks() self.workflow.do_engine_steps() - self.assertEqual(self.workflow.is_completed(), True) + self.assertEqual(self.workflow.completed, True) self.assertEqual(self.workflow.get_next_task(spec_name='message_1_event').state, TaskState.CANCELLED) self.assertEqual(self.workflow.get_next_task(spec_name='message_2_event').state, TaskState.CANCELLED) self.assertEqual(self.workflow.get_next_task(spec_name='timer_event').state, TaskState.COMPLETED) diff --git a/tests/SpiffWorkflow/bpmn/events/MessageInterruptsSpTest.py b/tests/SpiffWorkflow/bpmn/events/MessageInterruptsSpTest.py index d89a3e35..c783a97a 100644 --- a/tests/SpiffWorkflow/bpmn/events/MessageInterruptsSpTest.py +++ b/tests/SpiffWorkflow/bpmn/events/MessageInterruptsSpTest.py @@ -36,7 +36,7 @@ def testRunThroughHappySaveAndRestore(self): self.save_restore() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) def testRunThroughInterruptSaveAndRestore(self): @@ -59,4 +59,4 @@ def testRunThroughInterruptSaveAndRestore(self): self.save_restore() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) diff --git a/tests/SpiffWorkflow/bpmn/events/MessageInterruptsTest.py b/tests/SpiffWorkflow/bpmn/events/MessageInterruptsTest.py index 7a587c78..850523f4 100644 --- a/tests/SpiffWorkflow/bpmn/events/MessageInterruptsTest.py +++ b/tests/SpiffWorkflow/bpmn/events/MessageInterruptsTest.py @@ -36,7 +36,7 @@ def testRunThroughHappySaveAndRestore(self): self.save_restore() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) def testRunThroughMessageInterruptSaveAndRestore(self): @@ -63,7 +63,7 @@ def testRunThroughMessageInterruptSaveAndRestore(self): self.workflow.do_engine_steps() self.save_restore() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) def testRunThroughHappy(self): @@ -81,7 +81,7 @@ def testRunThroughHappy(self): self.assertEqual(0, len(self.workflow.get_tasks(state=TaskState.WAITING))) self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) def testRunThroughMessageInterrupt(self): @@ -102,4 +102,4 @@ def testRunThroughMessageInterrupt(self): self.do_next_exclusive_step('Acknowledge Interrupt Message') self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) diff --git a/tests/SpiffWorkflow/bpmn/events/MessageNonInterruptTest.py b/tests/SpiffWorkflow/bpmn/events/MessageNonInterruptTest.py index 386fd894..4b40ff35 100644 --- a/tests/SpiffWorkflow/bpmn/events/MessageNonInterruptTest.py +++ b/tests/SpiffWorkflow/bpmn/events/MessageNonInterruptTest.py @@ -36,7 +36,7 @@ def testRunThroughHappySaveAndRestore(self): self.save_restore() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) def testRunThroughMessageInterruptSaveAndRestore(self): @@ -71,7 +71,7 @@ def testRunThroughMessageInterruptSaveAndRestore(self): self.save_restore() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) def testRunThroughHappy(self): @@ -89,7 +89,7 @@ def testRunThroughHappy(self): self.assertEqual(0, len(self.workflow.get_tasks(state=TaskState.WAITING))) self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) def testRunThroughMessageInterrupt(self): @@ -118,7 +118,7 @@ def testRunThroughMessageInterrupt(self): self.do_next_named_step('Do Something That Takes A Long Time') self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) def testRunThroughMessageInterruptOtherOrder(self): @@ -145,7 +145,7 @@ def testRunThroughMessageInterruptOtherOrder(self): self.do_next_named_step('Acknowledge Non-Interrupt Message') self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) def testRunThroughMessageInterruptOtherOrderSaveAndRestore(self): @@ -178,4 +178,4 @@ def testRunThroughMessageInterruptOtherOrderSaveAndRestore(self): self.save_restore() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) diff --git a/tests/SpiffWorkflow/bpmn/events/MessageNonInterruptsSpTest.py b/tests/SpiffWorkflow/bpmn/events/MessageNonInterruptsSpTest.py index df29f65a..54da2521 100644 --- a/tests/SpiffWorkflow/bpmn/events/MessageNonInterruptsSpTest.py +++ b/tests/SpiffWorkflow/bpmn/events/MessageNonInterruptsSpTest.py @@ -36,7 +36,7 @@ def testRunThroughHappySaveAndRestore(self): self.save_restore() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) def testRunThroughMessageSaveAndRestore(self): @@ -65,7 +65,7 @@ def testRunThroughMessageSaveAndRestore(self): self.save_restore() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) def testRunThroughMessageOrder2SaveAndRestore(self): @@ -93,7 +93,7 @@ def testRunThroughMessageOrder2SaveAndRestore(self): self.save_restore() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) def testRunThroughMessageOrder3SaveAndRestore(self): @@ -122,4 +122,4 @@ def testRunThroughMessageOrder3SaveAndRestore(self): self.save_restore() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) diff --git a/tests/SpiffWorkflow/bpmn/events/MessagesTest.py b/tests/SpiffWorkflow/bpmn/events/MessagesTest.py index d6bba07b..d086db32 100644 --- a/tests/SpiffWorkflow/bpmn/events/MessagesTest.py +++ b/tests/SpiffWorkflow/bpmn/events/MessagesTest.py @@ -31,7 +31,7 @@ def testRunThroughHappy(self): self.assertEqual('Test Message', self.workflow.get_tasks(state=TaskState.READY)[0].task_spec.bpmn_name) self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) def testRunThroughSaveAndRestore(self): @@ -52,4 +52,4 @@ def testRunThroughSaveAndRestore(self): self.save_restore() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) \ No newline at end of file + self.assertTrue(self.workflow.completed) \ No newline at end of file diff --git a/tests/SpiffWorkflow/bpmn/events/MultipleThrowEventTest.py b/tests/SpiffWorkflow/bpmn/events/MultipleThrowEventTest.py index 0850a1fe..7dda3436 100644 --- a/tests/SpiffWorkflow/bpmn/events/MultipleThrowEventTest.py +++ b/tests/SpiffWorkflow/bpmn/events/MultipleThrowEventTest.py @@ -21,7 +21,7 @@ def actual_test(self, save_restore=False): self.save_restore() self.workflow.do_engine_steps() self.assertEqual(len(self.workflow.get_tasks(state=TaskState.WAITING)), 0) - self.assertEqual(self.workflow.is_completed(), True) + self.assertEqual(self.workflow.completed, True) class MultipleThrowEventStartsEventTest(BpmnWorkflowTestCase): @@ -45,4 +45,4 @@ def actual_test(self, save_restore=False): self.assertEqual(len(ready_tasks), 1) ready_tasks[0].run() self.workflow.do_engine_steps() - self.assertEqual(self.workflow.is_completed(), True) + self.assertEqual(self.workflow.completed, True) diff --git a/tests/SpiffWorkflow/bpmn/events/NITimerDurationBoundaryTest.py b/tests/SpiffWorkflow/bpmn/events/NITimerDurationBoundaryTest.py index b1992782..bdc72051 100644 --- a/tests/SpiffWorkflow/bpmn/events/NITimerDurationBoundaryTest.py +++ b/tests/SpiffWorkflow/bpmn/events/NITimerDurationBoundaryTest.py @@ -66,5 +66,5 @@ def actual_test(self,save_restore = False): self.workflow.refresh_waiting_tasks() self.workflow.do_engine_steps() self.workflow.do_engine_steps() - self.assertEqual(self.workflow.is_completed(), True) + self.assertEqual(self.workflow.completed, True) self.assertEqual(self.workflow.last_task.data, {'work_done': 'Yes', 'delay_reason': 'Just Because'}) diff --git a/tests/SpiffWorkflow/bpmn/events/StartEventSplitTest.py b/tests/SpiffWorkflow/bpmn/events/StartEventSplitTest.py index 59f8703b..7bfec053 100644 --- a/tests/SpiffWorkflow/bpmn/events/StartEventSplitTest.py +++ b/tests/SpiffWorkflow/bpmn/events/StartEventSplitTest.py @@ -41,6 +41,6 @@ def actual_test(self, save_restore=False): any_task.run() self.run_until_input_required() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) diff --git a/tests/SpiffWorkflow/bpmn/events/TimerCycleStartTest.py b/tests/SpiffWorkflow/bpmn/events/TimerCycleStartTest.py index 3e0a6076..34eba577 100644 --- a/tests/SpiffWorkflow/bpmn/events/TimerCycleStartTest.py +++ b/tests/SpiffWorkflow/bpmn/events/TimerCycleStartTest.py @@ -57,4 +57,4 @@ def actual_test(self,save_restore = False): self.workflow.refresh_waiting_tasks() self.assertEqual(counter, 2) - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) diff --git a/tests/SpiffWorkflow/bpmn/events/TimerDateTest.py b/tests/SpiffWorkflow/bpmn/events/TimerDateTest.py index 69fc2eab..e05f99fb 100644 --- a/tests/SpiffWorkflow/bpmn/events/TimerDateTest.py +++ b/tests/SpiffWorkflow/bpmn/events/TimerDateTest.py @@ -41,5 +41,5 @@ def actual_test(self,save_restore = False): loopcount += 1 endtime = datetime.datetime.now() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) self.assertTrue((endtime-starttime) > datetime.timedelta(seconds=.02)) diff --git a/tests/SpiffWorkflow/bpmn/events/TimerDurationBoundaryOnTaskTest.py b/tests/SpiffWorkflow/bpmn/events/TimerDurationBoundaryOnTaskTest.py index 772efa33..581e572a 100644 --- a/tests/SpiffWorkflow/bpmn/events/TimerDurationBoundaryOnTaskTest.py +++ b/tests/SpiffWorkflow/bpmn/events/TimerDurationBoundaryOnTaskTest.py @@ -39,5 +39,5 @@ def actual_test(self,save_restore = False): task = self.get_ready_user_tasks()[0] task.run() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) diff --git a/tests/SpiffWorkflow/bpmn/events/TimerDurationBoundaryTest.py b/tests/SpiffWorkflow/bpmn/events/TimerDurationBoundaryTest.py index 2aa12889..f073fa07 100644 --- a/tests/SpiffWorkflow/bpmn/events/TimerDurationBoundaryTest.py +++ b/tests/SpiffWorkflow/bpmn/events/TimerDurationBoundaryTest.py @@ -45,7 +45,7 @@ def actual_test(self,save_restore = False): ready_tasks[0].run() ready_tasks = self.get_ready_user_tasks() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) # Assure that the loopcount is less than 10, and the timer interrupt fired, rather # than allowing us to continue to loop the full 10 times. self.assertTrue(loopcount < 10) diff --git a/tests/SpiffWorkflow/bpmn/parallel_gateway_tests/ParallelGatewayLoopInputTest.py b/tests/SpiffWorkflow/bpmn/parallel_gateway_tests/ParallelGatewayLoopInputTest.py index b75c4110..54aa8603 100644 --- a/tests/SpiffWorkflow/bpmn/parallel_gateway_tests/ParallelGatewayLoopInputTest.py +++ b/tests/SpiffWorkflow/bpmn/parallel_gateway_tests/ParallelGatewayLoopInputTest.py @@ -16,5 +16,5 @@ def test_loop_input(self): self.assertEqual(len(ready), 1) ready[0].run() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) self.assertDictEqual(self.workflow.data, { 'x': 2}) diff --git a/tests/SpiffWorkflow/bpmn/parallel_gateway_tests/ParallelOrderTest.py b/tests/SpiffWorkflow/bpmn/parallel_gateway_tests/ParallelOrderTest.py index 132fc656..d087a9ed 100644 --- a/tests/SpiffWorkflow/bpmn/parallel_gateway_tests/ParallelOrderTest.py +++ b/tests/SpiffWorkflow/bpmn/parallel_gateway_tests/ParallelOrderTest.py @@ -16,7 +16,7 @@ def setUp(self): def testRunThroughHappy(self): self.workflow.do_engine_steps() - self.assertFalse(self.workflow.is_completed()) + self.assertFalse(self.workflow.completed) self.assertEqual(4, len(self.get_ready_user_tasks())) tasks = self.get_ready_user_tasks() self.assertEqual("Task 1", tasks[0].task_spec.bpmn_name) diff --git a/tests/SpiffWorkflow/bpmn/serializer/BpmnWorkflowSerializerTest.py b/tests/SpiffWorkflow/bpmn/serializer/BpmnWorkflowSerializerTest.py index c4877a5d..db7fb3e7 100644 --- a/tests/SpiffWorkflow/bpmn/serializer/BpmnWorkflowSerializerTest.py +++ b/tests/SpiffWorkflow/bpmn/serializer/BpmnWorkflowSerializerTest.py @@ -148,7 +148,7 @@ def test_serialize_workflow_where_script_task_includes_function(self): ready_tasks[0].run() self.workflow.do_engine_steps() self.serializer.serialize_json(self.workflow) - assert self.workflow.is_completed() + assert self.workflow.completed assert 'y' in self.workflow.last_task.data assert 'x' not in self.workflow.last_task.data assert 'some_fun' not in self.workflow.last_task.data diff --git a/tests/SpiffWorkflow/bpmn/serializer/VersionMigrationTest.py b/tests/SpiffWorkflow/bpmn/serializer/VersionMigrationTest.py index f0f5d33c..e29d37ee 100644 --- a/tests/SpiffWorkflow/bpmn/serializer/VersionMigrationTest.py +++ b/tests/SpiffWorkflow/bpmn/serializer/VersionMigrationTest.py @@ -23,7 +23,7 @@ def test_convert_subprocess(self): wf.do_engine_steps() wf.refresh_waiting_tasks() wf.do_engine_steps() - self.assertEqual(True, wf.is_completed()) + self.assertEqual(True, wf.completed) class Version_1_1_Test(BaseTestCase): @@ -35,14 +35,14 @@ def test_timers(self): wf.do_engine_steps() wf.refresh_waiting_tasks() wf.do_engine_steps() - self.assertTrue(wf.is_completed()) + self.assertTrue(wf.completed) def test_convert_data_specs(self): wf = self.deserialize_workflow('v1.1-data.json') wf.do_engine_steps() wf.refresh_waiting_tasks() wf.do_engine_steps() - self.assertTrue(wf.is_completed()) + self.assertTrue(wf.completed) def test_convert_exclusive_gateway(self): wf = self.deserialize_workflow('v1.1-gateways.json') @@ -65,10 +65,10 @@ def test_remove_loop_reset(self): wf = self.deserialize_workflow('v1.1-loop-reset.json') # Allow 3 seconds max to allow this test to complete (there are 20 loops with a 0.1s timer) end = time.time() + 3 - while not wf.is_completed() and time.time() < end: + while not wf.completed and time.time() < end: wf.do_engine_steps() wf.refresh_waiting_tasks() - self.assertTrue(wf.is_completed()) + self.assertTrue(wf.completed) self.assertEqual(wf.last_task.data['counter'], 20) def test_update_task_states(self): @@ -81,7 +81,7 @@ def test_update_task_states(self): while len(ready_tasks) > 0: ready_tasks[0].run() ready_tasks = wf.get_tasks(state=TaskState.READY) - self.assertTrue(wf.is_completed()) + self.assertTrue(wf.completed) class Version_1_2_Test(BaseTestCase): @@ -121,7 +121,7 @@ def test_remove_noninterrupting_boundary_events(self): wf.get_next_task(spec_name='sid-6FBBB56D-00CD-4C2B-9345-486986BB4992').run() wf.do_engine_steps() - self.assertTrue(wf.is_completed()) + self.assertTrue(wf.completed) def test_update_data_objects(self): @@ -204,4 +204,4 @@ def test_update_mi_states(self): self.assertEqual(len(task_info['completed']), 3) self.assertEqual(len(task_info['running']), 0) self.assertEqual(len(task_info['future']), 0) - self.assertTrue(wf.is_completed()) + self.assertTrue(wf.completed) diff --git a/tests/SpiffWorkflow/camunda/CallActivityMessageTest.py b/tests/SpiffWorkflow/camunda/CallActivityMessageTest.py index 6c95e3cf..1fbcf6d4 100644 --- a/tests/SpiffWorkflow/camunda/CallActivityMessageTest.py +++ b/tests/SpiffWorkflow/camunda/CallActivityMessageTest.py @@ -44,7 +44,7 @@ def actual_test(self, save_restore=False): self.save_restore() ready_tasks = self.workflow.get_tasks(state=TaskState.READY) - self.assertEqual(self.workflow.is_completed(), True, 'Expected the workflow to be complete at this point') + self.assertEqual(self.workflow.completed, True, 'Expected the workflow to be complete at this point') self.assertEqual( self.workflow.last_task.data, {'plan_details': 'Best', 'Approved': 'Yes', 'Done': 'OK!'} diff --git a/tests/SpiffWorkflow/camunda/MessageBoundaryEventTest.py b/tests/SpiffWorkflow/camunda/MessageBoundaryEventTest.py index 64bb2478..8d0627a4 100644 --- a/tests/SpiffWorkflow/camunda/MessageBoundaryEventTest.py +++ b/tests/SpiffWorkflow/camunda/MessageBoundaryEventTest.py @@ -47,5 +47,5 @@ def actual_test(self,save_restore = False): time.sleep(.01) self.workflow.refresh_waiting_tasks() self.workflow.do_engine_steps() - self.assertEqual(self.workflow.is_completed(), True, 'Expected the workflow to be complete at this point') + self.assertEqual(self.workflow.completed, True, 'Expected the workflow to be complete at this point') diff --git a/tests/SpiffWorkflow/camunda/NIMessageBoundaryTest.py b/tests/SpiffWorkflow/camunda/NIMessageBoundaryTest.py index 4b0e5639..00e15b3f 100644 --- a/tests/SpiffWorkflow/camunda/NIMessageBoundaryTest.py +++ b/tests/SpiffWorkflow/camunda/NIMessageBoundaryTest.py @@ -81,7 +81,7 @@ def actual_test(self,save_restore = False): task.data['work_completed'] = 'Lots of Stuff' self.workflow.run_task_from_id(task.id) self.workflow.do_engine_steps() - self.assertEqual(self.workflow.is_completed(),True) + self.assertEqual(self.workflow.completed,True) self.assertEqual(self.workflow.last_task.data,{'Event_InterruptBoundary_Response': 'Youre late!', 'flag_task': 'Yes', 'work_done': 'Yes', diff --git a/tests/SpiffWorkflow/camunda/ParseMultiInstanceTest.py b/tests/SpiffWorkflow/camunda/ParseMultiInstanceTest.py index 0ffd5fb0..62fd3254 100644 --- a/tests/SpiffWorkflow/camunda/ParseMultiInstanceTest.py +++ b/tests/SpiffWorkflow/camunda/ParseMultiInstanceTest.py @@ -35,7 +35,7 @@ def testCollectionInCardinality(self): task.run() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) self.assertDictEqual(self.workflow.data, {'input_data': [1, 2, 3], 'output_data': [2, 4, 6]}) def testIntegerCardinality(self): @@ -61,7 +61,7 @@ def testIntegerCardinality(self): task.run() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) self.assertDictEqual(self.workflow.data, {'input_data': [1, 2, 3], 'output_data': [0, 2, 4]}) def testCollection(self): @@ -87,5 +87,5 @@ def testCollection(self): task.run() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) self.assertDictEqual(self.workflow.data, {'input_data': [2, 4, 6]}) diff --git a/tests/SpiffWorkflow/camunda/ResetTokenNestedParallelTest.py b/tests/SpiffWorkflow/camunda/ResetTokenNestedParallelTest.py index 7076ff99..4212c6a4 100644 --- a/tests/SpiffWorkflow/camunda/ResetTokenNestedParallelTest.py +++ b/tests/SpiffWorkflow/camunda/ResetTokenNestedParallelTest.py @@ -95,7 +95,7 @@ def actual_test(self, save_restore=False,reset_data=False): if save_restore: self.save_restore() self.get_ready_user_tasks() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) self.assertEqual({'First': 'Yes', 'A1': 'xa1', 'A2': 'xa2', @@ -188,7 +188,7 @@ def actual_test2(self, save_restore=False,reset_data=False): if save_restore: self.save_restore() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) self.assertEqual({'First': 'Yes', 'A1': 'xa1', diff --git a/tests/SpiffWorkflow/camunda/ResetTokenParallelMatrixTest.py b/tests/SpiffWorkflow/camunda/ResetTokenParallelMatrixTest.py index f4b17edf..e936c005 100644 --- a/tests/SpiffWorkflow/camunda/ResetTokenParallelMatrixTest.py +++ b/tests/SpiffWorkflow/camunda/ResetTokenParallelMatrixTest.py @@ -100,7 +100,7 @@ def actual_test(self, save_restore=False,reset_data=False): if save_restore: self.save_restore() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) self.assertEqual({'First': 'Yes', 'A1': 'xa1', @@ -196,7 +196,7 @@ def actual_test2(self, save_restore=False,reset_data=False): if save_restore: self.save_restore() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) self.assertEqual({'First': 'Yes', 'A1': 'xa1', diff --git a/tests/SpiffWorkflow/camunda/ResetTokenSubWorkflowTest.py b/tests/SpiffWorkflow/camunda/ResetTokenSubWorkflowTest.py index a79212a5..82184b08 100644 --- a/tests/SpiffWorkflow/camunda/ResetTokenSubWorkflowTest.py +++ b/tests/SpiffWorkflow/camunda/ResetTokenSubWorkflowTest.py @@ -78,7 +78,7 @@ def actual_test(self, save_restore=False): if save_restore: self.save_restore() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) self.assertEqual({'First': 'Yes', 'A1': 'a1', @@ -168,7 +168,7 @@ def actual_test2(self, save_restore=False,reset_data=False): if save_restore: self.save_restore() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) self.assertEqual({'First': 'Yes', 'A1': 'xa1', diff --git a/tests/SpiffWorkflow/camunda/StartMessageEventTest.py b/tests/SpiffWorkflow/camunda/StartMessageEventTest.py index 6261016c..a6849465 100644 --- a/tests/SpiffWorkflow/camunda/StartMessageEventTest.py +++ b/tests/SpiffWorkflow/camunda/StartMessageEventTest.py @@ -51,7 +51,7 @@ def actual_test(self,save_restore = False): self.save_restore() ready_tasks = self.workflow.get_tasks(state=TaskState.READY) - self.assertEqual(self.workflow.is_completed(),True,'Expected the workflow to be complete at this point') + self.assertEqual(self.workflow.completed,True,'Expected the workflow to be complete at this point') self.assertEqual(self.workflow.last_task.data, { 'plan_details': 'Best', diff --git a/tests/SpiffWorkflow/camunda/SubWorkflowTest.py b/tests/SpiffWorkflow/camunda/SubWorkflowTest.py index c44689ac..5309055f 100644 --- a/tests/SpiffWorkflow/camunda/SubWorkflowTest.py +++ b/tests/SpiffWorkflow/camunda/SubWorkflowTest.py @@ -38,4 +38,4 @@ def actual_test(self, save_restore=False): 'FieldA1': 'A1', 'FieldA2': 'A2', 'FieldB': 'B'}) - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) diff --git a/tests/SpiffWorkflow/spiff/BusinessRuleTaskTest.py b/tests/SpiffWorkflow/spiff/BusinessRuleTaskTest.py index d160b831..5c8e6670 100644 --- a/tests/SpiffWorkflow/spiff/BusinessRuleTaskTest.py +++ b/tests/SpiffWorkflow/spiff/BusinessRuleTaskTest.py @@ -10,4 +10,4 @@ def testBusinessRule(self): self.workflow = BpmnWorkflow(spec, subprocesses) self.save_restore() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) diff --git a/tests/SpiffWorkflow/spiff/CorrelationTest.py b/tests/SpiffWorkflow/spiff/CorrelationTest.py index 906613b7..7b431e56 100644 --- a/tests/SpiffWorkflow/spiff/CorrelationTest.py +++ b/tests/SpiffWorkflow/spiff/CorrelationTest.py @@ -86,4 +86,4 @@ def actual_test(self, save_restore=False): event = BpmnEvent(event_def, payload, correlations) self.workflow.catch(event) self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed) + self.assertTrue(self.workflow.completed) diff --git a/tests/SpiffWorkflow/spiff/EventPayloadTest.py b/tests/SpiffWorkflow/spiff/EventPayloadTest.py index 9fe054d0..48f0fef0 100644 --- a/tests/SpiffWorkflow/spiff/EventPayloadTest.py +++ b/tests/SpiffWorkflow/spiff/EventPayloadTest.py @@ -14,7 +14,7 @@ def testSignalEvent(self): set_data.data = {'v1': 1, 'v2': 2, 'v3': 3} set_data.run() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) self.assertDictEqual(self.workflow.data, { 'v1': 1, 'v2': 2, @@ -32,7 +32,7 @@ def testErrorEvent(self): set_data.data = {'error': True, 'payload': 'ERROR!'} set_data.run() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) self.assertEqual(self.workflow.data, {'result': 'ERROR!'}) def testEscalationEvent(self): @@ -45,5 +45,5 @@ def testEscalationEvent(self): set_data.data = {'escalation': True, 'payload': 'ERROR!'} set_data.run() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) self.assertEqual(self.workflow.data, {'result': 'ERROR!'}) \ No newline at end of file diff --git a/tests/SpiffWorkflow/spiff/MultiInstanceTaskTest.py b/tests/SpiffWorkflow/spiff/MultiInstanceTaskTest.py index 943b2c83..5208c70b 100644 --- a/tests/SpiffWorkflow/spiff/MultiInstanceTaskTest.py +++ b/tests/SpiffWorkflow/spiff/MultiInstanceTaskTest.py @@ -22,7 +22,7 @@ def testMultiInstanceTask(self): task.run() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) self.assertDictEqual(self.workflow.data, { 'input_data': [2, 3, 4], # Prescript adds 1 to input 'output_data': [3, 5, 7], # Postscript subtracts 1 from output @@ -45,7 +45,7 @@ def testMultiInstanceTaskWithInstanceScripts(self): task.run() self.workflow.do_engine_steps() - self.assertTrue(self.workflow.is_completed()) + self.assertTrue(self.workflow.completed) self.assertDictEqual(self.workflow.data, { 'input_data': [1, 2, 3], # Prescript modifies input item 'output_data': [3, 5, 7],