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

deepaas-cli returns exit code 1 even if the prediction is successful #160

Open
IgnacioHeredia opened this issue May 17, 2024 · 2 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@IgnacioHeredia
Copy link
Collaborator

IgnacioHeredia commented May 17, 2024

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:

def main():
    """Executes model's methods with corresponding parameters"""
    return None

--> exit code 0 (success)

def main():
    """Executes model's methods with corresponding parameters"""
    return 'success'

--> exit code 1 (error)

If we finally don't need them, consider removing returns from cli.py

@alvarolopez alvarolopez added the bug Something isn't working label Jun 7, 2024
@vykozlov vykozlov self-assigned this Jun 24, 2024
@vykozlov
Copy link
Contributor

vykozlov commented Jun 24, 2024

@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?

@IgnacioHeredia
Copy link
Collaborator Author

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/clideepaas-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/cliecho $?                             
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).

@vykozlov vykozlov mentioned this issue Aug 26, 2024
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants