Cody Webb
07/31/2023, 3:37 PM@flow(name="nb-convert")
def continuous_run():
files=["utils","hey","test"]
[os.system(f'jupyter nbconvert --to script {file}.ipynb') for file in files]
but when i set it up for deployment:
deployment = Deployment.build_from_flow(
flow=continuous_run,
name="Notebook converter poll",
schedule=IntervalSchedule(interval=timedelta(minutes=15)),
work_queue_name = "queue1",
)
deployment.apply()
i get:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/tmp/ipykernel_102/2609488880.py in <module>
5 work_queue_name = "queue1",
6 )
----> 7 deployment.apply()
AttributeError: 'coroutine' object has no attribute 'apply'
flow_run = run_deployment(
name = "nb_converter",
parameters = [],
scheduled_time = IntervalSchedule(interval=timedelta(minutes=15)),
flow_run_name = "nb-convert",
timeout=0
)
ideally i would like to parameterize and pass in the list of files also but couldnt figure out the problem there eitherDeceivious
07/31/2023, 3:39 PMCody Webb
07/31/2023, 3:45 PMDeceivious
07/31/2023, 3:46 PMDeployment.build_from_flow
fixes the deployment issues.Cody Webb
07/31/2023, 3:46 PMValueError: Could not determine flow's file location.
which im calling a local functionDeceivious
07/31/2023, 3:47 PM@flow(name="nb-convert")
def continuous_run(ist_of_files:List):
....
And u can call run_deployment
with parameters={"ist_of_files":["a","b"]}
Cody Webb
07/31/2023, 3:47 PM---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/tmp/ipykernel_102/3257527765.py in <module>
----> 1 deployment = await Deployment.build_from_flow(
2 flow=continuous_run(),
3 name="Notebook converter poll",
4 schedule=IntervalSchedule(interval=timedelta(minutes=15)),
5 work_queue_name = "queue1",
/opt/conda/envs/rapids/lib/python3.10/site-packages/prefect/deployments/deployments.py in build_from_flow(cls, flow, name, output, skip_upload, ignore_file, apply, load_existing, **kwargs)
790 # provided at initialization
791 deployment = cls(name=name, **kwargs)
--> 792 deployment.flow_name = flow.name
793 if not deployment.entrypoint:
794 ## first see if an entrypoint can be determined
AttributeError: 'NoneType' object has no attribute 'name'
Deceivious
07/31/2023, 3:51 PMCody Webb
07/31/2023, 3:52 PMValueError: Could not determine flow's file location.
Deceivious
07/31/2023, 3:53 PMpath
parameter where u can specify which py file the flow is defined inCody Webb
07/31/2023, 3:53 PMDeceivious
07/31/2023, 3:54 PM___file___
Cody Webb
07/31/2023, 3:54 PMfrom nb_converter import continuous_run
deployment = await Deployment.build_from_flow(
flow=continuous_run,
name="Notebook converter poll",
#schedule=IntervalSchedule(interval=timedelta(minutes=15)),
work_queue_name = "queue_1",
)
deploy_id = await deployment.apply()
and im going to run it with
flow_run = await run_deployment(
name = deploy_id,
scheduled_time = IntervalSchedule(interval=timedelta(minutes=15)),
flow_run_name = "Notebook converter poll",
timeout=0
)
await flow_run.apply()
but im getting:
PrefectHTTPStatusError: Client error '422 Unprocessable Entity' for url '<http://127.0.0.1:4200/api/deployments/688d6991-6ede-4a36-859b-218208bae56e/create_flow_run>'
Response: {'exception_message': 'Invalid request received.', 'exception_detail': [{'loc': ['body', 'state', 'state_details', 'scheduled_time'], 'msg': 'Unrecognized datetime.', 'type': 'value_error'}], 'request_body': {'state': {'type': 'SCHEDULED', 'name': 'Scheduled', 'message': None, 'state_details': {'scheduled_time': {'interval': 900.0}}, 'data': None}, 'name': 'busy-cow', 'parameters': {}, 'context': {}, 'tags': [], 'idempotency_key': None, 'parent_task_run_id': None}}
For more information check: <https://httpstatuses.com/422>
can i not pass in a interval schedule here for scheduled_time?