Skip to content
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

187316441 modify engine params for run submission #6

Merged
merged 11 commits into from
Apr 29, 2024

Conversation

Diana-DNAstack
Copy link
Contributor

Added logic so that --engine-params can accept a comma-separated list of preset ids and key-value pairs.

except Exception as e:
raise ValueError(f"Failed to parse the value from the file: {self.raw_value}. {e}")
if self.argument_type == ArgumentType.FILE or self.argument_type == ArgumentType.JSON_LITERAL_PARAM_TYPE:
return json.loads(value)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this actually work for a File type? json.loads implies loading the JSON from a string value and not a fp

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it does since value is gotten from super().value() which checks if it is a file type and returns the file content. So value always stores the actual JSON content of the file.

return [value], []
if self.argument_type == ArgumentType.STRING_PARAM_LIST_TYPE:
return value.split(KV_PAIR_SEPARATOR), []
# deals with a mix of the kv pairs and strings, e.g. my-preset-id,key=value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should have a separate argument type for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I was thinking of changing KV_PARAM_TYPE to LIST_TYPE and KV_PAIR_SEPARATOR to LIST_ITEM_SEPARATOR to allow for the new generalization

@@ -62,6 +64,33 @@ def parsed_value(self) -> JSONType:
else:
return json.loads(value)

def return_parsed_literal_or_file(self) -> JSONType:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Diana-DNAstack what would happen in the case where there is a file and a preset?

--engine-params '@file.json,preset-1'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into this more and realized that engine parameters can only be a JSON object type not an array. So, if we would allow @file.json,preset-1, it would turn it into an array of JSON objects which wouldn't work. Also, the documentation says that it should be specified as a map of strings (https://docs.omics.ai/products/command-line-interface/reference/workbench/runs-submit#engine-params-json_data) So currently, it will return an error and ask that the JSON file is specified under a key

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I'm going to change it so that @file.json would be merged with preset-1 and in general so that different types would all be merged together into one object

Copy link
Contributor

@patmagee patmagee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Diana-DNAstack Diana-DNAstack force-pushed the 187316441-modify-engine-params-for-run-submission branch from 99c2845 to 4dfcf6a Compare April 29, 2024 16:07
@Diana-DNAstack Diana-DNAstack merged commit 8f82e38 into main Apr 29, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants