-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LIU-251 Automatically Parse App Args to Params #159
Conversation
# Conflicts: # daliuge-engine/dlg/drop.py
daliuge-engine/dlg/drop.py
Outdated
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'] | ||
|
||
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 | ||
else: | ||
param = default_value | ||
return param |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block controls the priority between component params and app params.
There is some complication where I can't find a reason to load applicationArgs['name'].default_value
since I'd expect eagle to populate an appropriate applicationArgs['name'].value
, if the key is missing the app default is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, a great improvement.
just noticed the cause of test change after realizing |
This change combines drop app params with dlg_x_param() definitions. Params can now be either defined as component params or app params and AbstractDrop will give priority loading to component params then app params. This was done for backwards compatibility as well as supporting tests that don't write to 'applicationArgs'.