2025-12-04T08:44:44.3136972Z Current runner version: '2.329.0' 2025-12-04T08:44:44.3162845Z ##[group]Runner Image Provisioner 2025-12-04T08:44:44.3163770Z Hosted Compute Agent 2025-12-04T08:44:44.3164293Z Version: 20251124.448 2025-12-04T08:44:44.3164888Z Commit: fda5086b43ec66ade217e5fcd18146c879571177 2025-12-04T08:44:44.3165636Z Build Date: 2025-11-24T21:16:26Z 2025-12-04T08:44:44.3166243Z ##[endgroup] 2025-12-04T08:44:44.3166763Z ##[group]Operating System 2025-12-04T08:44:44.3167374Z Ubuntu 2025-12-04T08:44:44.3167826Z 24.04.3 2025-12-04T08:44:44.3168298Z LTS 2025-12-04T08:44:44.3168791Z ##[endgroup] 2025-12-04T08:44:44.3169245Z ##[group]Runner Image 2025-12-04T08:44:44.3169821Z Image: ubuntu-24.04 2025-12-04T08:44:44.3170407Z Version: 20251126.144.1 2025-12-04T08:44:44.3171439Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20251126.144/images/ubuntu/Ubuntu2404-Readme.md 2025-12-04T08:44:44.3173073Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20251126.144 2025-12-04T08:44:44.3174130Z ##[endgroup] 2025-12-04T08:44:44.3175186Z ##[group]GITHUB_TOKEN Permissions 2025-12-04T08:44:44.3177347Z Contents: read 2025-12-04T08:44:44.3177898Z Metadata: read 2025-12-04T08:44:44.3178423Z ##[endgroup] 2025-12-04T08:44:44.3180763Z Secret source: Actions 2025-12-04T08:44:44.3181647Z Prepare workflow directory 2025-12-04T08:44:44.3687056Z Prepare all required actions 2025-12-04T08:44:44.3743991Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (ffd9b0fb4355e97af82fc42cf185c3ffa0fc0a32) 2025-12-04T08:44:44.3749079Z ##[group] Inputs 2025-12-04T08:44:44.3749678Z check_experiments: 2025-12-04T08:44:44.3750275Z opt_out_experiments: 2025-12-04T08:44:44.3750789Z triggering_actor: seemethere 2025-12-04T08:44:44.3751449Z issue_owner: 2025-12-04T08:44:44.3751955Z curr_branch: main 2025-12-04T08:44:44.3752431Z curr_ref_type: branch 2025-12-04T08:44:44.3753503Z issue_number: 5132 2025-12-04T08:44:44.3754070Z ##[endgroup] 2025-12-04T08:44:44.3754759Z Complete job name: before-test / get-label-type / runner-determinator 2025-12-04T08:44:44.9139685Z ##[group]Run cat < runner_determinator.py 2025-12-04T08:44:44.9142240Z cat < runner_determinator.py 2025-12-04T08:44:44.9143394Z # flake8: noqa: G004 2025-12-04T08:44:44.9144049Z  2025-12-04T08:44:44.9144898Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T08:44:44.9146015Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T08:44:44.9147095Z # python .github/scripts/update_runner_determinator.py 2025-12-04T08:44:44.9147874Z  2025-12-04T08:44:44.9148324Z """ 2025-12-04T08:44:44.9149147Z This runner determinator is used to determine which set of runners to run a 2025-12-04T08:44:44.9150206Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T08:44:44.9151479Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T08:44:44.9152555Z of which runners should be used to run which job. 2025-12-04T08:44:44.9153490Z  2025-12-04T08:44:44.9154240Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T08:44:44.9155457Z separated by a line containing "---". If the line is not present, the 2025-12-04T08:44:44.9156537Z settings are considered to be empty with only the second part, the user 2025-12-04T08:44:44.9157374Z list, defined. 2025-12-04T08:44:44.9158042Z  2025-12-04T08:44:44.9158732Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T08:44:44.9159856Z used to define any settings that are needed to determine which runners to use. 2025-12-04T08:44:44.9160963Z It's fields are defined by the RolloutSettings class below. 2025-12-04T08:44:44.9161705Z  2025-12-04T08:44:44.9162887Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T08:44:44.9164046Z The user list is also a comma separated list of additional features or 2025-12-04T08:44:44.9165007Z experiments which the user could be opted in to. 2025-12-04T08:44:44.9165716Z  2025-12-04T08:44:44.9166288Z The user list has the following rules: 2025-12-04T08:44:44.9166954Z  2025-12-04T08:44:44.9167663Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T08:44:44.9168780Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T08:44:44.9169697Z - A "#" prefix opts the user out of all experiments 2025-12-04T08:44:44.9170403Z  2025-12-04T08:44:44.9170948Z Example config: 2025-12-04T08:44:44.9171565Z  # A list of experiments that can be opted into. 2025-12-04T08:44:44.9172456Z  # This defines the behavior they'll induce when opted into. 2025-12-04T08:44:44.9173383Z  # Expected syntax is: 2025-12-04T08:44:44.9174273Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T08:44:44.9175436Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T08:44:44.9176353Z  2025-12-04T08:44:44.9176870Z  experiments: 2025-12-04T08:44:44.9177424Z  lf: 2025-12-04T08:44:44.9177999Z  rollout_percent: 25 2025-12-04T08:44:44.9178621Z  all_branches: false 2025-12-04T08:44:44.9179251Z  default: true 2025-12-04T08:44:44.9179867Z  --- 2025-12-04T08:44:44.9180354Z  2025-12-04T08:44:44.9180871Z  # Opt-ins: 2025-12-04T08:44:44.9181613Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T08:44:44.9183036Z  # and specifying experiments to enable in a comma-separated list. 2025-12-04T08:44:44.9184041Z  # To always opt out of an experiment, prefix it with a "-". 2025-12-04T08:44:44.9184893Z  # Experiments should be from the above list. 2025-12-04T08:44:44.9185678Z  2025-12-04T08:44:44.9186196Z  @User1,-lf,split_build 2025-12-04T08:44:44.9186808Z  @User2,lf 2025-12-04T08:44:44.9187413Z  @User3,split_build 2025-12-04T08:44:44.9188006Z """ 2025-12-04T08:44:44.9188469Z  2025-12-04T08:44:44.9265936Z import json 2025-12-04T08:44:44.9266468Z import logging 2025-12-04T08:44:44.9266982Z import os 2025-12-04T08:44:44.9267421Z import random 2025-12-04T08:44:44.9267872Z import re 2025-12-04T08:44:44.9268297Z import sys 2025-12-04T08:44:44.9268789Z from argparse import ArgumentParser 2025-12-04T08:44:44.9269495Z from collections.abc import Iterable 2025-12-04T08:44:44.9270170Z from functools import cache 2025-12-04T08:44:44.9270717Z from logging import LogRecord 2025-12-04T08:44:44.9271304Z from typing import Any, NamedTuple 2025-12-04T08:44:44.9271952Z from urllib.request import Request, urlopen 2025-12-04T08:44:44.9272556Z  2025-12-04T08:44:44.9273097Z import yaml 2025-12-04T08:44:44.9273579Z from github import Auth, Github 2025-12-04T08:44:44.9274163Z from github.Issue import Issue 2025-12-04T08:44:44.9274684Z  2025-12-04T08:44:44.9275055Z  2025-12-04T08:44:44.9275523Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T08:44:44.9276310Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T08:44:44.9277302Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T08:44:44.9278078Z  2025-12-04T08:44:44.9278853Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T08:44:44.9279502Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T08:44:44.9280124Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T08:44:44.9280772Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T08:44:44.9281341Z  2025-12-04T08:44:44.9281778Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T08:44:44.9282328Z  2025-12-04T08:44:44.9283071Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T08:44:44.9283627Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T08:44:44.9284139Z  2025-12-04T08:44:44.9284518Z  2025-12-04T08:44:44.9284952Z class Experiment(NamedTuple): 2025-12-04T08:44:44.9285518Z  rollout_perc: float = ( 2025-12-04T08:44:44.9286269Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T08:44:44.9287008Z  ) 2025-12-04T08:44:44.9287431Z  all_branches: bool = ( 2025-12-04T08:44:44.9288183Z  False # If True, the experiment is also enabled on the exception branches 2025-12-04T08:44:44.9288913Z  ) 2025-12-04T08:44:44.9289333Z  default: bool = ( 2025-12-04T08:44:44.9290005Z  True # If True, the experiment is enabled by default for all queries 2025-12-04T08:44:44.9290716Z  ) 2025-12-04T08:44:44.9291118Z  2025-12-04T08:44:44.9291529Z  # Add more fields as needed 2025-12-04T08:44:44.9292054Z  2025-12-04T08:44:44.9292423Z  2025-12-04T08:44:44.9292954Z class Settings(NamedTuple): 2025-12-04T08:44:44.9293482Z  """ 2025-12-04T08:44:44.9294037Z  Settings for the experiments that can be opted into. 2025-12-04T08:44:44.9294672Z  """ 2025-12-04T08:44:44.9295074Z  2025-12-04T08:44:44.9295517Z  experiments: dict[str, Experiment] = {} 2025-12-04T08:44:44.9296103Z  2025-12-04T08:44:44.9296618Z  2025-12-04T08:44:44.9297085Z class ColorFormatter(logging.Formatter): 2025-12-04T08:44:44.9297805Z  """Color codes the log messages based on the log level""" 2025-12-04T08:44:44.9298441Z  2025-12-04T08:44:44.9298833Z  COLORS = { 2025-12-04T08:44:44.9299308Z  "WARNING": "\033[33m", # Yellow 2025-12-04T08:44:44.9299881Z  "ERROR": "\033[31m", # Red 2025-12-04T08:44:44.9300441Z  "CRITICAL": "\033[31m", # Red 2025-12-04T08:44:44.9301004Z  "INFO": "\033[0m", # Reset 2025-12-04T08:44:44.9301564Z  "DEBUG": "\033[0m", # Reset 2025-12-04T08:44:44.9302086Z  } 2025-12-04T08:44:44.9302489Z  2025-12-04T08:44:44.9303064Z  def format(self, record: LogRecord) -> str: 2025-12-04T08:44:44.9303902Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T08:44:44.9304759Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T08:44:44.9305405Z  return super().format(record) 2025-12-04T08:44:44.9305942Z  2025-12-04T08:44:44.9306317Z  2025-12-04T08:44:44.9306739Z handler = logging.StreamHandler() 2025-12-04T08:44:44.9307545Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T08:44:44.9308327Z  2025-12-04T08:44:44.9308829Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T08:44:44.9309481Z log.addHandler(handler) 2025-12-04T08:44:44.9310006Z log.setLevel(logging.INFO) 2025-12-04T08:44:44.9310510Z  2025-12-04T08:44:44.9310881Z  2025-12-04T08:44:44.9311386Z def set_github_output(key: str, value: str) -> None: 2025-12-04T08:44:44.9312011Z  """ 2025-12-04T08:44:44.9312598Z  Defines outputs of the github action that invokes this script 2025-12-04T08:44:44.9313595Z  """ 2025-12-04T08:44:44.9314025Z  if not GITHUB_OUTPUT: 2025-12-04T08:44:44.9315257Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T08:44:44.9316474Z  log.warning( 2025-12-04T08:44:44.9317443Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T08:44:44.9318438Z  ) 2025-12-04T08:44:44.9318948Z  print(f"::set-output name={key}::{value}") 2025-12-04T08:44:44.9319544Z  return 2025-12-04T08:44:44.9319987Z  2025-12-04T08:44:44.9320421Z  with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T08:44:44.9321073Z  log.info(f"Setting output: {key}='{value}'") 2025-12-04T08:44:44.9321707Z  f.write(f"{key}={value}\n") 2025-12-04T08:44:44.9322249Z  2025-12-04T08:44:44.9322625Z  2025-12-04T08:44:44.9323491Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T08:44:44.9324218Z  return frozenset( 2025-12-04T08:44:44.9324930Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T08:44:44.9325670Z  ) 2025-12-04T08:44:44.9326081Z  2025-12-04T08:44:44.9326464Z  2025-12-04T08:44:44.9326865Z def parse_args() -> Any: 2025-12-04T08:44:44.9327540Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T08:44:44.9328501Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T08:44:44.9329338Z  parser.add_argument( 2025-12-04T08:44:44.9329878Z  "--github-issue-repo", 2025-12-04T08:44:44.9330423Z  type=str, 2025-12-04T08:44:44.9330917Z  required=False, 2025-12-04T08:44:44.9331597Z  default="pytorch/test-infra", 2025-12-04T08:44:44.9332236Z  help="GitHub repo to get the issue", 2025-12-04T08:44:44.9333120Z  ) 2025-12-04T08:44:44.9333580Z  parser.add_argument( 2025-12-04T08:44:44.9334130Z  "--github-repo", 2025-12-04T08:44:44.9334637Z  type=str, 2025-12-04T08:44:44.9335125Z  required=True, 2025-12-04T08:44:44.9335690Z  help="GitHub repo where CI is running", 2025-12-04T08:44:44.9336273Z  ) 2025-12-04T08:44:44.9336705Z  parser.add_argument( 2025-12-04T08:44:44.9337427Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T08:44:44.9338145Z  ) 2025-12-04T08:44:44.9338581Z  parser.add_argument( 2025-12-04T08:44:44.9339312Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T08:44:44.9340068Z  ) 2025-12-04T08:44:44.9340497Z  parser.add_argument( 2025-12-04T08:44:44.9341237Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T08:44:44.9341985Z  ) 2025-12-04T08:44:44.9342404Z  parser.add_argument( 2025-12-04T08:44:44.9343288Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T08:44:44.9344061Z  ) 2025-12-04T08:44:44.9344508Z  parser.add_argument( 2025-12-04T08:44:44.9345038Z  "--github-ref-type", 2025-12-04T08:44:44.9345573Z  type=str, 2025-12-04T08:44:44.9346063Z  required=True, 2025-12-04T08:44:44.9346676Z  help="Current GitHub ref type, branch or tag", 2025-12-04T08:44:44.9347280Z  ) 2025-12-04T08:44:44.9347720Z  parser.add_argument( 2025-12-04T08:44:44.9348429Z  "--eligible-experiments", 2025-12-04T08:44:44.9349033Z  type=_str_comma_separated_to_set, 2025-12-04T08:44:44.9349612Z  required=False, 2025-12-04T08:44:44.9350115Z  default="", 2025-12-04T08:44:44.9351085Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T08:44:44.9352077Z  ) 2025-12-04T08:44:44.9352505Z  parser.add_argument( 2025-12-04T08:44:44.9353223Z  "--opt-out-experiments", 2025-12-04T08:44:44.9353819Z  type=_str_comma_separated_to_set, 2025-12-04T08:44:44.9354421Z  required=False, 2025-12-04T08:44:44.9354926Z  default="", 2025-12-04T08:44:44.9355407Z  help=( 2025-12-04T08:44:44.9356178Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T08:44:44.9357412Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T08:44:44.9358315Z  ), 2025-12-04T08:44:44.9358737Z  ) 2025-12-04T08:44:44.9359164Z  parser.add_argument( 2025-12-04T08:44:44.9359680Z  "--pr-number", 2025-12-04T08:44:44.9360186Z  type=str, 2025-12-04T08:44:44.9360672Z  required=False, 2025-12-04T08:44:44.9361174Z  default="", 2025-12-04T08:44:44.9361749Z  help="the optional PR number where this is run", 2025-12-04T08:44:44.9362356Z  ) 2025-12-04T08:44:44.9363280Z  2025-12-04T08:44:44.9363711Z  return parser.parse_args() 2025-12-04T08:44:44.9364240Z  2025-12-04T08:44:44.9364612Z  2025-12-04T08:44:44.9365276Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T08:44:44.9366259Z  auth = Auth.Token(github_token) 2025-12-04T08:44:44.9366879Z  return Github(auth=auth) 2025-12-04T08:44:44.9367394Z  2025-12-04T08:44:44.9367771Z  2025-12-04T08:44:44.9368496Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T08:44:44.9369376Z  repo = gh.get_repo(repo) 2025-12-04T08:44:44.9369995Z  return repo.get_issue(number=issue_num) 2025-12-04T08:44:44.9370573Z  2025-12-04T08:44:44.9370947Z  2025-12-04T08:44:44.9371352Z def get_potential_pr_author( 2025-12-04T08:44:44.9372099Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T08:44:44.9372953Z ) -> str: 2025-12-04T08:44:44.9373565Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T08:44:44.9374465Z  # Fetch the actual username from the original PR. The PR number is 2025-12-04T08:44:44.9375317Z  # embedded in the tag name: ciflow// 2025-12-04T08:44:44.9375952Z  2025-12-04T08:44:44.9376378Z  gh = get_gh_client(github_token) 2025-12-04T08:44:44.9376927Z  2025-12-04T08:44:44.9377448Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T08:44:44.9378154Z  split_tag = ref_name.split("/") 2025-12-04T08:44:44.9378720Z  if ( 2025-12-04T08:44:44.9379174Z  len(split_tag) == 3 2025-12-04T08:44:44.9379740Z  and split_tag[0] == "ciflow" 2025-12-04T08:44:44.9380328Z  and split_tag[2].isnumeric() 2025-12-04T08:44:44.9380885Z  ): 2025-12-04T08:44:44.9381352Z  pr_number = split_tag[2] 2025-12-04T08:44:44.9381897Z  try: 2025-12-04T08:44:44.9382411Z  repository = gh.get_repo(repo) 2025-12-04T08:44:44.9383381Z  pull = repository.get_pull(number=int(pr_number)) 2025-12-04T08:44:44.9384070Z  except Exception as e: 2025-12-04T08:44:44.9384674Z  raise Exception( # noqa: TRY002 2025-12-04T08:44:44.9385425Z  f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T08:44:44.9386150Z  ) from e 2025-12-04T08:44:44.9386789Z  return pull.user.login # type: ignore[no-any-return] 2025-12-04T08:44:44.9387578Z  # In all other cases, return the original input username 2025-12-04T08:44:44.9388234Z  return username 2025-12-04T08:44:44.9388705Z  2025-12-04T08:44:44.9389077Z  2025-12-04T08:44:44.9389557Z def is_exception_branch(branch: str) -> bool: 2025-12-04T08:44:44.9390156Z  """ 2025-12-04T08:44:44.9390909Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T08:44:44.9391775Z  """ 2025-12-04T08:44:44.9392398Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T08:44:44.9393218Z  2025-12-04T08:44:44.9393594Z  2025-12-04T08:44:44.9394029Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T08:44:44.9394590Z  try: 2025-12-04T08:44:44.9395050Z  data = yaml.safe_load(yaml_text) 2025-12-04T08:44:44.9395618Z  return data 2025-12-04T08:44:44.9396116Z  except yaml.YAMLError: 2025-12-04T08:44:44.9396692Z  log.exception("Error loading YAML") 2025-12-04T08:44:44.9397262Z  raise 2025-12-04T08:44:44.9397695Z  2025-12-04T08:44:44.9398075Z  2025-12-04T08:44:44.9398748Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T08:44:44.9399558Z  """ 2025-12-04T08:44:44.9400400Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T08:44:44.9401220Z  2025-12-04T08:44:44.9401812Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T08:44:44.9402764Z  and the text below is the list of opted in users. 2025-12-04T08:44:44.9403378Z  2025-12-04T08:44:44.9404019Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T08:44:44.9404782Z  """ 2025-12-04T08:44:44.9405305Z  rollout_state_parts = rollout_state.split("---") 2025-12-04T08:44:44.9405972Z  if len(rollout_state_parts) >= 2: 2025-12-04T08:44:44.9406663Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T08:44:44.9407326Z  else: 2025-12-04T08:44:44.9407769Z  return "", rollout_state 2025-12-04T08:44:44.9408306Z  2025-12-04T08:44:44.9408965Z  2025-12-04T08:44:44.9409419Z class UserOptins(dict[str, list[str]]): 2025-12-04T08:44:44.9409983Z  """ 2025-12-04T08:44:44.9410579Z  Dictionary of users with a list of features they have opted into 2025-12-04T08:44:44.9411283Z  """ 2025-12-04T08:44:44.9411678Z  2025-12-04T08:44:44.9412050Z  2025-12-04T08:44:44.9412628Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T08:44:44.9413449Z  """ 2025-12-04T08:44:44.9414249Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-12-04T08:44:44.9415170Z  2025-12-04T08:44:44.9416059Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T08:44:44.9417132Z  - Example line: "@User1,lf,split_build" 2025-12-04T08:44:44.9418041Z  - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T08:44:44.9418729Z  2025-12-04T08:44:44.9419101Z  2025-12-04T08:44:44.9419479Z  """ 2025-12-04T08:44:44.9419917Z  optins = UserOptins() 2025-12-04T08:44:44.9420501Z  for user in user_optin_text.split("\n"): 2025-12-04T08:44:44.9421128Z  user = user.strip("\r\n\t -") 2025-12-04T08:44:44.9421756Z  if not user or not user.startswith("@"): 2025-12-04T08:44:44.9422369Z  # Not a valid user. Skip 2025-12-04T08:44:44.9423034Z  continue 2025-12-04T08:44:44.9423496Z  2025-12-04T08:44:44.9423876Z  if user: 2025-12-04T08:44:44.9424402Z  usr_name = user.split(",")[0].strip("@") 2025-12-04T08:44:44.9425167Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T08:44:44.9425905Z  2025-12-04T08:44:44.9426295Z  return optins 2025-12-04T08:44:44.9426755Z  2025-12-04T08:44:44.9427121Z  2025-12-04T08:44:44.9427677Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T08:44:44.9428357Z  """ 2025-12-04T08:44:44.9428823Z  Check if the experiment name is valid. 2025-12-04T08:44:44.9429405Z  A valid name: 2025-12-04T08:44:44.9430136Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T08:44:44.9431149Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T08:44:44.9431923Z  - Cannot contain spaces 2025-12-04T08:44:44.9432448Z  """ 2025-12-04T08:44:44.9432950Z  2025-12-04T08:44:44.9433461Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T08:44:44.9434250Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T08:44:44.9435045Z  2025-12-04T08:44:44.9435440Z  if valid: 2025-12-04T08:44:44.9435894Z  return True 2025-12-04T08:44:44.9436356Z  2025-12-04T08:44:44.9436735Z  log.error( 2025-12-04T08:44:44.9438288Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-12-04T08:44:44.9439930Z  ) 2025-12-04T08:44:44.9440335Z  return False 2025-12-04T08:44:44.9440785Z  2025-12-04T08:44:44.9441154Z  2025-12-04T08:44:44.9441720Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T08:44:44.9442408Z  """ 2025-12-04T08:44:44.9443380Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T08:44:44.9444173Z  """ 2025-12-04T08:44:44.9444582Z  try: 2025-12-04T08:44:44.9445015Z  if settings_text: 2025-12-04T08:44:44.9445834Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T08:44:44.9446704Z  # for easy reading 2025-12-04T08:44:44.9447599Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T08:44:44.9448566Z  # the backtick character in shell commands. 2025-12-04T08:44:44.9449251Z  backtick = chr(96) # backtick character 2025-12-04T08:44:44.9450002Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T08:44:44.9450747Z  settings = load_yaml(settings_text) 2025-12-04T08:44:44.9451314Z  2025-12-04T08:44:44.9451967Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T08:44:44.9453065Z  experiments = {} 2025-12-04T08:44:44.9453580Z  2025-12-04T08:44:44.9454198Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T08:44:44.9455033Z  if not is_valid_experiment_name(exp_name): 2025-12-04T08:44:44.9456227Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-12-04T08:44:44.9457351Z  continue 2025-12-04T08:44:44.9457858Z  2025-12-04T08:44:44.9458282Z  valid_settings = {} 2025-12-04T08:44:44.9458871Z  for setting in exp_settings: 2025-12-04T08:44:44.9459510Z  if setting not in Experiment._fields: 2025-12-04T08:44:44.9460138Z  log.warning( 2025-12-04T08:44:44.9460953Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T08:44:44.9461730Z  ) 2025-12-04T08:44:44.9462230Z  else: 2025-12-04T08:44:44.9462936Z  valid_settings[setting] = exp_settings[setting] 2025-12-04T08:44:44.9463551Z  2025-12-04T08:44:44.9464082Z  experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T08:44:44.9464791Z  return Settings(experiments) 2025-12-04T08:44:44.9465336Z  2025-12-04T08:44:44.9465736Z  except Exception: 2025-12-04T08:44:44.9466300Z  log.exception("Failed to parse settings") 2025-12-04T08:44:44.9466889Z  2025-12-04T08:44:44.9467276Z  return Settings() 2025-12-04T08:44:44.9467750Z  2025-12-04T08:44:44.9468126Z  2025-12-04T08:44:44.9468758Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T08:44:44.9469402Z  """ 2025-12-04T08:44:44.9469913Z  Parse settings, if any, from the rollout state. 2025-12-04T08:44:44.9470511Z  2025-12-04T08:44:44.9471104Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T08:44:44.9471937Z  and the text below is the list of opted in users. 2025-12-04T08:44:44.9472535Z  2025-12-04T08:44:44.9473315Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T08:44:44.9474109Z  """ 2025-12-04T08:44:44.9474741Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:44:44.9475586Z  return parse_settings_from_text(settings_text) 2025-12-04T08:44:44.9476183Z  2025-12-04T08:44:44.9476552Z  2025-12-04T08:44:44.9477060Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T08:44:44.9477681Z  """ 2025-12-04T08:44:44.9478142Z  Parse users from the rollout state. 2025-12-04T08:44:44.9478706Z  2025-12-04T08:44:44.9479079Z  """ 2025-12-04T08:44:44.9479686Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:44:44.9480507Z  return parse_user_opt_in_from_text(users_text) 2025-12-04T08:44:44.9481102Z  2025-12-04T08:44:44.9481477Z  2025-12-04T08:44:44.9482149Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:44:44.9483067Z  """ 2025-12-04T08:44:44.9483567Z  Check if a user is opted into an experiment 2025-12-04T08:44:44.9484150Z  """ 2025-12-04T08:44:44.9484684Z  return experiment_name in user_optins.get(user, []) 2025-12-04T08:44:44.9485316Z  2025-12-04T08:44:44.9485877Z  2025-12-04T08:44:44.9486560Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:44:44.9487372Z  """ 2025-12-04T08:44:44.9487903Z  Check if a user explicitly opted out of an experiment 2025-12-04T08:44:44.9488546Z  """ 2025-12-04T08:44:44.9489131Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T08:44:44.9489895Z  experiment_optout = "-" + experiment_name 2025-12-04T08:44:44.9490614Z  if experiment_optout not in user_optins.get(user, []): 2025-12-04T08:44:44.9491266Z  return False 2025-12-04T08:44:44.9491735Z  2025-12-04T08:44:44.9492241Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T08:44:44.9493040Z  log.warning( 2025-12-04T08:44:44.9493960Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T08:44:44.9494886Z  ) 2025-12-04T08:44:44.9495298Z  2025-12-04T08:44:44.9495677Z  return True 2025-12-04T08:44:44.9496121Z  2025-12-04T08:44:44.9496490Z  2025-12-04T08:44:44.9496886Z def get_runner_prefix( 2025-12-04T08:44:44.9497398Z  rollout_state: str, 2025-12-04T08:44:44.9497950Z  workflow_requestors: Iterable[str], 2025-12-04T08:44:44.9498528Z  branch: str, 2025-12-04T08:44:44.9499114Z  eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T08:44:44.9499878Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T08:44:44.9500521Z  is_canary: bool = False, 2025-12-04T08:44:44.9501038Z ) -> str: 2025-12-04T08:44:44.9501534Z  settings = parse_settings(rollout_state) 2025-12-04T08:44:44.9502198Z  user_optins = parse_users(rollout_state) 2025-12-04T08:44:44.9502872Z  2025-12-04T08:44:44.9503389Z  fleet_prefix = "" 2025-12-04T08:44:44.9503900Z  prefixes = [] 2025-12-04T08:44:44.9504626Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T08:44:44.9505665Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T08:44:44.9506438Z  log.info( 2025-12-04T08:44:44.9507237Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T08:44:44.9508053Z  ) 2025-12-04T08:44:44.9508515Z  continue 2025-12-04T08:44:44.9508973Z  2025-12-04T08:44:44.9509380Z  if opt_out_experiments: 2025-12-04T08:44:44.9510003Z  if experiment_name in opt_out_experiments: 2025-12-04T08:44:44.9510721Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T08:44:44.9511391Z  log.info( 2025-12-04T08:44:44.9512415Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T08:44:44.9513557Z  ) 2025-12-04T08:44:44.9514033Z  continue 2025-12-04T08:44:44.9514513Z  2025-12-04T08:44:44.9514930Z  if eligible_experiments: 2025-12-04T08:44:44.9515613Z  if experiment_name not in eligible_experiments: 2025-12-04T08:44:44.9516348Z  exp_list = ", ".join(eligible_experiments) 2025-12-04T08:44:44.9516961Z  log.info( 2025-12-04T08:44:44.9517835Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T08:44:44.9518732Z  ) 2025-12-04T08:44:44.9519333Z  continue 2025-12-04T08:44:44.9519909Z  elif not experiment_settings.default: 2025-12-04T08:44:44.9520490Z  log.info( 2025-12-04T08:44:44.9521240Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T08:44:44.9522033Z  ) 2025-12-04T08:44:44.9522468Z  continue 2025-12-04T08:44:44.9523040Z  2025-12-04T08:44:44.9523557Z  # Is any workflow_requestor opted out to this experiment? 2025-12-04T08:44:44.9524232Z  opted_out_users = [ 2025-12-04T08:44:44.9524751Z  requestor 2025-12-04T08:44:44.9525287Z  for requestor in workflow_requestors 2025-12-04T08:44:44.9526038Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T08:44:44.9526719Z  ] 2025-12-04T08:44:44.9527129Z  2025-12-04T08:44:44.9527532Z  if opted_out_users: 2025-12-04T08:44:44.9528084Z  log.info( 2025-12-04T08:44:44.9528798Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T08:44:44.9529549Z  ) 2025-12-04T08:44:44.9529997Z  continue 2025-12-04T08:44:44.9530457Z  2025-12-04T08:44:44.9530978Z  # Is any workflow_requestor opted in to this experiment? 2025-12-04T08:44:44.9531649Z  opted_in_users = [ 2025-12-04T08:44:44.9532182Z  requestor 2025-12-04T08:44:44.9532812Z  for requestor in workflow_requestors 2025-12-04T08:44:44.9533554Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T08:44:44.9534236Z  ] 2025-12-04T08:44:44.9534648Z  2025-12-04T08:44:44.9535038Z  enabled = False 2025-12-04T08:44:44.9535552Z  if opted_in_users: 2025-12-04T08:44:44.9536193Z  log.info( 2025-12-04T08:44:44.9536903Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T08:44:44.9537640Z  ) 2025-12-04T08:44:44.9538120Z  enabled = True 2025-12-04T08:44:44.9538611Z  2025-12-04T08:44:44.9539072Z  elif experiment_settings.rollout_perc: 2025-12-04T08:44:44.9539982Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T08:44:44.9541016Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T08:44:44.9541723Z  log.info( 2025-12-04T08:44:44.9542791Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T08:44:44.9543781Z  ) 2025-12-04T08:44:44.9544278Z  enabled = True 2025-12-04T08:44:44.9544794Z  2025-12-04T08:44:44.9545174Z  if enabled: 2025-12-04T08:44:44.9545692Z  label = experiment_name 2025-12-04T08:44:44.9546318Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T08:44:44.9547224Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T08:44:44.9548185Z  # - If it's enabled, then we always list it's prefix first 2025-12-04T08:44:44.9549022Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T08:44:44.9549750Z  if is_canary: 2025-12-04T08:44:44.9550320Z  label += CANARY_FLEET_SUFFIX 2025-12-04T08:44:44.9550927Z  fleet_prefix = label 2025-12-04T08:44:44.9551476Z  else: 2025-12-04T08:44:44.9552121Z  prefixes.append(label) 2025-12-04T08:44:44.9552773Z  2025-12-04T08:44:44.9553173Z  if len(prefixes) > 1: 2025-12-04T08:44:44.9553696Z  log.error( 2025-12-04T08:44:44.9554841Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-12-04T08:44:44.9556026Z  ) 2025-12-04T08:44:44.9556478Z  prefixes = prefixes[:1] 2025-12-04T08:44:44.9556998Z  2025-12-04T08:44:44.9557405Z  # Fleet always comes first 2025-12-04T08:44:44.9557940Z  if fleet_prefix: 2025-12-04T08:44:44.9558475Z  prefixes.insert(0, fleet_prefix) 2025-12-04T08:44:44.9559028Z  2025-12-04T08:44:44.9559529Z  return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T08:44:44.9560146Z  2025-12-04T08:44:44.9560529Z  2025-12-04T08:44:44.9561224Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T08:44:44.9562052Z  """ 2025-12-04T08:44:44.9562803Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T08:44:44.9563558Z  2025-12-04T08:44:44.9564189Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T08:44:44.9564941Z  """ 2025-12-04T08:44:44.9565399Z  gh = get_gh_client(github_token) 2025-12-04T08:44:44.9566015Z  issue = get_issue(gh, repo, issue_num) 2025-12-04T08:44:44.9566730Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T08:44:44.9567385Z  2025-12-04T08:44:44.9567759Z  2025-12-04T08:44:44.9568416Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T08:44:44.9569373Z  for _ in range(num_retries): 2025-12-04T08:44:44.9569929Z  try: 2025-12-04T08:44:44.9570451Z  req = Request(url=url, headers=headers) 2025-12-04T08:44:44.9571178Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T08:44:44.9571887Z  return json.loads(content) 2025-12-04T08:44:44.9572464Z  except Exception as e: 2025-12-04T08:44:44.9573201Z  log.warning(f"Could not download {url}: {e}") 2025-12-04T08:44:44.9573800Z  2025-12-04T08:44:44.9574441Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T08:44:44.9575298Z  return {} 2025-12-04T08:44:44.9575726Z  2025-12-04T08:44:44.9576104Z  2025-12-04T08:44:44.9576475Z @cache 2025-12-04T08:44:44.9577180Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T08:44:44.9578003Z  """ 2025-12-04T08:44:44.9578465Z  Dynamically get PR information 2025-12-04T08:44:44.9579009Z  """ 2025-12-04T08:44:44.9579580Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T08:44:44.9580277Z  headers = { 2025-12-04T08:44:44.9580825Z  "Accept": "application/vnd.github.v3+json", 2025-12-04T08:44:44.9581512Z  "Authorization": f"token {github_token}", 2025-12-04T08:44:44.9582089Z  } 2025-12-04T08:44:44.9582590Z  json_response: dict[str, Any] = download_json( 2025-12-04T08:44:44.9583365Z  url=f"{github_api}/issues/{pr_number}", 2025-12-04T08:44:44.9583967Z  headers=headers, 2025-12-04T08:44:44.9584466Z  ) 2025-12-04T08:44:44.9584859Z  2025-12-04T08:44:44.9585264Z  if not json_response: 2025-12-04T08:44:44.9585926Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T08:44:44.9586761Z  return {} 2025-12-04T08:44:44.9587210Z  2025-12-04T08:44:44.9587617Z  return json_response 2025-12-04T08:44:44.9588105Z  2025-12-04T08:44:44.9588483Z  2025-12-04T08:44:44.9589131Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T08:44:44.9589910Z  """ 2025-12-04T08:44:44.9590512Z  Dynamically get the latest list of labels from the pull request 2025-12-04T08:44:44.9591205Z  """ 2025-12-04T08:44:44.9591759Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T08:44:44.9592425Z  return { 2025-12-04T08:44:44.9593195Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T08:44:44.9593959Z  } 2025-12-04T08:44:44.9594359Z  2025-12-04T08:44:44.9594738Z  2025-12-04T08:44:44.9595132Z def main() -> None: 2025-12-04T08:44:44.9595631Z  args = parse_args() 2025-12-04T08:44:44.9596122Z  2025-12-04T08:44:44.9596592Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T08:44:44.9597172Z  2025-12-04T08:44:44.9597587Z  # Check if the PR is opt-out 2025-12-04T08:44:44.9598141Z  if args.pr_number: 2025-12-04T08:44:44.9598897Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T08:44:44.9599722Z  if OPT_OUT_LABEL in labels: 2025-12-04T08:44:44.9600278Z  log.info( 2025-12-04T08:44:44.9601072Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T08:44:44.9601890Z  ) 2025-12-04T08:44:44.9602540Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:44:44.9603381Z  sys.exit() 2025-12-04T08:44:44.9603977Z  2025-12-04T08:44:44.9604367Z  try: 2025-12-04T08:44:44.9604878Z  rollout_state = get_rollout_state_from_issue( 2025-12-04T08:44:44.9605682Z  args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T08:44:44.9606386Z  ) 2025-12-04T08:44:44.9606802Z  2025-12-04T08:44:44.9607243Z  username = get_potential_pr_author( 2025-12-04T08:44:44.9607850Z  args.github_token, 2025-12-04T08:44:44.9608395Z  args.github_repo, 2025-12-04T08:44:44.9608933Z  args.github_actor, 2025-12-04T08:44:44.9609492Z  args.github_ref_type, 2025-12-04T08:44:44.9610053Z  args.github_branch, 2025-12-04T08:44:44.9610571Z  ) 2025-12-04T08:44:44.9610973Z  2025-12-04T08:44:44.9611505Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T08:44:44.9612169Z  2025-12-04T08:44:44.9612624Z  runner_label_prefix = get_runner_prefix( 2025-12-04T08:44:44.9613337Z  rollout_state, 2025-12-04T08:44:44.9613908Z  (args.github_issue_owner, username), 2025-12-04T08:44:44.9614507Z  args.github_branch, 2025-12-04T08:44:44.9615073Z  args.eligible_experiments, 2025-12-04T08:44:44.9615698Z  args.opt_out_experiments, 2025-12-04T08:44:44.9616250Z  is_canary, 2025-12-04T08:44:44.9616734Z  ) 2025-12-04T08:44:44.9617139Z  2025-12-04T08:44:44.9617538Z  except Exception as e: 2025-12-04T08:44:44.9618060Z  log.error( 2025-12-04T08:44:44.9618839Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T08:44:44.9619786Z  ) 2025-12-04T08:44:44.9620206Z  2025-12-04T08:44:44.9620792Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:44:44.9621502Z  2025-12-04T08:44:44.9621876Z  2025-12-04T08:44:44.9622270Z if __name__ == "__main__": 2025-12-04T08:44:44.9622873Z  main() 2025-12-04T08:44:44.9623300Z  2025-12-04T08:44:44.9623666Z EOF 2025-12-04T08:44:44.9624055Z  2025-12-04T08:44:44.9624458Z cat runner_determinator.py 2025-12-04T08:44:45.0289915Z shell: /usr/bin/bash -e {0} 2025-12-04T08:44:45.0290913Z env: 2025-12-04T08:44:45.0291814Z GITHUB_TOKEN: *** 2025-12-04T08:44:45.0292339Z ISSUE_NUMBER: 5132 2025-12-04T08:44:45.0293051Z TRIGGERING_ACTOR: seemethere 2025-12-04T08:44:45.0293641Z ISSUE_OWNER: 2025-12-04T08:44:45.0294139Z CHECK_EXPERIMENTS: 2025-12-04T08:44:45.0294694Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:44:45.0295224Z PR_NUMBER: 2025-12-04T08:44:45.0295733Z ##[endgroup] 2025-12-04T08:44:45.0516302Z # flake8: noqa: G004 2025-12-04T08:44:45.0516659Z 2025-12-04T08:44:45.0517102Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T08:44:45.0518075Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T08:44:45.0518881Z # python .github/scripts/update_runner_determinator.py 2025-12-04T08:44:45.0519328Z 2025-12-04T08:44:45.0519489Z """ 2025-12-04T08:44:45.0520071Z This runner determinator is used to determine which set of runners to run a 2025-12-04T08:44:45.0520958Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T08:44:45.0521889Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T08:44:45.0522953Z of which runners should be used to run which job. 2025-12-04T08:44:45.0523388Z 2025-12-04T08:44:45.0523777Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T08:44:45.0524912Z separated by a line containing "---". If the line is not present, the 2025-12-04T08:44:45.0525832Z settings are considered to be empty with only the second part, the user 2025-12-04T08:44:45.0526542Z list, defined. 2025-12-04T08:44:45.0526771Z 2025-12-04T08:44:45.0527142Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T08:44:45.0528093Z used to define any settings that are needed to determine which runners to use. 2025-12-04T08:44:45.0528926Z It's fields are defined by the RolloutSettings class below. 2025-12-04T08:44:45.0529375Z 2025-12-04T08:44:45.0529744Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T08:44:45.0530634Z The user list is also a comma separated list of additional features or 2025-12-04T08:44:45.0531368Z experiments which the user could be opted in to. 2025-12-04T08:44:45.0531767Z 2025-12-04T08:44:45.0531973Z The user list has the following rules: 2025-12-04T08:44:45.0532317Z 2025-12-04T08:44:45.0532876Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T08:44:45.0533813Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T08:44:45.0534582Z - A "#" prefix opts the user out of all experiments 2025-12-04T08:44:45.0534973Z 2025-12-04T08:44:45.0535147Z Example config: 2025-12-04T08:44:45.0535610Z # A list of experiments that can be opted into. 2025-12-04T08:44:45.0536280Z # This defines the behavior they'll induce when opted into. 2025-12-04T08:44:45.0536920Z # Expected syntax is: 2025-12-04T08:44:45.0537569Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T08:44:45.0538566Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T08:44:45.0539184Z 2025-12-04T08:44:45.0539364Z experiments: 2025-12-04T08:44:45.0539757Z lf: 2025-12-04T08:44:45.0540149Z rollout_percent: 25 2025-12-04T08:44:45.0540789Z all_branches: false 2025-12-04T08:44:45.0541250Z default: true 2025-12-04T08:44:45.0541667Z --- 2025-12-04T08:44:45.0541882Z 2025-12-04T08:44:45.0542088Z # Opt-ins: 2025-12-04T08:44:45.0542899Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T08:44:45.0543826Z # and specifying experiments to enable in a comma-separated list. 2025-12-04T08:44:45.0544618Z # To always opt out of an experiment, prefix it with a "-". 2025-12-04T08:44:45.0545296Z # Experiments should be from the above list. 2025-12-04T08:44:45.0545687Z 2025-12-04T08:44:45.0545876Z @User1,-lf,split_build 2025-12-04T08:44:45.0546324Z @User2,lf 2025-12-04T08:44:45.0546722Z @User3,split_build 2025-12-04T08:44:45.0547134Z """ 2025-12-04T08:44:45.0547338Z 2025-12-04T08:44:45.0547502Z import json 2025-12-04T08:44:45.0547873Z import logging 2025-12-04T08:44:45.0548261Z import os 2025-12-04T08:44:45.0548628Z import random 2025-12-04T08:44:45.0549010Z import re 2025-12-04T08:44:45.0549380Z import sys 2025-12-04T08:44:45.0549792Z from argparse import ArgumentParser 2025-12-04T08:44:45.0550328Z from collections.abc import Iterable 2025-12-04T08:44:45.0550845Z from functools import cache 2025-12-04T08:44:45.0551319Z from logging import LogRecord 2025-12-04T08:44:45.0551809Z from typing import Any, NamedTuple 2025-12-04T08:44:45.0552352Z from urllib.request import Request, urlopen 2025-12-04T08:44:45.0552937Z 2025-12-04T08:44:45.0553114Z import yaml 2025-12-04T08:44:45.0553524Z from github import Auth, Github 2025-12-04T08:44:45.0554016Z from github.Issue import Issue 2025-12-04T08:44:45.0554329Z 2025-12-04T08:44:45.0554336Z 2025-12-04T08:44:45.0554555Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T08:44:45.0555257Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T08:44:45.0556139Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T08:44:45.0556702Z 2025-12-04T08:44:45.0556940Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T08:44:45.0557725Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T08:44:45.0558274Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T08:44:45.0558831Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T08:44:45.0559188Z 2025-12-04T08:44:45.0559389Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T08:44:45.0559724Z 2025-12-04T08:44:45.0559918Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T08:44:45.0560380Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T08:44:45.0560658Z 2025-12-04T08:44:45.0560672Z 2025-12-04T08:44:45.0560864Z class Experiment(NamedTuple): 2025-12-04T08:44:45.0561352Z rollout_perc: float = ( 2025-12-04T08:44:45.0561994Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T08:44:45.0562928Z ) 2025-12-04T08:44:45.0563339Z all_branches: bool = ( 2025-12-04T08:44:45.0563997Z False # If True, the experiment is also enabled on the exception branches 2025-12-04T08:44:45.0564675Z ) 2025-12-04T08:44:45.0565053Z default: bool = ( 2025-12-04T08:44:45.0565641Z True # If True, the experiment is enabled by default for all queries 2025-12-04T08:44:45.0566307Z ) 2025-12-04T08:44:45.0566510Z 2025-12-04T08:44:45.0566698Z # Add more fields as needed 2025-12-04T08:44:45.0567012Z 2025-12-04T08:44:45.0567018Z 2025-12-04T08:44:45.0567205Z class Settings(NamedTuple): 2025-12-04T08:44:45.0567660Z """ 2025-12-04T08:44:45.0568121Z Settings for the experiments that can be opted into. 2025-12-04T08:44:45.0568719Z """ 2025-12-04T08:44:45.0568920Z 2025-12-04T08:44:45.0569129Z experiments: dict[str, Experiment] = {} 2025-12-04T08:44:45.0569496Z 2025-12-04T08:44:45.0569511Z 2025-12-04T08:44:45.0569722Z class ColorFormatter(logging.Formatter): 2025-12-04T08:44:45.0570353Z """Color codes the log messages based on the log level""" 2025-12-04T08:44:45.0570802Z 2025-12-04T08:44:45.0570973Z COLORS = { 2025-12-04T08:44:45.0571382Z "WARNING": "\033[33m", # Yellow 2025-12-04T08:44:45.0572108Z "ERROR": "\033[31m", # Red 2025-12-04T08:44:45.0572627Z "CRITICAL": "\033[31m", # Red 2025-12-04T08:44:45.0573408Z "INFO": "\033[0m", # Reset 2025-12-04T08:44:45.0573910Z "DEBUG": "\033[0m", # Reset 2025-12-04T08:44:45.0574383Z } 2025-12-04T08:44:45.0574584Z 2025-12-04T08:44:45.0574929Z def format(self, record: LogRecord) -> str: 2025-12-04T08:44:45.0575699Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T08:44:45.0576482Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T08:44:45.0577072Z return super().format(record) 2025-12-04T08:44:45.0577406Z 2025-12-04T08:44:45.0577413Z 2025-12-04T08:44:45.0577612Z handler = logging.StreamHandler() 2025-12-04T08:44:45.0578325Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T08:44:45.0578885Z 2025-12-04T08:44:45.0579136Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T08:44:45.0579727Z log.addHandler(handler) 2025-12-04T08:44:45.0580194Z log.setLevel(logging.INFO) 2025-12-04T08:44:45.0580485Z 2025-12-04T08:44:45.0580492Z 2025-12-04T08:44:45.0580763Z def set_github_output(key: str, value: str) -> None: 2025-12-04T08:44:45.0581333Z """ 2025-12-04T08:44:45.0581835Z Defines outputs of the github action that invokes this script 2025-12-04T08:44:45.0582479Z """ 2025-12-04T08:44:45.0583089Z if not GITHUB_OUTPUT: 2025-12-04T08:44:45.0584180Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T08:44:45.0585316Z log.warning( 2025-12-04T08:44:45.0586184Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T08:44:45.0587140Z ) 2025-12-04T08:44:45.0598115Z print(f"::set-output name={key}::{value}") 2025-12-04T08:44:45.0598745Z return 2025-12-04T08:44:45.0598980Z 2025-12-04T08:44:45.0599407Z with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T08:44:45.0600020Z log.info(f"Setting output: {key}='{value}'") 2025-12-04T08:44:45.0600602Z f.write(f"{key}={value}\n") 2025-12-04T08:44:45.0600998Z 2025-12-04T08:44:45.0601006Z 2025-12-04T08:44:45.0601328Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T08:44:45.0601978Z return frozenset( 2025-12-04T08:44:45.0602599Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T08:44:45.0603543Z ) 2025-12-04T08:44:45.0603747Z 2025-12-04T08:44:45.0603753Z 2025-12-04T08:44:45.0603948Z def parse_args() -> Any: 2025-12-04T08:44:45.0604524Z parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T08:44:45.0605387Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T08:44:45.0606179Z parser.add_argument( 2025-12-04T08:44:45.0606659Z "--github-issue-repo", 2025-12-04T08:44:45.0607136Z type=str, 2025-12-04T08:44:45.0607560Z required=False, 2025-12-04T08:44:45.0608013Z default="pytorch/test-infra", 2025-12-04T08:44:45.0608570Z help="GitHub repo to get the issue", 2025-12-04T08:44:45.0609090Z ) 2025-12-04T08:44:45.0609469Z parser.add_argument( 2025-12-04T08:44:45.0609925Z "--github-repo", 2025-12-04T08:44:45.0610376Z type=str, 2025-12-04T08:44:45.0610780Z required=True, 2025-12-04T08:44:45.0611266Z help="GitHub repo where CI is running", 2025-12-04T08:44:45.0611799Z ) 2025-12-04T08:44:45.0612180Z parser.add_argument( 2025-12-04T08:44:45.0612905Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T08:44:45.0613575Z ) 2025-12-04T08:44:45.0613949Z parser.add_argument( 2025-12-04T08:44:45.0614566Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T08:44:45.0615256Z ) 2025-12-04T08:44:45.0615624Z parser.add_argument( 2025-12-04T08:44:45.0616434Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T08:44:45.0617135Z ) 2025-12-04T08:44:45.0617519Z parser.add_argument( 2025-12-04T08:44:45.0618182Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T08:44:45.0618907Z ) 2025-12-04T08:44:45.0619287Z parser.add_argument( 2025-12-04T08:44:45.0619746Z "--github-ref-type", 2025-12-04T08:44:45.0620210Z type=str, 2025-12-04T08:44:45.0620614Z required=True, 2025-12-04T08:44:45.0621111Z help="Current GitHub ref type, branch or tag", 2025-12-04T08:44:45.0621660Z ) 2025-12-04T08:44:45.0622043Z parser.add_argument( 2025-12-04T08:44:45.0622500Z "--eligible-experiments", 2025-12-04T08:44:45.0623284Z type=_str_comma_separated_to_set, 2025-12-04T08:44:45.0623811Z required=False, 2025-12-04T08:44:45.0624241Z default="", 2025-12-04T08:44:45.0675254Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T08:44:45.0676345Z ) 2025-12-04T08:44:45.0676741Z parser.add_argument( 2025-12-04T08:44:45.0677214Z "--opt-out-experiments", 2025-12-04T08:44:45.0677730Z type=_str_comma_separated_to_set, 2025-12-04T08:44:45.0678256Z required=False, 2025-12-04T08:44:45.0678679Z default="", 2025-12-04T08:44:45.0679077Z help=( 2025-12-04T08:44:45.0679762Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T08:44:45.0680931Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T08:44:45.0681769Z ), 2025-12-04T08:44:45.0682131Z ) 2025-12-04T08:44:45.0682497Z parser.add_argument( 2025-12-04T08:44:45.0683075Z "--pr-number", 2025-12-04T08:44:45.0683505Z type=str, 2025-12-04T08:44:45.0683905Z required=False, 2025-12-04T08:44:45.0684340Z default="", 2025-12-04T08:44:45.0684998Z help="the optional PR number where this is run", 2025-12-04T08:44:45.0685594Z ) 2025-12-04T08:44:45.0685798Z 2025-12-04T08:44:45.0685992Z return parser.parse_args() 2025-12-04T08:44:45.0686310Z 2025-12-04T08:44:45.0686316Z 2025-12-04T08:44:45.0686724Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T08:44:45.0687492Z auth = Auth.Token(github_token) 2025-12-04T08:44:45.0688006Z return Github(auth=auth) 2025-12-04T08:44:45.0688305Z 2025-12-04T08:44:45.0688311Z 2025-12-04T08:44:45.0688777Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T08:44:45.0689592Z repo = gh.get_repo(repo) 2025-12-04T08:44:45.0690100Z return repo.get_issue(number=issue_num) 2025-12-04T08:44:45.0690478Z 2025-12-04T08:44:45.0690485Z 2025-12-04T08:44:45.0690674Z def get_potential_pr_author( 2025-12-04T08:44:45.0691331Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T08:44:45.0692022Z ) -> str: 2025-12-04T08:44:45.0692538Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T08:44:45.0693491Z # Fetch the actual username from the original PR. The PR number is 2025-12-04T08:44:45.0694236Z # embedded in the tag name: ciflow// 2025-12-04T08:44:45.0694659Z 2025-12-04T08:44:45.0694853Z gh = get_gh_client(github_token) 2025-12-04T08:44:45.0695185Z 2025-12-04T08:44:45.0695453Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T08:44:45.0696086Z split_tag = ref_name.split("/") 2025-12-04T08:44:45.0696593Z if ( 2025-12-04T08:44:45.0696984Z len(split_tag) == 3 2025-12-04T08:44:45.0697473Z and split_tag[0] == "ciflow" 2025-12-04T08:44:45.0697996Z and split_tag[2].isnumeric() 2025-12-04T08:44:45.0698494Z ): 2025-12-04T08:44:45.0698883Z pr_number = split_tag[2] 2025-12-04T08:44:45.0699519Z try: 2025-12-04T08:44:45.0699954Z repository = gh.get_repo(repo) 2025-12-04T08:44:45.0700571Z pull = repository.get_pull(number=int(pr_number)) 2025-12-04T08:44:45.0701213Z except Exception as e: 2025-12-04T08:44:45.0702059Z raise Exception( # noqa: TRY002 2025-12-04T08:44:45.0702877Z f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T08:44:45.0703540Z ) from e 2025-12-04T08:44:45.0704095Z return pull.user.login # type: ignore[no-any-return] 2025-12-04T08:44:45.0704800Z # In all other cases, return the original input username 2025-12-04T08:44:45.0705396Z return username 2025-12-04T08:44:45.0705638Z 2025-12-04T08:44:45.0705645Z 2025-12-04T08:44:45.0705877Z def is_exception_branch(branch: str) -> bool: 2025-12-04T08:44:45.0706416Z """ 2025-12-04T08:44:45.0707071Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T08:44:45.0707865Z """ 2025-12-04T08:44:45.0708428Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T08:44:45.0708945Z 2025-12-04T08:44:45.0708952Z 2025-12-04T08:44:45.0709149Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T08:44:45.0709648Z try: 2025-12-04T08:44:45.0710034Z data = yaml.safe_load(yaml_text) 2025-12-04T08:44:45.0710547Z return data 2025-12-04T08:44:45.0710961Z except yaml.YAMLError: 2025-12-04T08:44:45.0711447Z log.exception("Error loading YAML") 2025-12-04T08:44:45.0711965Z raise 2025-12-04T08:44:45.0712186Z 2025-12-04T08:44:45.0712192Z 2025-12-04T08:44:45.0712626Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T08:44:45.0713487Z """ 2025-12-04T08:44:45.0714110Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T08:44:45.0714722Z 2025-12-04T08:44:45.0715236Z If the issue body contains "---" then the text above that is the settings 2025-12-04T08:44:45.0716037Z and the text below is the list of opted in users. 2025-12-04T08:44:45.0716448Z 2025-12-04T08:44:45.0716826Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T08:44:45.0717534Z """ 2025-12-04T08:44:45.0717980Z rollout_state_parts = rollout_state.split("---") 2025-12-04T08:44:45.0718610Z if len(rollout_state_parts) >= 2: 2025-12-04T08:44:45.0719212Z return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T08:44:45.0719809Z else: 2025-12-04T08:44:45.0720189Z return "", rollout_state 2025-12-04T08:44:45.0720517Z 2025-12-04T08:44:45.0720524Z 2025-12-04T08:44:45.0720728Z class UserOptins(dict[str, list[str]]): 2025-12-04T08:44:45.0721246Z """ 2025-12-04T08:44:45.0721759Z Dictionary of users with a list of features they have opted into 2025-12-04T08:44:45.0722414Z """ 2025-12-04T08:44:45.0722613Z 2025-12-04T08:44:45.0722628Z 2025-12-04T08:44:45.0723094Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T08:44:45.0723767Z """ 2025-12-04T08:44:45.0724476Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-12-04T08:44:45.0725168Z 2025-12-04T08:44:45.0725810Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T08:44:45.0726815Z - Example line: "@User1,lf,split_build" 2025-12-04T08:44:45.0727497Z - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T08:44:45.0727981Z 2025-12-04T08:44:45.0727988Z 2025-12-04T08:44:45.0728147Z """ 2025-12-04T08:44:45.0728522Z optins = UserOptins() 2025-12-04T08:44:45.0729017Z for user in user_optin_text.split("\n"): 2025-12-04T08:44:45.0729577Z user = user.strip("\r\n\t -") 2025-12-04T08:44:45.0730119Z if not user or not user.startswith("@"): 2025-12-04T08:44:45.0730837Z # Not a valid user. Skip 2025-12-04T08:44:45.0731323Z continue 2025-12-04T08:44:45.0731577Z 2025-12-04T08:44:45.0731739Z if user: 2025-12-04T08:44:45.0732178Z usr_name = user.split(",")[0].strip("@") 2025-12-04T08:44:45.0732985Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T08:44:45.0733483Z 2025-12-04T08:44:45.0733653Z return optins 2025-12-04T08:44:45.0733899Z 2025-12-04T08:44:45.0733906Z 2025-12-04T08:44:45.0734187Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T08:44:45.0734799Z """ 2025-12-04T08:44:45.0735191Z Check if the experiment name is valid. 2025-12-04T08:44:45.0735713Z A valid name: 2025-12-04T08:44:45.0736338Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T08:44:45.0737306Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T08:44:45.0738035Z - Cannot contain spaces 2025-12-04T08:44:45.0738508Z """ 2025-12-04T08:44:45.0738708Z 2025-12-04T08:44:45.0738979Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T08:44:45.0739680Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T08:44:45.0740124Z 2025-12-04T08:44:45.0740296Z if valid: 2025-12-04T08:44:45.0740672Z return True 2025-12-04T08:44:45.0740917Z 2025-12-04T08:44:45.0741083Z log.error( 2025-12-04T08:44:45.0742551Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-12-04T08:44:45.0744656Z ) 2025-12-04T08:44:45.0745031Z return False 2025-12-04T08:44:45.0745267Z 2025-12-04T08:44:45.0745273Z 2025-12-04T08:44:45.0745580Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T08:44:45.0746206Z """ 2025-12-04T08:44:45.0746935Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T08:44:45.0747688Z """ 2025-12-04T08:44:45.0748056Z try: 2025-12-04T08:44:45.0748435Z if settings_text: 2025-12-04T08:44:45.0749169Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T08:44:45.0749966Z # for easy reading 2025-12-04T08:44:45.0750762Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T08:44:45.0751657Z # the backtick character in shell commands. 2025-12-04T08:44:45.0752267Z backtick = chr(96) # backtick character 2025-12-04T08:44:45.0753051Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T08:44:45.0753731Z settings = load_yaml(settings_text) 2025-12-04T08:44:45.0754110Z 2025-12-04T08:44:45.0754531Z # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T08:44:45.0755315Z experiments = {} 2025-12-04T08:44:45.0755613Z 2025-12-04T08:44:45.0756008Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T08:44:45.0756782Z if not is_valid_experiment_name(exp_name): 2025-12-04T08:44:45.0757900Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-12-04T08:44:45.0758942Z continue 2025-12-04T08:44:45.0759228Z 2025-12-04T08:44:45.0759414Z valid_settings = {} 2025-12-04T08:44:45.0759942Z for setting in exp_settings: 2025-12-04T08:44:45.0760523Z if setting not in Experiment._fields: 2025-12-04T08:44:45.0761081Z log.warning( 2025-12-04T08:44:45.0761787Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T08:44:45.0762769Z ) 2025-12-04T08:44:45.0763212Z else: 2025-12-04T08:44:45.0763740Z valid_settings[setting] = exp_settings[setting] 2025-12-04T08:44:45.0764169Z 2025-12-04T08:44:45.0764459Z experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T08:44:45.0765099Z return Settings(experiments) 2025-12-04T08:44:45.0765458Z 2025-12-04T08:44:45.0765633Z except Exception: 2025-12-04T08:44:45.0766112Z log.exception("Failed to parse settings") 2025-12-04T08:44:45.0766505Z 2025-12-04T08:44:45.0766677Z return Settings() 2025-12-04T08:44:45.0766938Z 2025-12-04T08:44:45.0766945Z 2025-12-04T08:44:45.0767204Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T08:44:45.0767770Z """ 2025-12-04T08:44:45.0768219Z Parse settings, if any, from the rollout state. 2025-12-04T08:44:45.0768619Z 2025-12-04T08:44:45.0768966Z If the issue body contains "---" then the text above that is the settings 2025-12-04T08:44:45.0769746Z and the text below is the list of opted in users. 2025-12-04T08:44:45.0770153Z 2025-12-04T08:44:45.0770566Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T08:44:45.0771312Z """ 2025-12-04T08:44:45.0771871Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:44:45.0772630Z return parse_settings_from_text(settings_text) 2025-12-04T08:44:45.0773205Z 2025-12-04T08:44:45.0773212Z 2025-12-04T08:44:45.0773470Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T08:44:45.0774029Z """ 2025-12-04T08:44:45.0774419Z Parse users from the rollout state. 2025-12-04T08:44:45.0774767Z 2025-12-04T08:44:45.0774925Z """ 2025-12-04T08:44:45.0775460Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:44:45.0776215Z return parse_user_opt_in_from_text(users_text) 2025-12-04T08:44:45.0776623Z 2025-12-04T08:44:45.0776629Z 2025-12-04T08:44:45.0777215Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:44:45.0777981Z """ 2025-12-04T08:44:45.0778391Z Check if a user is opted into an experiment 2025-12-04T08:44:45.0778935Z """ 2025-12-04T08:44:45.0779384Z return experiment_name in user_optins.get(user, []) 2025-12-04T08:44:45.0779811Z 2025-12-04T08:44:45.0779818Z 2025-12-04T08:44:45.0780244Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:44:45.0780995Z """ 2025-12-04T08:44:45.0781451Z Check if a user explicitly opted out of an experiment 2025-12-04T08:44:45.0782041Z """ 2025-12-04T08:44:45.0782544Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T08:44:45.0783396Z experiment_optout = "-" + experiment_name 2025-12-04T08:44:45.0784041Z if experiment_optout not in user_optins.get(user, []): 2025-12-04T08:44:45.0784654Z return False 2025-12-04T08:44:45.0784919Z 2025-12-04T08:44:45.0785203Z if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T08:44:45.0785801Z log.warning( 2025-12-04T08:44:45.0786610Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T08:44:45.0787496Z ) 2025-12-04T08:44:45.0787714Z 2025-12-04T08:44:45.0787885Z return True 2025-12-04T08:44:45.0788117Z 2025-12-04T08:44:45.0788124Z 2025-12-04T08:44:45.0788302Z def get_runner_prefix( 2025-12-04T08:44:45.0788737Z rollout_state: str, 2025-12-04T08:44:45.0789203Z workflow_requestors: Iterable[str], 2025-12-04T08:44:45.0789726Z branch: str, 2025-12-04T08:44:45.0790216Z eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T08:44:45.0790875Z opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T08:44:45.0791468Z is_canary: bool = False, 2025-12-04T08:44:45.0791924Z ) -> str: 2025-12-04T08:44:45.0792495Z settings = parse_settings(rollout_state) 2025-12-04T08:44:45.0793202Z user_optins = parse_users(rollout_state) 2025-12-04T08:44:45.0793582Z 2025-12-04T08:44:45.0793755Z fleet_prefix = "" 2025-12-04T08:44:45.0794181Z prefixes = [] 2025-12-04T08:44:45.0794818Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T08:44:45.0795770Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T08:44:45.0796485Z log.info( 2025-12-04T08:44:45.0797166Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T08:44:45.0797930Z ) 2025-12-04T08:44:45.0798322Z continue 2025-12-04T08:44:45.0798576Z 2025-12-04T08:44:45.0798765Z if opt_out_experiments: 2025-12-04T08:44:45.0799308Z if experiment_name in opt_out_experiments: 2025-12-04T08:44:45.0799959Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T08:44:45.0800560Z log.info( 2025-12-04T08:44:45.0801539Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T08:44:45.0802516Z ) 2025-12-04T08:44:45.0803018Z continue 2025-12-04T08:44:45.0803286Z 2025-12-04T08:44:45.0803479Z if eligible_experiments: 2025-12-04T08:44:45.0804078Z if experiment_name not in eligible_experiments: 2025-12-04T08:44:45.0804713Z exp_list = ", ".join(eligible_experiments) 2025-12-04T08:44:45.0805274Z log.info( 2025-12-04T08:44:45.0806065Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T08:44:45.0806906Z ) 2025-12-04T08:44:45.0807307Z continue 2025-12-04T08:44:45.0807784Z elif not experiment_settings.default: 2025-12-04T08:44:45.0808325Z log.info( 2025-12-04T08:44:45.0809123Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T08:44:45.0809882Z ) 2025-12-04T08:44:45.0810272Z continue 2025-12-04T08:44:45.0810525Z 2025-12-04T08:44:45.0810805Z # Is any workflow_requestor opted out to this experiment? 2025-12-04T08:44:45.0811436Z opted_out_users = [ 2025-12-04T08:44:45.0811882Z requestor 2025-12-04T08:44:45.0812347Z for requestor in workflow_requestors 2025-12-04T08:44:45.0813124Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T08:44:45.0813765Z ] 2025-12-04T08:44:45.0813974Z 2025-12-04T08:44:45.0814164Z if opted_out_users: 2025-12-04T08:44:45.0814614Z log.info( 2025-12-04T08:44:45.0815232Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T08:44:45.0815922Z ) 2025-12-04T08:44:45.0816310Z continue 2025-12-04T08:44:45.0816564Z 2025-12-04T08:44:45.0816850Z # Is any workflow_requestor opted in to this experiment? 2025-12-04T08:44:45.0817497Z opted_in_users = [ 2025-12-04T08:44:45.0817941Z requestor 2025-12-04T08:44:45.0818401Z for requestor in workflow_requestors 2025-12-04T08:44:45.0819074Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T08:44:45.0819700Z ] 2025-12-04T08:44:45.0819910Z 2025-12-04T08:44:45.0820086Z enabled = False 2025-12-04T08:44:45.0820534Z if opted_in_users: 2025-12-04T08:44:45.0820981Z log.info( 2025-12-04T08:44:45.0821583Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T08:44:45.0822278Z ) 2025-12-04T08:44:45.0822763Z enabled = True 2025-12-04T08:44:45.0823055Z 2025-12-04T08:44:45.0823274Z elif experiment_settings.rollout_perc: 2025-12-04T08:44:45.0824127Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T08:44:45.0825209Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T08:44:45.0825866Z log.info( 2025-12-04T08:44:45.0826731Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T08:44:45.0827665Z ) 2025-12-04T08:44:45.0828072Z enabled = True 2025-12-04T08:44:45.0828375Z 2025-12-04T08:44:45.0828541Z if enabled: 2025-12-04T08:44:45.0828968Z label = experiment_name 2025-12-04T08:44:45.0829518Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T08:44:45.0830362Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T08:44:45.0831261Z # - If it's enabled, then we always list it's prefix first 2025-12-04T08:44:45.0832032Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T08:44:45.0832817Z if is_canary: 2025-12-04T08:44:45.0833332Z label += CANARY_FLEET_SUFFIX 2025-12-04T08:44:45.0833886Z fleet_prefix = label 2025-12-04T08:44:45.0834382Z else: 2025-12-04T08:44:45.0834823Z prefixes.append(label) 2025-12-04T08:44:45.0835173Z 2025-12-04T08:44:45.0835356Z if len(prefixes) > 1: 2025-12-04T08:44:45.0835807Z log.error( 2025-12-04T08:44:45.0836857Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-12-04T08:44:45.0838004Z ) 2025-12-04T08:44:45.0838395Z prefixes = prefixes[:1] 2025-12-04T08:44:45.0838711Z 2025-12-04T08:44:45.0838904Z # Fleet always comes first 2025-12-04T08:44:45.0839379Z if fleet_prefix: 2025-12-04T08:44:45.0839829Z prefixes.insert(0, fleet_prefix) 2025-12-04T08:44:45.0840195Z 2025-12-04T08:44:45.0840576Z return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T08:44:45.0840999Z 2025-12-04T08:44:45.0841007Z 2025-12-04T08:44:45.0841452Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T08:44:45.0842235Z """ 2025-12-04T08:44:45.0842928Z Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T08:44:45.0843500Z 2025-12-04T08:44:45.0843892Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T08:44:45.0844607Z """ 2025-12-04T08:44:45.0844998Z gh = get_gh_client(github_token) 2025-12-04T08:44:45.0845544Z issue = get_issue(gh, repo, issue_num) 2025-12-04T08:44:45.0846179Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T08:44:45.0846636Z 2025-12-04T08:44:45.0846643Z 2025-12-04T08:44:45.0847046Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T08:44:45.0847823Z for _ in range(num_retries): 2025-12-04T08:44:45.0848303Z try: 2025-12-04T08:44:45.0848741Z req = Request(url=url, headers=headers) 2025-12-04T08:44:45.0849403Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T08:44:45.0850056Z return json.loads(content) 2025-12-04T08:44:45.0850581Z except Exception as e: 2025-12-04T08:44:45.0851131Z log.warning(f"Could not download {url}: {e}") 2025-12-04T08:44:45.0851534Z 2025-12-04T08:44:45.0851911Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T08:44:45.0852626Z return {} 2025-12-04T08:44:45.0852952Z 2025-12-04T08:44:45.0852958Z 2025-12-04T08:44:45.0853125Z @cache 2025-12-04T08:44:45.0853744Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T08:44:45.0854506Z """ 2025-12-04T08:44:45.0854897Z Dynamically get PR information 2025-12-04T08:44:45.0855391Z """ 2025-12-04T08:44:45.0856037Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T08:44:45.0856671Z headers = { 2025-12-04T08:44:45.0857133Z "Accept": "application/vnd.github.v3+json", 2025-12-04T08:44:45.0857747Z "Authorization": f"token {github_token}", 2025-12-04T08:44:45.0858293Z } 2025-12-04T08:44:45.0858719Z json_response: dict[str, Any] = download_json( 2025-12-04T08:44:45.0859336Z url=f"{github_api}/issues/{pr_number}", 2025-12-04T08:44:45.0859881Z headers=headers, 2025-12-04T08:44:45.0860312Z ) 2025-12-04T08:44:45.0860516Z 2025-12-04T08:44:45.0860699Z if not json_response: 2025-12-04T08:44:45.0861280Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T08:44:45.0861899Z return {} 2025-12-04T08:44:45.0862146Z 2025-12-04T08:44:45.0862328Z return json_response 2025-12-04T08:44:45.0862604Z 2025-12-04T08:44:45.0862611Z 2025-12-04T08:44:45.0863130Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T08:44:45.0863876Z """ 2025-12-04T08:44:45.0864406Z Dynamically get the latest list of labels from the pull request 2025-12-04T08:44:45.0865076Z """ 2025-12-04T08:44:45.0865567Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T08:44:45.0866186Z return { 2025-12-04T08:44:45.0866792Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T08:44:45.0867507Z } 2025-12-04T08:44:45.0867713Z 2025-12-04T08:44:45.0867720Z 2025-12-04T08:44:45.0867891Z def main() -> None: 2025-12-04T08:44:45.0868314Z args = parse_args() 2025-12-04T08:44:45.0868583Z 2025-12-04T08:44:45.0868803Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T08:44:45.0869195Z 2025-12-04T08:44:45.0869390Z # Check if the PR is opt-out 2025-12-04T08:44:45.0869873Z if args.pr_number: 2025-12-04T08:44:45.0870528Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T08:44:45.0871294Z if OPT_OUT_LABEL in labels: 2025-12-04T08:44:45.0871912Z log.info( 2025-12-04T08:44:45.0872627Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T08:44:45.0873509Z ) 2025-12-04T08:44:45.0874066Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:44:45.0874744Z sys.exit() 2025-12-04T08:44:45.0875010Z 2025-12-04T08:44:45.0875173Z try: 2025-12-04T08:44:45.0875610Z rollout_state = get_rollout_state_from_issue( 2025-12-04T08:44:45.0876333Z args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T08:44:45.0876998Z ) 2025-12-04T08:44:45.0877208Z 2025-12-04T08:44:45.0877418Z username = get_potential_pr_author( 2025-12-04T08:44:45.0877969Z args.github_token, 2025-12-04T08:44:45.0878448Z args.github_repo, 2025-12-04T08:44:45.0878927Z args.github_actor, 2025-12-04T08:44:45.0879414Z args.github_ref_type, 2025-12-04T08:44:45.0879925Z args.github_branch, 2025-12-04T08:44:45.0880400Z ) 2025-12-04T08:44:45.0880614Z 2025-12-04T08:44:45.0880901Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T08:44:45.0881359Z 2025-12-04T08:44:45.0881586Z runner_label_prefix = get_runner_prefix( 2025-12-04T08:44:45.0882142Z rollout_state, 2025-12-04T08:44:45.0882632Z (args.github_issue_owner, username), 2025-12-04T08:44:45.0883281Z args.github_branch, 2025-12-04T08:44:45.0883785Z args.eligible_experiments, 2025-12-04T08:44:45.0884320Z args.opt_out_experiments, 2025-12-04T08:44:45.0884837Z is_canary, 2025-12-04T08:44:45.0885256Z ) 2025-12-04T08:44:45.0885470Z 2025-12-04T08:44:45.0885658Z except Exception as e: 2025-12-04T08:44:45.0886111Z log.error( 2025-12-04T08:44:45.0886786Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T08:44:45.0887706Z ) 2025-12-04T08:44:45.0887921Z 2025-12-04T08:44:45.0888251Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:44:45.0888759Z 2025-12-04T08:44:45.0888767Z 2025-12-04T08:44:45.0888950Z if __name__ == "__main__": 2025-12-04T08:44:45.0889399Z main() 2025-12-04T08:44:45.0889611Z 2025-12-04T08:44:45.0984745Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T08:44:45.0985656Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T08:44:45.1018804Z shell: /usr/bin/bash -e {0} 2025-12-04T08:44:45.1019279Z env: 2025-12-04T08:44:45.1019898Z GITHUB_TOKEN: *** 2025-12-04T08:44:45.1020317Z ISSUE_NUMBER: 5132 2025-12-04T08:44:45.1020755Z TRIGGERING_ACTOR: seemethere 2025-12-04T08:44:45.1021238Z ISSUE_OWNER: 2025-12-04T08:44:45.1021641Z CHECK_EXPERIMENTS: 2025-12-04T08:44:45.1022078Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:44:45.1022506Z PR_NUMBER: 2025-12-04T08:44:45.1023040Z ##[endgroup] 2025-12-04T08:44:46.1843059Z Defaulting to user installation because normal site-packages is not writeable 2025-12-04T08:44:46.8890886Z Collecting urllib3==1.26.18 2025-12-04T08:44:46.9341673Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-12-04T08:44:46.9556585Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.9 MB/s eta 0:00:00 2025-12-04T08:44:46.9834493Z Collecting PyGithub==2.3.0 2025-12-04T08:44:46.9906182Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-12-04T08:44:47.0408536Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-12-04T08:44:47.0501426Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.8 kB) 2025-12-04T08:44:47.0546043Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-12-04T08:44:47.0563464Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-12-04T08:44:47.0578016Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-12-04T08:44:47.0882127Z Collecting Deprecated (from PyGithub==2.3.0) 2025-12-04T08:44:47.0957307Z Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB) 2025-12-04T08:44:47.1188230Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-12-04T08:44:47.2479793Z Collecting cffi>=2.0.0 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T08:44:47.2554064Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-12-04T08:44:47.4216974Z Collecting wrapt<3,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-12-04T08:44:47.4290991Z Downloading wrapt-2.0.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (9.0 kB) 2025-12-04T08:44:47.4531716Z Collecting pycparser (from cffi>=2.0.0->pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T08:44:47.4606571Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-12-04T08:44:47.4889110Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-12-04T08:44:47.5024863Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 11.6 MB/s eta 0:00:00 2025-12-04T08:44:47.5096170Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-12-04T08:44:47.5336933Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 15.4 MB/s eta 0:00:00 2025-12-04T08:44:47.5405664Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-12-04T08:44:47.6060857Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 21.9 MB/s eta 0:00:00 2025-12-04T08:44:47.6132010Z Downloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB) 2025-12-04T08:44:47.6223828Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-12-04T08:44:47.6322952Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 26.3 MB/s eta 0:00:00 2025-12-04T08:44:47.6393207Z Downloading wrapt-2.0.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (121 kB) 2025-12-04T08:44:47.6454183Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.5/121.5 kB 27.8 MB/s eta 0:00:00 2025-12-04T08:44:47.6522621Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-12-04T08:44:47.6575108Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 30.3 MB/s eta 0:00:00 2025-12-04T08:44:47.9584711Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-12-04T08:44:48.5177138Z Successfully installed Deprecated-1.3.1 PyGithub-2.3.0 cffi-2.0.0 pycparser-2.23 pynacl-1.6.1 urllib3-1.26.18 wrapt-2.0.1 2025-12-04T08:44:48.6594055Z ##[group]Run curr_branch="main" 2025-12-04T08:44:48.6594435Z curr_branch="main" 2025-12-04T08:44:48.6594661Z curr_ref_type="branch" 2025-12-04T08:44:48.6594923Z echo "Current branch is '$curr_branch'" 2025-12-04T08:44:48.6595209Z  2025-12-04T08:44:48.6595408Z python3 runner_determinator.py \ 2025-12-04T08:44:48.6595693Z  --github-token "$GITHUB_TOKEN" \ 2025-12-04T08:44:48.6595968Z  --github-issue "$ISSUE_NUMBER" \ 2025-12-04T08:44:48.6596231Z  --github-branch "$curr_branch" \ 2025-12-04T08:44:48.6596496Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-12-04T08:44:48.6596794Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-12-04T08:44:48.6597082Z  --github-ref-type "$curr_ref_type" \ 2025-12-04T08:44:48.6597361Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-12-04T08:44:48.6597656Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-12-04T08:44:48.6598020Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-12-04T08:44:48.6598310Z  --pr-number "${PR_NUMBER}" 2025-12-04T08:44:48.6632967Z shell: /usr/bin/bash -e {0} 2025-12-04T08:44:48.6633207Z env: 2025-12-04T08:44:48.6633844Z GITHUB_TOKEN: *** 2025-12-04T08:44:48.6634063Z ISSUE_NUMBER: 5132 2025-12-04T08:44:48.6634272Z TRIGGERING_ACTOR: seemethere 2025-12-04T08:44:48.6634483Z ISSUE_OWNER: 2025-12-04T08:44:48.6634664Z CHECK_EXPERIMENTS: 2025-12-04T08:44:48.6634850Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:44:48.6635044Z PR_NUMBER: 2025-12-04T08:44:48.6635213Z ##[endgroup] 2025-12-04T08:44:48.6690908Z Current branch is 'main' 2025-12-04T08:44:50.0620697Z INFO : Based on rollout percentage of 75%, enabling experiment lf. 2025-12-04T08:44:50.0622014Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-12-04T08:44:50.0623475Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-12-04T08:44:50.0624610Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-12-04T08:44:50.0625238Z INFO : Setting output: label-type='lf.' 2025-12-04T08:44:50.0961184Z Evaluate and set job outputs 2025-12-04T08:44:50.0968159Z Set output 'label-type' 2025-12-04T08:44:50.0970097Z Cleaning up orphan processes