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

Warnings during task execution are assumed to be errors #61

Open
araghukas opened this issue Feb 16, 2023 · 0 comments · May be fixed by #62
Open

Warnings during task execution are assumed to be errors #61

araghukas opened this issue Feb 16, 2023 · 0 comments · May be fixed by #62

Comments

@araghukas
Copy link
Contributor

araghukas commented Feb 16, 2023

Environment

  • Covalent version: 0.216.0rc0
  • Covalent-SSH plugin version: 0.20.0
  • Python version: 3.8.15
  • Operating system: MacOS (Darwin Kernel Version 21.6.0)

What is happening?

The following code block, starting at line 501, checks for a non-empty stderr, else it assumes task failure:

        if result_err := result.stderr.strip():
            app_log.warning(result_err)
            return self._on_ssh_fail(function, args, kwargs, result_err)

However, it does not distinguish warnings from errors. Warning messages will therefore result in a "failed" task.

How can we reproduce the issue?

Issue a warning message inside any task that uses the SSHExecutor.

What should happen?

The task should be marked as failed only if the returncode is non-zero - as opposed to assuming this if stderr is not empty.

Any suggestions?

Log the message all the same, but check the returncode before deferring to _on_ssh_fail:

         if result_err := result.stderr.strip():
             app_log.warning(result_err)
             if result.returncode != 0:
                 return self._on_ssh_fail(function, args, kwargs, result_err)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant