Name changes
This commit is contained in:
parent
b874e9ef5a
commit
ad780aba55
|
@ -16,17 +16,19 @@ class Action:
|
|||
self.parameters = self.Parameters(**(parameters or {}))
|
||||
self.parsed_parameters = {}
|
||||
|
||||
def parse_parameters_with_arguments(self, **arguments):
|
||||
def parse_parameters(self, current_execution=None, **arguments):
|
||||
"""
|
||||
Returns a dict with the parameters parsed in base of the provided arguments.
|
||||
Returns a dict with the parameters parsed in base of the provided arguments and context.
|
||||
Parsing using jinja2 template themes only on the fields defined on the `Parameters.PARSE_WITH_ARGUMENTS`.
|
||||
"""
|
||||
for parameter_name in self.parameters.PARSE_WITH_ARGUMENTS:
|
||||
self.parsed_parameters[parameter_name] = Template(self.parameters.dict()[parameter_name]).render(**arguments)
|
||||
self.parsed_parameters[parameter_name] = Template(
|
||||
self.parameters.dict()[parameter_name]
|
||||
).render(current_execution=current_execution, **arguments)
|
||||
|
||||
@abstractmethod
|
||||
def execute(self, workspace, **kwargs):
|
||||
"""
|
||||
Main method to override that handles the work for the defining action.
|
||||
"""
|
||||
pass
|
||||
pass
|
|
@ -10,7 +10,7 @@ class Executor:
|
|||
defined_arguments = defined_arguments or {}
|
||||
self.step_count = len(flow.tasks)
|
||||
self._flow: Flow = flow
|
||||
self._execution = Execution(flow=flow, steps=self._get_steps(flow))
|
||||
self._execution = Execution(flow=flow, steps=self._generate_execution_steps(flow))
|
||||
self._arguments = {}
|
||||
if self._flow.arguments:
|
||||
for argument in self._flow.arguments:
|
||||
|
@ -23,14 +23,14 @@ class Executor:
|
|||
for step in self._execution.steps:
|
||||
yield step
|
||||
|
||||
def _get_steps(self, flow: Flow):
|
||||
def _generate_execution_steps(self, flow: Flow):
|
||||
for task in flow.tasks:
|
||||
yield ExecutionStep(task=task, result=Result())
|
||||
|
||||
def execute_step(self, step: ExecutionStep):
|
||||
try:
|
||||
action = ActionRegistry.get_action_cls(step.task.type)(parameters=step.task.parameters)
|
||||
action.parse_parameters_with_arguments(**self._arguments)
|
||||
action.parse_parameters(current_execution=self._execution, **self._arguments)
|
||||
step.result = action.execute(workspace=self._execution.workspace, arguments=self._arguments)
|
||||
except Exception as error:
|
||||
# Catch unhandled exceptions, mark the result as unsuccessful
|
||||
|
|
Reference in New Issue