Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raise helpful error when task_worker runs against ephemeral server #13848

Merged
merged 5 commits into from
Jun 7, 2024

Conversation

jakekaplan
Copy link
Contributor

closes:#13847

Previously running a task worker against the ephemeral api would error with:

17:32:07.345 | INFO    | prefect.task_worker - Starting task worker...
17:32:07.345 | INFO    | prefect.task_worker - Subscribing to tasks: my_background_task-7c388d0bf59fa4394379971e841498bc
17:32:07.347 | ERROR   | prefect.task_worker - Task worker stopped with 1 exception:
'NoneType' object has no attribute 'replace'

As of this PR it errors in the following way:

17:44:36.607 | INFO    | prefect.task_worker - Starting task worker...
17:44:36.609 | ERROR   | prefect.task_worker - Task worker stopped with 1 exception:
PREFECT_API_URL must be set to use the task worker. Task workers are not compatible with ephemeral api.

@jakekaplan jakekaplan added the enhancement An improvement of an existing feature label Jun 6, 2024
@jakekaplan jakekaplan requested a review from a team as a code owner June 6, 2024 21:46
src/prefect/task_worker.py Outdated Show resolved Hide resolved
from prefect.states import Running
from prefect.task_worker import TaskWorker, serve
from prefect.tasks import task_input_hash

pytestmark = pytest.mark.usefixtures("use_hosted_api_server")
Copy link
Contributor Author

@jakekaplan jakekaplan Jun 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should always use a hosted server for these tests since task_workers should not run against the ephemeral api?

src/prefect/task_worker.py Outdated Show resolved Hide resolved
Co-authored-by: nate nowack <thrast36@gmail.com>
@jakekaplan jakekaplan merged commit 5879df3 into main Jun 7, 2024
20 of 26 checks passed
@jakekaplan jakekaplan deleted the warn-task-scheduling-against-ephemeral-server branch June 7, 2024 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants