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

Expose Run Id to Task Instance #1112

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

stephenprater
Copy link

The Run record contains a lot of information that's interesting to a Task, including
metadata, the id, the status of the run, etc.

It's been previously rejected to expose the whole instance of the Run on the Task, so
in this case we're exposing only the ID. That gives us a unique identifier for the
execution of a given Task instance, without tying it explicitly to the Run object, but
also allowing interested parties to fetch that information if they so desire.

Comment on lines 116 to +117
@task = @run.task
@task.run_id = @run.id
Copy link
Member

Choose a reason for hiding this comment

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

We should fold this in Run#task. It should go in Task#initialize. We just need to make sure we can still do MaintenanceTasks::Task.new without an argument, because that's used a lot for testing (e.g. Maintenance::SomeTask.collection). Also it should be a keyword argument.

@@ -29,6 +29,8 @@ class NotFoundError < NameError; end

define_callbacks :start, :complete, :error, :cancel, :pause, :interrupt

attr_accessor :run_id
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
attr_accessor :run_id
attr_reader :run_id

@github-actions github-actions bot added the stale label Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants