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

Hera runner debug log mode #972

Open
elliotgunton opened this issue Feb 20, 2024 · 1 comment
Open

Hera runner debug log mode #972

elliotgunton opened this issue Feb 20, 2024 · 1 comment
Labels
type:enhancement A general enhancement

Comments

@elliotgunton
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
Hard to debug errors that occur in the runner itself

Describe the solution you'd like

  • Setting an env variable e.g. hera__debug_mode to allow logging debug info during the Hera Runner setup.
  • Users can then send us logs if the bug is with the runner

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
N/A

Additional context
Add any other context or screenshots about the feature request here.

Error log that motivated this issue (when trying out Pydantic IO):

Traceback (most recent call last):
  File "/opt/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/opt/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/layers/...pip/requirements/lib/python3.9/site-packages/hera/workflows/runner.py", line 493, in <module>
    _run()
  File "/layers/...pip/requirements/lib/python3.9/site-packages/hera/workflows/runner.py", line 481, in _run
    result = _runner(args.entrypoint, kwargs_list)
  File "/layers/...pip/requirements/lib/python3.9/site-packages/hera/workflows/runner.py", line 423, in _runner
    kwargs = _map_argo_inputs_to_function(function, kwargs)
  File "/layers/...pip/requirements/lib/python3.9/site-packages/hera/workflows/runner.py", line 259, in _map_argo_inputs_to_function
    map_runner_input(param_name, func_param.annotation)
  File "/layers/...pip/requirements/lib/python3.9/site-packages/hera/workflows/runner.py", line 240, in map_runner_input
    matched_field = map_field(field)
  File "/layers/...pip/requirements/lib/python3.9/site-packages/hera/workflows/runner.py", line 235, in map_field
    mapped_kwargs[field] = json.loads(kwargs[field])
  File "/opt/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/opt/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/opt/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
time="2024-02-20T14:54:47 UTC" level=info msg="sub-process exited" argo=true error="<nil>"
Error: exit status 1

Meaning the string value being decoding was None, but the Python code used was:

# ...imports...

class MyInput(RunnerInput):
    """A pydantic model."""

    my_param: str = ""


@script(constructor="runner")
def echo_my_param(my_input: MyInput) -> None:
    """Prints out a message."""
    print(my_input.my_param)


def get_workflow_template() -> WorkflowTemplate:
    """Create and return the test-runner-input WorkflowTemplate."""
    global_config.experimental_features["script_pydantic_io"] = True
    make_scripts_runnable()
    with WorkflowTemplate(
        name="test-runner-input",
        entrypoint="steps",
    ) as wt:
        with Steps(name="steps"):
            echo_my_param(arguments={"my_param": "Hello world"})
        return wt
@elliotgunton
Copy link
Collaborator Author

Another example in duplicate issue #1164

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant