Hey, I would like to use a string-block value duri...
# prefect-community
t
Hey, I would like to use a string-block value during the flow configuration. How would I do that?
What I have tried so far:
Copy code
@flow(
    name="Create Experiment",
    task_runner=DaskTaskRunner(
        cluster_class="dask_jobqueue.SLURMCluster",
        cluster_kwargs={
            ...
            "job_script_prologue": [
                String.load("log-slurm-job").value,
            ],
        },
    ),
)
def my_flow():
But this will not build a deployment because the load was not
awaited
. What would be the correct way to use blocks for flow-configurations?
k
This works for me:
Copy code
from prefect import flow 
from prefect.blocks.system import String 

@flow(name=String.load("test").value)
def my_flow():
    ...

if __name__=="__main__":
    my_flow()
I wonder if it has something to do with using DaskTaskRunner
t
Does it also work once it is deployed?
k
Hmm I see. It doesn’t work when it is deployed
t
But interesting that deployment works for you. Even if I use the block for the flow name
Copy code
@flow(
    name=String.load("test").value
I get
RuntimeWarning: coroutine 'Block.load' was never awaited
when I run
prefect deployment build ...
.
I can wrap
String.load("test").value
into a `async`function and await the result inside it. Then the deployment works, but when I run the deployment it hangs forever (waited for 10min and then killed it).
k
This is a bug and we will solve it with this PR
🙏 1