Ankit
12/18/2023, 8:13 AMFlow could not be retrieved from deployment.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/prefect/engine.py", line 274, in retrieve_flow_then_begin_flow_run
flow = await load_flow_from_flow_run(flow_run, client=client)
File "/usr/local/lib/python3.8/dist-packages/prefect/client/utilities.py", line 47, in with_injected_client
return await fn(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/prefect/deployments.py", line 159, in load_flow_from_flow_run
deployment = await client.read_deployment(flow_run.deployment_id)
File "/usr/local/lib/python3.8/dist-packages/prefect/client/orchestration.py", line 1479, in read_deployment
return schemas.responses.DeploymentResponse.parse_obj(response.json())
File "pydantic/main.py", line 526, in pydantic.main.BaseModel.parse_obj
File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 8 validation errors for DeploymentResponse
schedule -> interval
field required (type=value_error.missing)
schedule -> timezone
argument of type 'function' is not iterable (type=type_error)
schedule -> cron
extra fields not permitted (type=value_error.extra)
schedule -> day_or
extra fields not permitted (type=value_error.extra)
schedule -> timezone
argument of type 'function' is not iterable (type=type_error)
schedule -> rrule
field required (type=value_error.missing)
schedule -> cron
extra fields not permitted (type=value_error.extra)
schedule -> day_or
extra fields not permitted (type=value_error.extra)
Nate
12/18/2023, 2:15 PMAnkit
12/18/2023, 2:15 PM1.10.6
tried with 1.10.4
alsoNate
12/18/2023, 2:18 PMprefect deployment inspect <your deployment>
?
that “function is not iterable” is suspicious to me 🤔Ankit
12/18/2023, 2:21 PM{
'id': '4dc8b1e6-8700-4cc4-a13f-669f71bcd31c',
'created': '2023-09-04T07:50:17.706317+00:00',
'updated': '2023-12-11T06:33:43.020877+00:00',
'name': 'default',
'version': '92df2354ad4fb9cc6ea61ef1264a6bdd',
'description': '',
'flow_id': '810df3c8-f680-419d-8f45-d64c16e5a71c',
'schedule': {'cron': '*/30 * * * *', 'timezone': 'Asia/Calcutta', 'day_or': True},
'is_schedule_active': True,
'infra_overrides': {
'customizations': [
{'op': 'add', 'path': '/spec/template/spec/containers/0/resources', 'value': {'limits': {'cpu': 30, 'memory': '240G'}, 'requests': {'cpu': 24, 'memory': '210G'}}},
{'op': 'add', 'path': '/spec/template/spec/nodeSelector', 'value': {'type': 'large-on-demand'}}
]
},
'parameters': {},
'tags': [],
'work_queue_name': 'default',
'parameter_openapi_schema': {'type': 'object', 'title': 'Parameters', 'properties': {}},
'path': 'test_location',
'pull_steps': None,
'entrypoint': 'test_location/test_flow.py:flow_function',
'manifest_path': None,
'storage_document_id': None,
'infrastructure_document_id': 'a7b4912d-4b54-43f3-b675-8a996580214c',
'created_by': None,
'updated_by': None,
'work_pool_name': 'default-agent-pool',
'enforce_parameter_schema': False,
'infrastructure': {
'type': 'kubernetes-job',
'env': {'EXTRA_PIP_PACKAGES': 's3fs'},
'labels': {},
'name': None,
'command': None,
'image': '<REMOVED>',
'namespace': 'jhub',
'service_account_name': None,
'image_pull_policy': <KubernetesImagePullPolicy.ALWAYS: 'Always'>,
'cluster_config': None,
'job': {
'apiVersion': 'batch/v1',
'kind': 'Job',
'metadata': {'labels': {}},
'spec': {'template': {'spec': {'parallelism': 1, 'completions': 1, 'restartPolicy': 'Never', 'containers': [{'name': 'prefect-job', 'env': []}]}}}
},
'customizations': [],
'job_watch_timeout_seconds': 100000,
'pod_watch_timeout_seconds': 600,
'stream_output': True,
'finished_job_ttl': 10,
'block_type_slug': 'kubernetes-job'
}
}
Ankit
12/18/2023, 4:26 PMIlya Galperin
12/18/2023, 5:21 PMDeployment.build_from_flow
method in Prefect 2.10.12
. It seems to be happening when are passing in a cron schedule that contains timezones into the schedule
parameter i.e. {"cron": "0 1 * * *", "timezone": "America/New_York"}
CC: @Saad ZaheerAnkit
12/18/2023, 5:31 PMIlya Galperin
12/18/2023, 5:58 PMIlya Galperin
12/18/2023, 5:59 PMTraceback (most recent call last):
File "/home/runner/work/prefect-2-flows/prefect-2-flows/flows/snowflake-env-cloner/apply_deployment.py", line 190, in <module>
deployment = build_deployment(config, flow)
File "/home/runner/work/prefect-2-flows/prefect-2-flows/flows/snowflake-env-cloner/apply_deployment.py", line 177, in build_deployment
deployment = Deployment.build_from_flow(**deployment_settings)
File "/home/runner/.local/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 260, in coroutine_wrapper
return call()
File "/home/runner/.local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 245, in __call__
return self.result()
File "/home/runner/.local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 173, in result
return self.future.result(timeout=timeout)
File "/usr/lib/python3.10/concurrent/futures/_base.py", line 451, in result
return self.__get_result()
File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
raise self._exception
File "/home/runner/.local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 218, in _run_async
result = await coro
File "/home/runner/.local/lib/python3.10/site-packages/prefect/deployments.py", line 762, in build_from_flow
deployment = cls(name=name, **kwargs)
File "/home/runner/.local/lib/python3.10/site-packages/prefect/_internal/compatibility/experimental.py", line 230, in __init__
cls_init(__pydantic_self__, **data)
File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 6 validation errors for Deployment
schedule -> interval
field required (type=value_error.missing)
schedule -> timezone
argument of type 'function' is not iterable (type=type_error)
schedule -> cron
extra fields not permitted (type=value_error.extra)
schedule -> timezone
argument of type 'function' is not iterable (type=type_error)
schedule -> rrule
field required (type=value_error.missing)
schedule -> cron
extra fields not permitted (type=value_error.extra)
Ankit
12/18/2023, 6:06 PMNate
12/18/2023, 6:15 PMIlya Galperin
12/18/2023, 6:19 PMAnkit
12/18/2023, 6:20 PMNate
12/18/2023, 6:22 PMDeploymentResponse
Ilya Galperin
12/18/2023, 6:23 PMNate
12/18/2023, 9:53 PMNate
12/18/2023, 11:29 PMIlya Galperin
12/18/2023, 11:33 PMDeployment.build_from_flow(**deployment_settings)
where one of the keys defines the schedule deployment_settings["schedule"] = {"cron": "0 2 * * *", "timezone": "America/New_York"}
Nate
12/18/2023, 11:34 PMIlya Galperin
12/18/2023, 11:41 PMIlya Galperin
12/18/2023, 11:41 PMIlya Galperin
12/18/2023, 11:42 PMapply()
the resulting Deployment objectNate
12/18/2023, 11:43 PMNate
12/18/2023, 11:46 PMprefect deployment inspect <your-deployment>
as well? i thought it would have to do with the schedule but cant reproduce on either of your versions creating deployments with schedules like that - maybe the schedule is a red herring somehowIlya Galperin
12/18/2023, 11:49 PMNate
12/18/2023, 11:50 PMIlya Galperin
12/18/2023, 11:50 PMIlya Galperin
12/18/2023, 11:51 PMNate
12/18/2023, 11:52 PMIlya Galperin
12/18/2023, 11:53 PMNate
12/19/2023, 6:01 PMpendulum >= 2.1.2, < 3.0.0
i've managed to reproduce, pendulum
is pinned in newer versions of prefect, and pendulum 3 looks like a breaking change