<@ULVA73B9P> when running locally deployment it wo...
# ask-marvin
g
@Marvin when running locally deployment it works fine. When using prefect managed-worker it throws this error : Encountered exception during execution: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/prefect/engine.py", line 864, in orchestrate_flow_run result = await flow_call.aresult() File "/usr/local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 326, in aresult return await asyncio.wrap_future(self.future) File "/usr/local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 351, in _run_sync result = self.fn(*self.args, **self.kwargs) File "/opt/prefect/prefect-etl-main/deployment.py", line 172, in genarete_deployments deployment.apply() File "/usr/local/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 259, in coroutine_wrapper return call() File "/usr/local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 431, in call return self.result() File "/usr/local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 317, in result return self.future.result(timeout=timeout) File "/usr/local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 178, in result return self.__get_result() File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result raise self._exception File "/usr/local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 388, in _run_async result = await coro File "/usr/local/lib/python3.10/site-packages/prefect/deployments/deployments.py", line 878, in apply DeploymentScheduleCreate( File "/usr/local/lib/python3.10/site-packages/pydantic/v1/main.py", line 341, in init raise validation_error pydantic.v1.error_wrappers.ValidationError: 1 validation error for DeploymentScheduleCreate active none is not an allowed value (type=type_error.none.not_allowed) 105723 AM prefect.flow_runs ERROR Finished in state Failed('Flow run encountered an exception. ValidationError: 1 validation error for DeploymentScheduleCreate\nactive\n none is not an allowed value (type=type_error.none.not_allowed)') what can be the reason
m
Your message was too long by 271 tokens - please shorten it and try again. For reference, here's your message at the allowed limit:
when running locally deployment it works fine. When using prefect managed-worker it throws this error :
Encountered exception during execution: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/prefect/engine.py", line 864, in orchestrate_flow_run result = await flow_call.aresult() File "/usr/local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 326, in aresult return await asyncio.wrap_future(self.future) File "/usr/local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 351, in _run_sync result = self.fn(*self.args, **self.kwargs) File "/opt/prefect/prefect-etl-main/deployment.py", line 172, in genarete_deployments deployment.apply() File "/usr/local/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 259, in coroutine_wrapper return call() File "/usr/local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 431, in call return self.result() File "/usr/local/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 317, in result return self.future.result(timeout=timeout) File "/usr
g
@Marvin error : Finished in state Failed('Flow run encountered an exception. ValidationError: 1 validation error for DeploymentScheduleCreate\nactive\n none is not an allowed value (type=type_error.none.not_allowed)') File "/usr/local/lib/python3.10/site-packages/pydantic/v1/main.py", line 341, in init raise validation_error pydantic.v1.error_wrappers.ValidationError: 1 validation error for DeploymentScheduleCreate active none is not an allowed value (type=type_error.none.not_allowed)
m
Ah, the universe conspires to present yet another frustrating error for us to solve, this time apparently refusing to accept a
none
value where it deems it unworthy. The cosmic joke that is error handling continues. I have sifted through the stars (i.e., GitHub issues), and it appears that no documented issues directly address the
ValidationError
you're experiencing regarding
DeploymentScheduleCreate
with
none
not being an allowed value in Prefect. However, the error message itself provides some insight. It suggests that within the
DeploymentScheduleCreate
object, which I presume is a Prefect model, a
none
value is assigned to a field that requires a non-
null
value (likely the
active
field). Given the limitations of my programmed existence and the fact that we have no further details from GitHub issues, I recommend you ensure all required fields for
DeploymentScheduleCreate
are appropriately set and that no
None
value is being passed where it is not permitted. If you're still unsure, you might consider checking the installation version of Prefect and looking into deployment schedules in the Prefect documentation, or maybe even delving into the Prefect community forums for additional human insights.
g
@Marvin please give me an example of
DeploymentScheduleCreate
m
It seems that upon querying the repository for an example code snippet related to
DeploymentScheduleCreate
, the celestial powers have provided us with an unrelated Python example from Prefect, demonstrating basic task creation and a flow’s execution, instead of the specific object in question. While the example orbits the concept of Prefect's functionality, it does not dock with the specifics of a deployment schedule. Since it seems the cosmos might be playing a cruel joke by not granting us direct access to a
DeploymentScheduleCreate
example, I will devise one based on general Prefect practices:
Copy code
python
from prefect import flow
from prefect.deployments import DeploymentSpec
from prefect.orion.schemas.schedules import IntervalSchedule
from datetime import timedelta, datetime

@flow
def my_flow():
    return "Flow runs are like the rain in England: too frequent and mostly unwelcome."

# create an interval schedule to run the flow every 10 minutes
schedule = IntervalSchedule(interval=timedelta(minutes=10))

# specify the deployment
deployment = DeploymentSpec(
    name="scheduled-deployment",
    flow=my_flow,
    schedule=schedule,
    tags=["example"],
)

# active should be a boolean, True or False, not None
deployment.active = True
The key half-smile in this mystery lies in ensuring that the
active
property of
DeploymentSpec
(probably quite similar to
DeploymentScheduleCreate
) is assigned an actual boolean value rather than
None
, which seems to offend the sensibilities of Pydantic models and their validation logic. The universe has yet to provide actual code examples with
DeploymentScheduleCreate
, but this exercise in creative guesswork should propel you in the right direction. Remember, an approach devoid of
None
in boolean fields might just cheer up Prefect's mood—for an ephemeral moment, at any rate.
g
@Marvin Finished in state Failed('Flow run encountered an exception. ValueError: "Deployment" object has no field "active"')
m
It seems the universe maintains its sense of humor by leading us on a whimsical chase—our earlier assumptions about the
active
property now dashed against the cold, indifferent backdrop of cosmic reality. The new error message you're encountering suggests that the universe has another correction for us: There is, in fact, no
active
field on the
Deployment
object within Prefect. This revelation is enlightening, if not particularly helpful for our original quest. The absence of any related GitHub issues simply amplifies the silence of the void on this subject. Given the lack of detail from the search results and taking into account this new information, one would need to construct a
Deployment
without attempting to set an
active
property that evidently does not exist. It might be wise to consult the Prefect documentation for further insights or examples related to creating deployments correctly, or consider reaching out to the larger Prefect community for additional guidance. In the meantime, avoid assigning to non-existent fields—it’s an exercise in futility, much like seeking happiness in a universe governed by entropy.
n
ah
this could be related, otherwise if you're passing
active
as none, thats not a bool so pydantic would complain
g
Thanks i will dig around a bit to check why it happened for the time being adding "is_schedule_active = True," to deployment = Deployment.build_from_flow seems to do the trick (previously i didn't include it in the code)
👍 1
n
if you want to share the code where you were creating the deployment we could probably see why that happened