Hi, is there any more document on parameters? othe...
# prefect-community
j
Hi, is there any more document on parameters? other than here: https://docs.prefect.io/core/concepts/parameters.html, I’m having a confusing time getting them to work especially when I need multiple
c
Hi @John Faucett - could you describe the pain points you’re having? Ultimately Parameters are just a special type of Task so they have the same imperative interface
j
hi @Chris White thanks for the response. Yes, I guess its just not clear to me how to add multiple parameter dependencies for a task, and pass results of task computations as parameters further downstream to other tasks
c
so for example,
Copy code
with Flow("parameter-example") as flow:
    p, q = Parameter("p"), Parameter("q")
    result = my_task(input_kwarg=p, another_kwarg=q)
j
ah ok, right now I had
my_task.set_upstream(my_param, flow=flow, key='my_param_name')
c
that works as well!
as long as
my_task
accepts a
my_param_name
keyword argument in its
run
signature
j
but what about when my task needs both p and q?
and r and z?
does the order not matter then, so I just set multiple upstreams on
my_task
and it will just work?
c
yea, ultimately you’re binding the results of the upstream tasks / parameters to the keyword arguments of the downstream task’s run method, so the order isn’t important
j
ok nice. Thanks for the help. I just have one other question? Is there a way to set which task should be run first?
c
anytime! yea sure, just set the appropriate dependencies. So for example, if you want A to run before B, all you need to do is:
Copy code
task_b.set_upstream(task_a, flow=flow)
in this case, no data is exchanged but there is now an enforced dependency relationship. You can also see these relationships with
flow.visualize()
for easier introspection
j
oh nice, and if I do
Copy code
task_b.set_upstream(task_a, flow=flow)
task_b.set_upstream(task_c, flow=flow)
will it wait for both upstreams to finish?
c
yup exactly!
j
sweet! I must say I’m really liking prefect a lot
🙂
c
awesome - thank you! if you have any other questions or need further clarification we’re always here to help!
j
well, I’m testing prefect out to see if we can use it to replace some luigi pipelines right now so I’m sure I’ll probably be taking you up on that one 🙂
c
oh awesome! If you collect any notes on the pros / cons of the replacement we’d love to hear them and I’m sure other people would as well
j
ok yea thats a good idea, right now I’m liking state a lot over saving output files, thats nice