Peter Arwanitis
04/26/2023, 11:55 AMdagster dev
shows a graph (screenshot in next thread-post)
• reason for all those Nothing
in
and out
is, that the op should simply start and monitor a web-service, and start dependencies when one request finished successfully
my problem is how to make start_job2
a direct dependency for start_job3
and start_job5
.
atm it creates another instance start_job2_2
?job2
a
op "start_job2" has multiple outputs, but only one output was returned of type <class 'NoneType'>. When using multiple outputs, either yield each output, or return a tuple containing a value for each output.
job2
1. because I want to drive this from config in a next step
2. I have to use a op-factory
3. where I don't know how to generically provide multiple result-values (tuple)
4. plan is to return nothing at all (which means it is exactly one None
value)GraphDefinition
reusing the op
definitions made in last step, but replacing the
@job
def run():
and it still renders the DAG and runs it through launchpad 🙂
next stop => op-factory@op(out={"job0_0": Out(Nothing)})
def start_job0(context, **kwargs):
...
statements through a factory
still works 🙂
--
so next step => run the op-factory configuration driven from yaml
(stretch goal => how to create sub-graphs this way?)sandy
04/26/2023, 4:45 PMPeter Arwanitis
04/27/2023, 8:08 AMNothing
in and outs?
2. how does this example look like with @op(ins: ..., out:...)
annotations?
3. how do you translate this into a a dependencies
statement, which fits into GraphDefinition
?
trying to do the first step I fail already, switching outputs to None
and trying to catch variable inputs
@op
def return_one(context, **kwargs):
<http://context.log.info|context.log.info>("return_one")
# return 1
@op
def add_one(context, **kwargs):
<http://context.log.info|context.log.info>("add_one")
# return number + 1
@op
def adder(context, **kwargs):
<http://context.log.info|context.log.info>("adder")
# return a + b
results in
removing thedagster._core.errors.DagsterInvalidDefinitionError: In @graph inputs_and_outputs, received too many inputs for invocation add_one. Only 0 defined, received 1
**kwargs
, doesn't change itnode_defs
and dependencies
from configuration :)
return GraphDefinition(
name="run",
node_defs=node_defs,
dependencies = edges
).to_job()
code requires a bit of clean up but happy to share if there is interestOne issue I run into was that the job-rendering fails to layout my graph (which fooled me for a while, as I thought I have a broken implementation) 1. the launchpad > run proofed that all my nodes/edges are as configured (screenshot one) job5 for example has three dependencies
- name: job5
edges: [job0, job1, job2]
2. but Deployment > Overview was rendered broken (screenshot 2)
3. removing one node and two edges resulted in a proper layout (screenshot 3)
Is this a known limitation or a bug?
I don't expect my graph with "7 nodes" and "7 edges" being too complicated?dagster dev
restart or reload it works now?
sigh 🙂nodes:
- name: job7
edges: []
- name: job0
edges: [job7]
retries: 3
- name: job1
edges: [job7]
retries: 3
- name: job2
retries: 2
edges: [job7]
- name: job3
edges: [job1, job2]
retries: 1
- name: job4
edges: [job3]
- name: job5
edges: [job0, job1, job2]
- name: job6
edges: [job1]
- name: job8
edges: [job5, job6]
config for the last onesandy
04/27/2023, 9:54 PMhttps://docs.dagster.io/concepts/ops-jobs-graphs/graphs#defining-nothing-dependencies explains how to setdagster._core.errors.DagsterInvalidDefinitionError: In @graph inputs_and_outputs, received too many inputs for invocation add_one. Only 0 defined, received 1
ins
to avoid this errorPeter Arwanitis
04/27/2023, 11:31 PM