Skip to content

Help needed with default resources for graphs #17863

Answered by jamiedemaria
dagsir[bot] bot asked this question in Q&A
Discussion options

You must be logged in to vote

You can set default resources on your Definitions object, and then define custom resources on the individual jobs that need them. for example

class Resource1(ConfigurableResource):
    foo: str

@op
def op1(context, my_resource: Resource1):
    context.log.info(my_resource.foo)

@op
def op2(context, my_resource: Resource1):
    context.log.info(my_resource.foo)

@graph
def my_graph():
    op1()
    op2()

job_with_default_resources = my_graph.to_job(name="job_with_default_resources")

job_with_custom_resources = my_graph.to_job(name="job_with_custom_resource", resource_defs={"my_resource": Resource1(foo="hello world")})

defs = Definitions(
    jobs=[job_with_custom_resources, job_with_de…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jamiedemaria
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant