Skip to content

Apply output_schema only to the last replaced job #782

@jenniferpeschel

Description

@jenniferpeschel

I just came across line 1264 in core/job.py where it states that:

# only apply output schema if there is no replace.

I was wondering why this design was chosen. Given a simple example:

from pydantic import BaseModel
from jobflow import job, run_locally, Response

class MySchema(BaseModel):
    a: int

@job(output_schema=MySchema)
def job1():
    return Response(3, replace=job2())

@job
def job2():
    return {"a": 3}

run_locally(job1())

I would feel that this should fail because the first job gives an invalid output back but it actually runs without problems. No Exception is raised.

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