Open IgnacioHeredia opened 1 month ago
@IgnacioHeredia Could you, please, elaborate more? What is the exact cli call and what line is suspicious? Because predict() supposes to return json response not "success". "return 0" is anyway the equivalent of "return success", any other number is error by definition, no?
Hi @vykozlov ,
I'm using the demo app, but I was replacing the whole main
function with a mock response, just to test the exit code. So the exact cli call does not matter, because nothing was really being processed.
But anyway, if you want to see a real-life example, you can use the demo-app (in the no_file_args
). The second command is printing the error code of the previous command.
~/ignacio/projects/deephdc/deepaas fix/cli
❯ deepaas-cli predict --demo_float 0.1
2024-06-24 13:59:45.364 64944 INFO deepaas.cmd.cli [-] [INFO, Method] predict was called.
{'demo_str': 'some-string', 'demo_str_choice': 'choice2', 'demo_int': 1, 'demo_int_range': 50, 'demo_float': 0.1, 'demo_bool': True, 'demo_dict': {'a': 0, 'b': 1}, 'demo_list_of_floats': [0.1, 0.2, 0.3], 'probabilities': [0.13458525774392718, 0.23134150410079915, 0.17750426608154016, 0.17757232194901024, 0.2789966501247234], 'labels': ['class2', 'class3', 'class0', 'class1', 'class4']}
~/ignacio/projects/deephdc/deepaas fix/cli
❯ echo $?
1
The processing of demo app is successful and the output is what was expected, but the status code of deepaas-cli
is 1
. As I said in the first comment, I thought this could be somehow related to this.
Anyway, not a super big issue (for the moment), but worth keeping track (and fix if possible).
This happens because, in the console script wrapper,
sys.exit
takes any non 0 returned value as exit code 1 (exception). (ref)In
cli.py
:--> exit code 0 (success)
--> exit code 1 (error)
If we finally don't need them, consider removing
return
s fromcli.py