Prefect 2.0 Hi, my code runs fine when I run it wi...
# prefect-community
f
Prefect 2.0 Hi, my code runs fine when I run it with python abc.py but it doesn't do anything when I run it from UI i.e prefect deployment create abc.py. it spins up a new container when I run it from UI but then shutdowns I don't see any logs for debugging, the flow status shows completed. I am using dockerflow runner with DaskTaskRunner.
1
a
Can you share: 1. The output of
prefect version
2. Some code to reproduce the issue 3. The exception traceback?
I was trying to reproduce with 2.0b7 but it worked just fine
Copy code
from prefect import flow, task
from prefect import get_run_logger
from prefect.task_runners import DaskTaskRunner
from prefect.flow_runners import DockerFlowRunner
from prefect.deployments import DeploymentSpec
import time


@task
def compute_something(x):
    logger = get_run_logger()
    <http://logger.info|logger.info>("Computing: %d x 2 = %d", x, x * 2)
    time.sleep(2)


@flow(task_runner=DaskTaskRunner())
def dask_flow():
    for i in range(50):
        compute_something(i)


DeploymentSpec(name="staging", flow=dask_flow, flow_runner=DockerFlowRunner())
f
@Anna Geller 2.0b6 I figured it out. I was calling the for loop outside the @flow(task_runner=DaskTaskRunner()).
Copy code
@task
def compute_something(x):
    logger = get_run_logger()
    <http://logger.info|logger.info>("Computing: %d x 2 = %d", x, x * 2)
    time.sleep(2)


@flow(task_runner=DaskTaskRunner())
def dask_flow():
	list(map(compute_something, range(50))) #worked


if __name__ == '__main__':
	#list(map(dask_flow, range(50))) #didn't work
	dask_flow()


DeploymentSpec(name="staging", flow=dask_flow, flow_runner=DockerFlowRunner())
Thanks Anna
🙌 1
a
nice, thanks for the update