Skip to content

Commit

Permalink
repair test
Browse files Browse the repository at this point in the history
  • Loading branch information
calgray committed May 24, 2022
1 parent 3df7048 commit ee74b97
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions daliuge-engine/dlg/drop.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,6 @@ def __init__(self, oid, uid, **kwargs):

super(AbstractDROP, self).__init__()

# Useful to have access to all EAGLE parameters without a priori knowledge
self._parameters = dict(kwargs)
self._extract_attributes(**kwargs)

# Copy it since we're going to modify it
Expand Down Expand Up @@ -375,6 +373,8 @@ def __init__(self, oid, uid, **kwargs):
# All DROPs are precious unless stated otherwise; used for replication
self._precious = self._getArg(kwargs, "precious", True)

# Useful to have access to all EAGLE parameters without a prior knowledge
self._parameters = dict(kwargs)
self.autofill_environment_variables()
kwargs.update(self._parameters)
# Sub-class initialization; mark ourselves as INITIALIZED after that
Expand All @@ -396,16 +396,15 @@ def getmembers(object, predicate=None):

def get_param_value(attr_name, default_value):
has_component_param = attr_name in kwargs
has_app_param = hasattr(self, 'parameters') \
and 'applicationArgs' in self.parameters \
and attr_name in self.parameters['applicationArgs']
has_app_param = 'applicationArgs' in kwargs \
and attr_name in kwargs['applicationArgs']

if has_component_param and has_app_param:
logger.warning(f"Drop has both component and app param {attr_name}. Using component param.")
if has_component_param:
param = kwargs.get(attr_name)
elif has_app_param:
param = self.parameters['applicationArgs'].get(attr_name).value
param = kwargs['applicationArgs'].get(attr_name).value
else:
param = default_value
return param
Expand Down Expand Up @@ -463,6 +462,9 @@ def get_param_value(attr_name, default_value):
setattr(self, attr_name, value)

def _getArg(self, kwargs, key, default):
"""
Pops the specified key arg from kwargs else returns the default
"""
val = default
if key in kwargs:
val = kwargs.pop(key)
Expand Down
2 changes: 1 addition & 1 deletion daliuge-engine/test/test_environmentvars.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def test_get_empty(self):
Tests that an empty environment drop contains no environment variables.
"""
env_drop = create_empty_env_vars()
self.assertEqual({'nm': 'env_vars'}, env_drop._variables)
self.assertEqual(dict(), env_drop._variables)

def test_get_multiple(self):
"""
Expand Down

0 comments on commit ee74b97

Please sign in to comment.