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

track task run params in state details to avoid quantum entanglement #11737

Merged
merged 2 commits into from
Jan 26, 2024

Conversation

abrookins
Copy link
Collaborator

…with results

Example

Checklist

  • This pull request references any related issue by including "closes <link to issue>"
    • If no issue exists and your change is not a small fix, please create an issue first.
  • This pull request includes tests or only affects documentation.
  • This pull request includes a label categorizing the change e.g. maintenance, fix, feature, enhancement, docs.

For documentation changes:

  • This pull request includes redirect settings in netlify.toml for files that are removed or renamed.

For new functions or classes in the Python SDK:

  • This pull request includes helpful docstrings.
  • If a new Python file was added, this pull request contains a stub page in the Python SDK docs and an entry in mkdocs.yml navigation.

@abrookins abrookins requested review from a team and zangell44 as code owners January 26, 2024 05:59
@abrookins
Copy link
Collaborator Author

I kept breaking things until a task ran, check it out:

fastapi-user-signups-api-1        | 05:54:26.282 | INFO    | prefect.engine - Submitted run of task send_confirmation_email with ID 363b457d-8a4f-4925-a614-ee4eadffa84d
fastapi-user-signups-tasks-1      | 05:54:30.504 | INFO    | prefect.task_server - Scheduled(message=None, type=SCHEDULED, result=None)
fastapi-user-signups-tasks-1      | 05:54:31.337 | INFO    | Flow run '<unknown>' - Created task run 'send_confirmation_email-b4aa425c' for task 'send_confirmation_email'
fastapi-user-signups-tasks-1      | 05:54:31.338 | INFO    | Flow run '<unknown>' - Executing 'send_confirmation_email-b4aa425c' immediately...
fastapi-user-signups-mailboi-1    | time="2024-01-26T05:54:31Z" level=error msg="Handled request" bytes-in=116 bytes-out=635 end="2024-01-26T05:54:31Z" headers="map[Accept:[*/*] Accept-Encoding:[gzip, deflate] Connection:[keep-alive] Content-Length:[116] Content-Type:[application/json] User-Agent:[python-httpx/0.26.0]]" host=mailboi latency=3.97225ms method=POST path=/send-mail remote-ip=172.24.0.6 start="2024-01-26T05:54:31Z" status=666 uri=/send-mail
fastapi-user-signups-tasks-1      | 05:54:31.444 | INFO    | Task run 'send_confirmation_email-b4aa425c' - Finished in state Completed()

task.persist_result = True
factory = await ResultFactory.from_task(task)
parameters = await factory.read_parameters(parameter_id)
try:
parameters = await factory.read_parameters(parameters_id)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We probably don't want this exception handler, I was just trying to cut down on the error output while the task engine couldn't find the files in storage.

Copy link
Collaborator

@chrisguidry chrisguidry left a comment

Choose a reason for hiding this comment

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

This looks great, it was exactly what I was planning to do today, to add a new attribute for ourselves on state_details. I was running short on time yesterday afternoon to explain, but the whole data thing was totally a hack just to get something stored server-side, but this is definitely the better way

src/prefect/client/schemas/objects.py Show resolved Hide resolved
src/prefect/results.py Outdated Show resolved Hide resolved
src/prefect/server/database/orm_models.py Outdated Show resolved Hide resolved
@chrisguidry
Copy link
Collaborator

I ran through this locally with the task-scheduling-examples repo and it works well!

@chrisguidry chrisguidry merged commit 9c4ef1b into init-task-engine Jan 26, 2024
22 of 53 checks passed
@chrisguidry chrisguidry deleted the tracking-parameter-ids-in-state-details branch January 26, 2024 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants