-
Notifications
You must be signed in to change notification settings - Fork 0
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
187316441 modify engine params for run submission #6
Conversation
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) |
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.
Does this actually work for a File type? json.loads
implies loading the JSON from a string
value and not a fp
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.
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 |
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.
I wonder if we should have a separate argument type for this?
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.
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: |
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.
@Diana-DNAstack what would happen in the case where there is a file and a preset?
--engine-params '@file.json,preset-1'
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.
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
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.
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
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.
LGTM
…ds all in one list
99c2845
to
4dfcf6a
Compare
Added logic so that --engine-params can accept a comma-separated list of preset ids and key-value pairs.