Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bug/pydantic-error-job-in-progress #286

@nilligan

Description

@nilligan

Describe the bug
The run_workflow method fails with a Pydantic error if trying to run a workflow that already has a job in progress. It would be easier for clients if there was a specific error type for this, or at least we could get the REST API response back with the full error from the API, rather than the Pydantic error

To Reproduce

# assumes workflow already created
# start a job on that workflow either by clicking in the UI or running this twice
response: RunWorkflowResponse = client.workflows.run_workflow(
    request=RunWorkflowRequest(
        workflow_id="foobar"
    )
)

Throws an error:

pydantic_core._pydantic_core.ValidationError: 5 validation errors for Unmarshaller
body.created_at
  Field required [type=missing, input_value={'detail': 'There is a ru...gress. No new job run.'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.11/v/missing
body.id
  Field required [type=missing, input_value={'detail': 'There is a ru...gress. No new job run.'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.11/v/missing
body.status
  Field required [type=missing, input_value={'detail': 'There is a ru...gress. No new job run.'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.11/v/missing
body.workflow_id
  Field required [type=missing, input_value={'detail': 'There is a ru...gress. No new job run.'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.11/v/missing
body.workflow_name
  Field required [type=missing, input_value={'detail': 'There is a ru...gress. No new job run.'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.11/v/missing

Expected behavior
I'd expect a specific error "already a run in progress" type from the SDK, or at least the unchanged output from the REST API response. Right now to have our code check for this condition we have to check for a Pydantic ValidationError with a string match on "There is a ru...gress"

Screenshots
Image

Environment Info

Please run python scripts/collect_env.py and paste the output here.

I can't find this script, but I'm happy to run any commands in my environment that you want

Additional context
None

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions