Slackbot
03/11/2024, 3:28 PMZach
03/11/2024, 3:37 PM@op
concept is usually more simple to start out with than @asset
if you're not sure where to get started. So I'd start by just taking func1
and trying to execute it in a graph as an op:
@op
def func1():
...
@graph
def main():
func1()
main_job = main.to_job()
defs = Definitions(jobs=[main_job])
Then add your functions as ops one at a time. One thing to keep in mind is that the code defined within @graph
should only call ops and should not contain general python syntax like looping or conditional statements. This is because the @graph
is executed at the time your code is loaded by Dagster, in order to construct the dependency graph, not when you try to run your job.Zach
03/11/2024, 3:48 PMZach
03/11/2024, 3:50 PMZach
03/11/2024, 3:50 PMZach
03/11/2024, 3:52 PM@op
def main():
...
@graph
def run_main():
main()
run_main_job = run_main.to_job()
or even using an asset if the output of your main()
function represents a data asset that you want to track
@asset
def main():
...
Gaurav Bodhale
03/12/2024, 6:59 AM