Skip to content

Commit

Permalink
better error handling in arg and env mappers
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandf committed Dec 6, 2023
1 parent 844d853 commit d2a611f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/engine/src/core/mappers/ArgMapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ def __init__(self, dao: WorkflowExecutorStateDAO):
self._dao = dao

def get_value_by_key(self, key):
value = self._dao.get_state().ctx.args.get(key).value
return value
arg = self._dao.get_state().ctx.args.get(key, None)
if arg == None: return None
return arg.value
5 changes: 3 additions & 2 deletions src/engine/src/core/mappers/EnvMapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ def __init__(self, dao: WorkflowExecutorStateDAO):
self._dao = dao

def get_value_by_key(self, key):
value = self._dao.get_state().ctx.env.get(key).value
return value
env = self._dao.get_state().ctx.env.get(key).value
if env == None: return None
return env.value
8 changes: 4 additions & 4 deletions src/engine/src/core/workflows/ValueFromService.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ def get_task_output_value_by_id(self, task_id, _id):
return output

def get_env_value_by_key(self, key):
output = self._env_repo.get_value_by_key(key)
return output
value = self._env_repo.get_value_by_key(key)
return value

def get_arg_value_by_key(self, key):
output = self._arg_repo.get_value_by_key(key)
return output
value = self._arg_repo.get_value_by_key(key)
return value

0 comments on commit d2a611f

Please sign in to comment.