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

New API type: CurrentExecutingGoals. #18788

Merged
merged 2 commits into from Apr 25, 2023
Merged

Conversation

kaos
Copy link
Member

@kaos kaos commented Apr 22, 2023

Example use:

from pants.engine.goal import CurrentExecutingGoals

IsMyGoalRunning = bool

@rule
def check_my_goal_running(goals: CurrentExecutingGoals) -> IsMyGoalRunning:
    return goals.is_running(MyGoal.name)

@rule
def my_rule(..., my_goal_is_running: IsMyGoalRunning) -> MyResult:
  if my_goal_is_running:
    # conditional stuff for my-goal

  return MyResult()

Supersedes #17674.

@kaos
Copy link
Member Author

kaos commented Apr 24, 2023

@stuhood I think this API is prepared for the future where goals may run concurrently, even if the implementation to support it may differ.

@kaos kaos changed the title Add CurrentExecutingGoals to session values. New API type: CurrentExecutingGoals. Apr 24, 2023
Copy link
Sponsor Member

@stuhood stuhood left a comment

Choose a reason for hiding this comment

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

Thanks!

@kaos kaos enabled auto-merge (squash) April 25, 2023 18:23
@kaos kaos merged commit daf9c36 into pantsbuild:main Apr 25, 2023
17 checks passed
@kaos kaos deleted the current-executing-goals branch April 25, 2023 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants