diff --git a/arcaflow_plugin_wait/arcaflow_plugin_wait.py b/arcaflow_plugin_wait/arcaflow_plugin_wait.py index fae2d7a..555ca67 100644 --- a/arcaflow_plugin_wait/arcaflow_plugin_wait.py +++ b/arcaflow_plugin_wait/arcaflow_plugin_wait.py @@ -6,7 +6,7 @@ from dataclasses import dataclass, field from threading import Event -from arcaflow_plugin_sdk import plugin, validation, predefined_schemas +from arcaflow_plugin_sdk import plugin, validation @dataclass @@ -40,34 +40,15 @@ class ErrorOutput: class WaitStep: - exit = Event() - finished_early = False - @plugin.signal_handler( - id=predefined_schemas.cancel_signal_schema.id, - name=predefined_schemas.cancel_signal_schema.display.name, - description=predefined_schemas.cancel_signal_schema.display. - description, - icon=predefined_schemas.cancel_signal_schema.display.icon, - ) - def cancel_step(self, _input: predefined_schemas.cancelInput): - # First, let it know that this is the reason it's exiting. - self.finished_early = True - # Now signal to exit. - self.exit.set() - - @plugin.step_with_signals( + @plugin.step( id="wait", name="Wait", description="Waits for the given amount of time", outputs={ "success": SuccessOutput, "error": ErrorOutput, - "cancelled_early": ErrorOutput }, - signal_handler_method_names=["cancel_step"], - signal_emitters=[], - step_object_constructor=lambda: WaitStep(), ) def wait( self, @@ -81,20 +62,12 @@ def wait( """ start_time = time.time() self.exit.wait(params.seconds) - if self.finished_early: - actual_time = time.time() - start_time - return "cancelled_early", ErrorOutput( - "Aborted {:0.2f} seconds after being scheduled to wait for {}" - " seconds.".format(actual_time, params.seconds), - actual_time - ) - else: - actual_time = time.time() - start_time - return "success", SuccessOutput( - "Waited {:0.2f} seconds after being scheduled to wait for {}" - " seconds.".format(actual_time, params.seconds), - actual_time - ) + actual_time = time.time() - start_time + return "success", SuccessOutput( + "Waited {:0.2f} seconds after being scheduled to wait for {}" + " seconds.".format(actual_time, params.seconds), + actual_time + ) if __name__ == "__main__":