Skip to content

Warnings during task execution are assumed to be errors #61

@araghukas

Description

@araghukas

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions