You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When importing a pipeline with {import,update}_pipe_project.py, some script constants that are valid python literals cannot be parsed. Although the overall script parsing succeeds, this leads to errors downstream:
When ENVS are invalid JSON, the script hangs on execution
When the ARGUMENTS are invalid JSON, the script can be run, but the arguments cannot be changed from the frontend
To Reproduce: script hangs on execution
In any script, make the constant a valid python literal, but an invalid JSON. For example:
ENVS= ["custom-worker"] # comment about custom worker
This results in a json.decoder.JSONDecodeError
Script hangs indefinitely
To Reproduce: Arguments cannot be changed from the frontend
In any script, make ARGUMENTS a valid python literal, but an invalid JSON. For example:
ARGUMENTS= {
# comments are not allowed in JSON"file_name": {
"value": "annos.csv",
"help": "Name of the file with exported bbox annotations."
}, # <- also, notice the trailing comma
}
This results in a json.decoder.JSONDecodeError
Front-end no longer displays "file_name" as an argument
Expected behavior
Front-end should display arguments
ARGUMENTS and ENVS hould be parsed like python literals, raise a more descriptive error or fail outright.
Additional context
It seems to me that this line could simply be changed to arg_dict = ast.literal_eval(args) to fix both issues. I've tested this minimally and it seems to work.
I would be happy to write some unit tests and make a PR, if there is interest.
The text was updated successfully, but these errors were encountered:
jeremyadamsfisher
changed the title
Script parsing fails when constants
Script parsing fails when constants are not strictly valid JSON
Aug 6, 2020
jeremyadamsfisher
changed the title
Script parsing fails when constants are not strictly valid JSON
Script parsing fails when dictionary literals are not valid JSON
Aug 7, 2020
jeremyadamsfisher
changed the title
Script parsing fails when dictionary literals are not valid JSON
Script parsing fails when list/dictionary literals are not valid JSON
Aug 7, 2020
Hi @jeremyadamsfisher,
thank you for your contribution. Your proposed solution will be released with version 1.3.0.
It would be great if you write some unit test.
Best,
Jonas
Describe the bug
When importing a pipeline with
{import,update}_pipe_project.py
, some script constants that are valid python literals cannot be parsed. Although the overall script parsing succeeds, this leads to errors downstream:ENVS
are invalid JSON, the script hangs on executionARGUMENTS
are invalid JSON, the script can be run, but the arguments cannot be changed from the frontendTo Reproduce: script hangs on execution
json.decoder.JSONDecodeError
To Reproduce: Arguments cannot be changed from the frontend
ARGUMENTS
a valid python literal, but an invalid JSON. For example:json.decoder.JSONDecodeError
Expected behavior
ARGUMENTS
andENVS
hould be parsed like python literals, raise a more descriptive error or fail outright.Additional context
It seems to me that this line could simply be changed to
arg_dict = ast.literal_eval(args)
to fix both issues. I've tested this minimally and it seems to work.I would be happy to write some unit tests and make a PR, if there is interest.
The text was updated successfully, but these errors were encountered: