https://prefect.io logo
Title
e

eddy davies

01/30/2023, 1:10 PM
I was using this deployment class code last week, haven't change anything but does not seem to work now
code = S3.load("code-beauhurst")
k8s = KubernetesJob().load("k8s-prod")
weekly_schedule = IntervalSchedule(
    interval=timedelta(weeks=1),
    anchor_date=datetime(2023, 1, 30, 2, 00))


deployment_extract = Deployment.build_from_flow(
    flow=extract_collection,
    name="beauhurst_staging",
    version=2,
    tag=["api-to-s3"],
    work_queue_name="beauhurst",
    storage=code,
    infrastructure=k8s,
    schedule=weekly_schedule
)

if __name__ == '__main__':
    deployment_extract.apply()
r

redsquare

01/30/2023, 1:16 PM
are you applying it? - when you say not working - what do you mean?
e

eddy davies

01/30/2023, 1:22 PM
Yes sorry, I was but just added that to the code above. I get this error
Traceback (most recent call last):
  File "/Users/eddydavies/code/python-beauhurst-data/deployment.py", line 17, in <module>
    deployment_extract = Deployment.build_from_flow(
  File "/Users/eddydavies/code/python-beauhurst-data/.venv/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 230, in coroutine_wrapper
    return run_async_in_new_loop(async_fn, *args, **kwargs)
  File "/Users/eddydavies/code/python-beauhurst-data/.venv/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 181, in run_async_in_new_loop
    return anyio.run(partial(__fn, *args, **kwargs))
  File "/Users/eddydavies/code/python-beauhurst-data/.venv/lib/python3.10/site-packages/anyio/_core/_eventloop.py", line 70, in run
    return asynclib.run(func, *args, **backend_options)
  File "/Users/eddydavies/code/python-beauhurst-data/.venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 292, in run
    return native_run(wrapper(), debug=debug)
  File "/Users/eddydavies/.pyenv/versions/3.10.5/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/Users/eddydavies/.pyenv/versions/3.10.5/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/Users/eddydavies/code/python-beauhurst-data/.venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 287, in wrapper
    return await func(*args)
  File "/Users/eddydavies/code/python-beauhurst-data/.venv/lib/python3.10/site-packages/prefect/deployments.py", line 708, in build_from_flow
    deployment = cls(name=name, **kwargs)
  File "/Users/eddydavies/code/python-beauhurst-data/.venv/lib/python3.10/site-packages/prefect/_internal/compatibility/experimental.py", line 228, in __init__
    cls_init(__pydantic_self__, **data)
  File "pydantic/main.py", line 342, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for Deployment
tag
  extra fields not permitted (type=value_error.extra)
Still deploys with prefect cli though
r

redsquare

01/30/2023, 1:29 PM
hmm perhaps tag - should be tags
e

eddy davies

01/30/2023, 4:36 PM
Good catch, no idea how I accidentally change that, thanks