2025-12-04T08:45:00.3157281Z Current runner version: '2.329.0' 2025-12-04T08:45:00.3180408Z ##[group]Runner Image Provisioner 2025-12-04T08:45:00.3181188Z Hosted Compute Agent 2025-12-04T08:45:00.3181689Z Version: 20251124.448 2025-12-04T08:45:00.3182205Z Commit: fda5086b43ec66ade217e5fcd18146c879571177 2025-12-04T08:45:00.3182851Z Build Date: 2025-11-24T21:16:26Z 2025-12-04T08:45:00.3183633Z ##[endgroup] 2025-12-04T08:45:00.3184102Z ##[group]Operating System 2025-12-04T08:45:00.3184640Z Ubuntu 2025-12-04T08:45:00.3185035Z 24.04.3 2025-12-04T08:45:00.3185444Z LTS 2025-12-04T08:45:00.3185827Z ##[endgroup] 2025-12-04T08:45:00.3186262Z ##[group]Runner Image 2025-12-04T08:45:00.3186708Z Image: ubuntu-24.04 2025-12-04T08:45:00.3187180Z Version: 20251126.144.1 2025-12-04T08:45:00.3188101Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20251126.144/images/ubuntu/Ubuntu2404-Readme.md 2025-12-04T08:45:00.3189423Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20251126.144 2025-12-04T08:45:00.3190280Z ##[endgroup] 2025-12-04T08:45:00.3191150Z ##[group]GITHUB_TOKEN Permissions 2025-12-04T08:45:00.3193764Z Contents: read 2025-12-04T08:45:00.3194255Z Metadata: read 2025-12-04T08:45:00.3194648Z ##[endgroup] 2025-12-04T08:45:00.3196684Z Secret source: Actions 2025-12-04T08:45:00.3197246Z Prepare workflow directory 2025-12-04T08:45:00.3658197Z Prepare all required actions 2025-12-04T08:45:00.3712291Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (ffd9b0fb4355e97af82fc42cf185c3ffa0fc0a32) 2025-12-04T08:45:00.3717060Z ##[group] Inputs 2025-12-04T08:45:00.3717551Z check_experiments: 2025-12-04T08:45:00.3718160Z opt_out_experiments: 2025-12-04T08:45:00.3718661Z triggering_actor: huydhn 2025-12-04T08:45:00.3719116Z issue_owner: 2025-12-04T08:45:00.3719610Z curr_branch: main 2025-12-04T08:45:00.3720035Z curr_ref_type: branch 2025-12-04T08:45:00.3720579Z issue_number: 5132 2025-12-04T08:45:00.3721072Z ##[endgroup] 2025-12-04T08:45:00.3721694Z Complete job name: before-test / get-label-type / runner-determinator 2025-12-04T08:45:01.0479508Z ##[group]Run cat < runner_determinator.py 2025-12-04T08:45:01.0481760Z cat < runner_determinator.py 2025-12-04T08:45:01.0482314Z # flake8: noqa: G004 2025-12-04T08:45:01.0482801Z  2025-12-04T08:45:01.0483577Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T08:45:01.0484515Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T08:45:01.0485362Z # python .github/scripts/update_runner_determinator.py 2025-12-04T08:45:01.0485963Z  2025-12-04T08:45:01.0486347Z """ 2025-12-04T08:45:01.0486913Z This runner determinator is used to determine which set of runners to run a 2025-12-04T08:45:01.0487815Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T08:45:01.0488820Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T08:45:01.0489687Z of which runners should be used to run which job. 2025-12-04T08:45:01.0490233Z  2025-12-04T08:45:01.0490836Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T08:45:01.0491749Z separated by a line containing "---". If the line is not present, the 2025-12-04T08:45:01.0492584Z settings are considered to be empty with only the second part, the user 2025-12-04T08:45:01.0493377Z list, defined. 2025-12-04T08:45:01.0493801Z  2025-12-04T08:45:01.0494403Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T08:45:01.0495313Z used to define any settings that are needed to determine which runners to use. 2025-12-04T08:45:01.0496135Z It's fields are defined by the RolloutSettings class below. 2025-12-04T08:45:01.0496757Z  2025-12-04T08:45:01.0497559Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T08:45:01.0498453Z The user list is also a comma separated list of additional features or 2025-12-04T08:45:01.0499232Z experiments which the user could be opted in to. 2025-12-04T08:45:01.0499784Z  2025-12-04T08:45:01.0500224Z The user list has the following rules: 2025-12-04T08:45:01.0500741Z  2025-12-04T08:45:01.0501302Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T08:45:01.0502098Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T08:45:01.0502931Z - A "#" prefix opts the user out of all experiments 2025-12-04T08:45:01.0503651Z  2025-12-04T08:45:01.0504003Z Example config: 2025-12-04T08:45:01.0504595Z  # A list of experiments that can be opted into. 2025-12-04T08:45:01.0505269Z  # This defines the behavior they'll induce when opted into. 2025-12-04T08:45:01.0505904Z  # Expected syntax is: 2025-12-04T08:45:01.0506634Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T08:45:01.0507558Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T08:45:01.0508289Z  2025-12-04T08:45:01.0508688Z  experiments: 2025-12-04T08:45:01.0509155Z  lf: 2025-12-04T08:45:01.0509565Z  rollout_percent: 25 2025-12-04T08:45:01.0510098Z  all_branches: false 2025-12-04T08:45:01.0510601Z  default: true 2025-12-04T08:45:01.0511041Z  --- 2025-12-04T08:45:01.0511485Z  2025-12-04T08:45:01.0511847Z  # Opt-ins: 2025-12-04T08:45:01.0512497Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T08:45:01.0513533Z  # and specifying experiments to enable in a comma-separated list. 2025-12-04T08:45:01.0514348Z  # To always opt out of an experiment, prefix it with a "-". 2025-12-04T08:45:01.0515053Z  # Experiments should be from the above list. 2025-12-04T08:45:01.0515616Z  2025-12-04T08:45:01.0516042Z  @User1,-lf,split_build 2025-12-04T08:45:01.0516520Z  @User2,lf 2025-12-04T08:45:01.0517326Z  @User3,split_build 2025-12-04T08:45:01.0517810Z """ 2025-12-04T08:45:01.0518204Z  2025-12-04T08:45:01.0518615Z import json 2025-12-04T08:45:01.0519037Z import logging 2025-12-04T08:45:01.0519507Z import os 2025-12-04T08:45:01.0519891Z import random 2025-12-04T08:45:01.0520386Z import re 2025-12-04T08:45:01.0520779Z import sys 2025-12-04T08:45:01.0521245Z from argparse import ArgumentParser 2025-12-04T08:45:01.0521949Z from collections.abc import Iterable 2025-12-04T08:45:01.0522496Z from functools import cache 2025-12-04T08:45:01.0523112Z from logging import LogRecord 2025-12-04T08:45:01.0523665Z from typing import Any, NamedTuple 2025-12-04T08:45:01.0524264Z from urllib.request import Request, urlopen 2025-12-04T08:45:01.0524806Z  2025-12-04T08:45:01.0525209Z import yaml 2025-12-04T08:45:01.0525690Z from github import Auth, Github 2025-12-04T08:45:01.0526202Z from github.Issue import Issue 2025-12-04T08:45:01.0526731Z  2025-12-04T08:45:01.0527076Z  2025-12-04T08:45:01.0527534Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T08:45:01.0528271Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T08:45:01.0529096Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T08:45:01.0529819Z  2025-12-04T08:45:01.0530472Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T08:45:01.0531095Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T08:45:01.0531634Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T08:45:01.0532261Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T08:45:01.0532836Z  2025-12-04T08:45:01.0533301Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T08:45:01.0533837Z  2025-12-04T08:45:01.0534223Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T08:45:01.0535148Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T08:45:01.0535587Z  2025-12-04T08:45:01.0536007Z  2025-12-04T08:45:01.0536422Z class Experiment(NamedTuple): 2025-12-04T08:45:01.0536913Z  rollout_perc: float = ( 2025-12-04T08:45:01.0537648Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T08:45:01.0538296Z  ) 2025-12-04T08:45:01.0538701Z  all_branches: bool = ( 2025-12-04T08:45:01.0539412Z  False # If True, the experiment is also enabled on the exception branches 2025-12-04T08:45:01.0540092Z  ) 2025-12-04T08:45:01.0540502Z  default: bool = ( 2025-12-04T08:45:01.0541141Z  True # If True, the experiment is enabled by default for all queries 2025-12-04T08:45:01.0541795Z  ) 2025-12-04T08:45:01.0542159Z  2025-12-04T08:45:01.0542608Z  # Add more fields as needed 2025-12-04T08:45:01.0543203Z  2025-12-04T08:45:01.0543584Z  2025-12-04T08:45:01.0544026Z class Settings(NamedTuple): 2025-12-04T08:45:01.0544493Z  """ 2025-12-04T08:45:01.0545044Z  Settings for the experiments that can be opted into. 2025-12-04T08:45:01.0545625Z  """ 2025-12-04T08:45:01.0546054Z  2025-12-04T08:45:01.0546465Z  experiments: dict[str, Experiment] = {} 2025-12-04T08:45:01.0547030Z  2025-12-04T08:45:01.0547491Z  2025-12-04T08:45:01.0547945Z class ColorFormatter(logging.Formatter): 2025-12-04T08:45:01.0548647Z  """Color codes the log messages based on the log level""" 2025-12-04T08:45:01.0549228Z  2025-12-04T08:45:01.0549619Z  COLORS = { 2025-12-04T08:45:01.0550051Z  "WARNING": "\033[33m", # Yellow 2025-12-04T08:45:01.0550640Z  "ERROR": "\033[31m", # Red 2025-12-04T08:45:01.0551153Z  "CRITICAL": "\033[31m", # Red 2025-12-04T08:45:01.0551712Z  "INFO": "\033[0m", # Reset 2025-12-04T08:45:01.0552286Z  "DEBUG": "\033[0m", # Reset 2025-12-04T08:45:01.0552761Z  } 2025-12-04T08:45:01.0553627Z  2025-12-04T08:45:01.0554103Z  def format(self, record: LogRecord) -> str: 2025-12-04T08:45:01.0554878Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T08:45:01.0555674Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T08:45:01.0556288Z  return super().format(record) 2025-12-04T08:45:01.0556811Z  2025-12-04T08:45:01.0557156Z  2025-12-04T08:45:01.0557596Z handler = logging.StreamHandler() 2025-12-04T08:45:01.0558311Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T08:45:01.0559041Z  2025-12-04T08:45:01.0559551Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T08:45:01.0560137Z log.addHandler(handler) 2025-12-04T08:45:01.0560645Z log.setLevel(logging.INFO) 2025-12-04T08:45:01.0561112Z  2025-12-04T08:45:01.0561499Z  2025-12-04T08:45:01.0561976Z def set_github_output(key: str, value: str) -> None: 2025-12-04T08:45:01.0562574Z  """ 2025-12-04T08:45:01.0563188Z  Defines outputs of the github action that invokes this script 2025-12-04T08:45:01.0563927Z  """ 2025-12-04T08:45:01.0564370Z  if not GITHUB_OUTPUT: 2025-12-04T08:45:01.0565406Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T08:45:01.0566484Z  log.warning( 2025-12-04T08:45:01.0567354Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T08:45:01.0568220Z  ) 2025-12-04T08:45:01.0568712Z  print(f"::set-output name={key}::{value}") 2025-12-04T08:45:01.0569234Z  return 2025-12-04T08:45:01.0569696Z  2025-12-04T08:45:01.0570115Z  with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T08:45:01.0571027Z  log.info(f"Setting output: {key}='{value}'") 2025-12-04T08:45:01.0571668Z  f.write(f"{key}={value}\n") 2025-12-04T08:45:01.0572148Z  2025-12-04T08:45:01.0572528Z  2025-12-04T08:45:01.0573119Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T08:45:01.0573796Z  return frozenset( 2025-12-04T08:45:01.0574431Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T08:45:01.0575140Z  ) 2025-12-04T08:45:01.0575536Z  2025-12-04T08:45:01.0575894Z  2025-12-04T08:45:01.0576328Z def parse_args() -> Any: 2025-12-04T08:45:01.0576935Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T08:45:01.0577793Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T08:45:01.0578511Z  parser.add_argument( 2025-12-04T08:45:01.0579039Z  "--github-issue-repo", 2025-12-04T08:45:01.0579738Z  type=str, 2025-12-04T08:45:01.0580202Z  required=False, 2025-12-04T08:45:01.0580830Z  default="pytorch/test-infra", 2025-12-04T08:45:01.0581397Z  help="GitHub repo to get the issue", 2025-12-04T08:45:01.0581948Z  ) 2025-12-04T08:45:01.0582348Z  parser.add_argument( 2025-12-04T08:45:01.0582849Z  "--github-repo", 2025-12-04T08:45:01.0583503Z  type=str, 2025-12-04T08:45:01.0583956Z  required=True, 2025-12-04T08:45:01.0584497Z  help="GitHub repo where CI is running", 2025-12-04T08:45:01.0584999Z  ) 2025-12-04T08:45:01.0585457Z  parser.add_argument( 2025-12-04T08:45:01.0586079Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T08:45:01.0586734Z  ) 2025-12-04T08:45:01.0587207Z  parser.add_argument( 2025-12-04T08:45:01.0587849Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T08:45:01.0588533Z  ) 2025-12-04T08:45:01.0588962Z  parser.add_argument( 2025-12-04T08:45:01.0589643Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T08:45:01.0590303Z  ) 2025-12-04T08:45:01.0590765Z  parser.add_argument( 2025-12-04T08:45:01.0591464Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T08:45:01.0592131Z  ) 2025-12-04T08:45:01.0592579Z  parser.add_argument( 2025-12-04T08:45:01.0593114Z  "--github-ref-type", 2025-12-04T08:45:01.0593645Z  type=str, 2025-12-04T08:45:01.0594087Z  required=True, 2025-12-04T08:45:01.0594697Z  help="Current GitHub ref type, branch or tag", 2025-12-04T08:45:01.0595234Z  ) 2025-12-04T08:45:01.0595690Z  parser.add_argument( 2025-12-04T08:45:01.0596268Z  "--eligible-experiments", 2025-12-04T08:45:01.0596870Z  type=_str_comma_separated_to_set, 2025-12-04T08:45:01.0597397Z  required=False, 2025-12-04T08:45:01.0597899Z  default="", 2025-12-04T08:45:01.0598764Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T08:45:01.0599624Z  ) 2025-12-04T08:45:01.0600052Z  parser.add_argument( 2025-12-04T08:45:01.0600563Z  "--opt-out-experiments", 2025-12-04T08:45:01.0601138Z  type=_str_comma_separated_to_set, 2025-12-04T08:45:01.0601670Z  required=False, 2025-12-04T08:45:01.0602155Z  default="", 2025-12-04T08:45:01.0602626Z  help=( 2025-12-04T08:45:01.0603373Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T08:45:01.0604484Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T08:45:01.0605251Z  ), 2025-12-04T08:45:01.0605703Z  ) 2025-12-04T08:45:01.0606129Z  parser.add_argument( 2025-12-04T08:45:01.0606586Z  "--pr-number", 2025-12-04T08:45:01.0607093Z  type=str, 2025-12-04T08:45:01.0607549Z  required=False, 2025-12-04T08:45:01.0608018Z  default="", 2025-12-04T08:45:01.0608565Z  help="the optional PR number where this is run", 2025-12-04T08:45:01.0609147Z  ) 2025-12-04T08:45:01.0609535Z  2025-12-04T08:45:01.0609953Z  return parser.parse_args() 2025-12-04T08:45:01.0610479Z  2025-12-04T08:45:01.0610833Z  2025-12-04T08:45:01.0611465Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T08:45:01.0612268Z  auth = Auth.Token(github_token) 2025-12-04T08:45:01.0612814Z  return Github(auth=auth) 2025-12-04T08:45:01.0613408Z  2025-12-04T08:45:01.0613754Z  2025-12-04T08:45:01.0614423Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T08:45:01.0615199Z  repo = gh.get_repo(repo) 2025-12-04T08:45:01.0615771Z  return repo.get_issue(number=issue_num) 2025-12-04T08:45:01.0616285Z  2025-12-04T08:45:01.0616667Z  2025-12-04T08:45:01.0617073Z def get_potential_pr_author( 2025-12-04T08:45:01.0617755Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T08:45:01.0618463Z ) -> str: 2025-12-04T08:45:01.0619009Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T08:45:01.0619815Z  # Fetch the actual username from the original PR. The PR number is 2025-12-04T08:45:01.0620540Z  # embedded in the tag name: ciflow// 2025-12-04T08:45:01.0621176Z  2025-12-04T08:45:01.0621599Z  gh = get_gh_client(github_token) 2025-12-04T08:45:01.0622066Z  2025-12-04T08:45:01.0622604Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T08:45:01.0623348Z  split_tag = ref_name.split("/") 2025-12-04T08:45:01.0623867Z  if ( 2025-12-04T08:45:01.0624341Z  len(split_tag) == 3 2025-12-04T08:45:01.0624884Z  and split_tag[0] == "ciflow" 2025-12-04T08:45:01.0625437Z  and split_tag[2].isnumeric() 2025-12-04T08:45:01.0625964Z  ): 2025-12-04T08:45:01.0626424Z  pr_number = split_tag[2] 2025-12-04T08:45:01.0626919Z  try: 2025-12-04T08:45:01.0627467Z  repository = gh.get_repo(repo) 2025-12-04T08:45:01.0628188Z  pull = repository.get_pull(number=int(pr_number)) 2025-12-04T08:45:01.0628788Z  except Exception as e: 2025-12-04T08:45:01.0629482Z  raise Exception( # noqa: TRY002 2025-12-04T08:45:01.0630145Z  f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T08:45:01.0630826Z  ) from e 2025-12-04T08:45:01.0631400Z  return pull.user.login # type: ignore[no-any-return] 2025-12-04T08:45:01.0632137Z  # In all other cases, return the original input username 2025-12-04T08:45:01.0632755Z  return username 2025-12-04T08:45:01.0633506Z  2025-12-04T08:45:01.0633897Z  2025-12-04T08:45:01.0634346Z def is_exception_branch(branch: str) -> bool: 2025-12-04T08:45:01.0634908Z  """ 2025-12-04T08:45:01.0635563Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T08:45:01.0636337Z  """ 2025-12-04T08:45:01.0636928Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T08:45:01.0637577Z  2025-12-04T08:45:01.0637973Z  2025-12-04T08:45:01.0638354Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T08:45:01.0638912Z  try: 2025-12-04T08:45:01.0639326Z  data = yaml.safe_load(yaml_text) 2025-12-04T08:45:01.0639851Z  return data 2025-12-04T08:45:01.0640362Z  except yaml.YAMLError: 2025-12-04T08:45:01.0640890Z  log.exception("Error loading YAML") 2025-12-04T08:45:01.0641421Z  raise 2025-12-04T08:45:01.0641846Z  2025-12-04T08:45:01.0642212Z  2025-12-04T08:45:01.0642797Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T08:45:01.0643616Z  """ 2025-12-04T08:45:01.0644376Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T08:45:01.0645120Z  2025-12-04T08:45:01.0645708Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T08:45:01.0646441Z  and the text below is the list of opted in users. 2025-12-04T08:45:01.0647019Z  2025-12-04T08:45:01.0647625Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T08:45:01.0648300Z  """ 2025-12-04T08:45:01.0648798Z  rollout_state_parts = rollout_state.split("---") 2025-12-04T08:45:01.0649387Z  if len(rollout_state_parts) >= 2: 2025-12-04T08:45:01.0650036Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T08:45:01.0650601Z  else: 2025-12-04T08:45:01.0651060Z  return "", rollout_state 2025-12-04T08:45:01.0651585Z  2025-12-04T08:45:01.0651933Z  2025-12-04T08:45:01.0652370Z class UserOptins(dict[str, list[str]]): 2025-12-04T08:45:01.0652875Z  """ 2025-12-04T08:45:01.0653500Z  Dictionary of users with a list of features they have opted into 2025-12-04T08:45:01.0654092Z  """ 2025-12-04T08:45:01.0654531Z  2025-12-04T08:45:01.0654891Z  2025-12-04T08:45:01.0655393Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T08:45:01.0656078Z  """ 2025-12-04T08:45:01.0656771Z  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:45:01.0657574Z  2025-12-04T08:45:01.0658406Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T08:45:01.0659338Z  - Example line: "@User1,lf,split_build" 2025-12-04T08:45:01.0660097Z  - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T08:45:01.0660736Z  2025-12-04T08:45:01.0661100Z  2025-12-04T08:45:01.0661442Z  """ 2025-12-04T08:45:01.0661912Z  optins = UserOptins() 2025-12-04T08:45:01.0662451Z  for user in user_optin_text.split("\n"): 2025-12-04T08:45:01.0663004Z  user = user.strip("\r\n\t -") 2025-12-04T08:45:01.0663724Z  if not user or not user.startswith("@"): 2025-12-04T08:45:01.0664274Z  # Not a valid user. Skip 2025-12-04T08:45:01.0664814Z  continue 2025-12-04T08:45:01.0665245Z  2025-12-04T08:45:01.0665637Z  if user: 2025-12-04T08:45:01.0666145Z  usr_name = user.split(",")[0].strip("@") 2025-12-04T08:45:01.0666831Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T08:45:01.0667480Z  2025-12-04T08:45:01.0667836Z  return optins 2025-12-04T08:45:01.0668308Z  2025-12-04T08:45:01.0668659Z  2025-12-04T08:45:01.0669169Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T08:45:01.0669790Z  """ 2025-12-04T08:45:01.0670226Z  Check if the experiment name is valid. 2025-12-04T08:45:01.0670789Z  A valid name: 2025-12-04T08:45:01.0671421Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T08:45:01.0672357Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T08:45:01.0673030Z  - Cannot contain spaces 2025-12-04T08:45:01.0673582Z  """ 2025-12-04T08:45:01.0674012Z  2025-12-04T08:45:01.0674462Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T08:45:01.0675181Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T08:45:01.0675865Z  2025-12-04T08:45:01.0676247Z  if valid: 2025-12-04T08:45:01.0676650Z  return True 2025-12-04T08:45:01.0677101Z  2025-12-04T08:45:01.0677500Z  log.error( 2025-12-04T08:45:01.0678810Z  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:45:01.0680216Z  ) 2025-12-04T08:45:01.0680578Z  return False 2025-12-04T08:45:01.0681011Z  2025-12-04T08:45:01.0681395Z  2025-12-04T08:45:01.0681915Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T08:45:01.0682551Z  """ 2025-12-04T08:45:01.0683207Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T08:45:01.0683918Z  """ 2025-12-04T08:45:01.0684281Z  try: 2025-12-04T08:45:01.0684703Z  if settings_text: 2025-12-04T08:45:01.0685473Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T08:45:01.0686210Z  # for easy reading 2025-12-04T08:45:01.0687030Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T08:45:01.0687872Z  # the backtick character in shell commands. 2025-12-04T08:45:01.0688496Z  backtick = chr(96) # backtick character 2025-12-04T08:45:01.0689188Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T08:45:01.0689859Z  settings = load_yaml(settings_text) 2025-12-04T08:45:01.0690382Z  2025-12-04T08:45:01.0690947Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T08:45:01.0691771Z  experiments = {} 2025-12-04T08:45:01.0692251Z  2025-12-04T08:45:01.0692775Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T08:45:01.0693651Z  if not is_valid_experiment_name(exp_name): 2025-12-04T08:45:01.0694657Z  # 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:45:01.0695622Z  continue 2025-12-04T08:45:01.0696118Z  2025-12-04T08:45:01.0696493Z  valid_settings = {} 2025-12-04T08:45:01.0697027Z  for setting in exp_settings: 2025-12-04T08:45:01.0697639Z  if setting not in Experiment._fields: 2025-12-04T08:45:01.0698214Z  log.warning( 2025-12-04T08:45:01.0698925Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T08:45:01.0699618Z  ) 2025-12-04T08:45:01.0700102Z  else: 2025-12-04T08:45:01.0700634Z  valid_settings[setting] = exp_settings[setting] 2025-12-04T08:45:01.0701252Z  2025-12-04T08:45:01.0701715Z  experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T08:45:01.0702366Z  return Settings(experiments) 2025-12-04T08:45:01.0702913Z  2025-12-04T08:45:01.0703384Z  except Exception: 2025-12-04T08:45:01.0703923Z  log.exception("Failed to parse settings") 2025-12-04T08:45:01.0704488Z  2025-12-04T08:45:01.0704893Z  return Settings() 2025-12-04T08:45:01.0705309Z  2025-12-04T08:45:01.0705689Z  2025-12-04T08:45:01.0706267Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T08:45:01.0706838Z  """ 2025-12-04T08:45:01.0707336Z  Parse settings, if any, from the rollout state. 2025-12-04T08:45:01.0707878Z  2025-12-04T08:45:01.0708447Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T08:45:01.0709155Z  and the text below is the list of opted in users. 2025-12-04T08:45:01.0709753Z  2025-12-04T08:45:01.0710707Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T08:45:01.0711367Z  """ 2025-12-04T08:45:01.0711999Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:45:01.0713004Z  return parse_settings_from_text(settings_text) 2025-12-04T08:45:01.0714124Z  2025-12-04T08:45:01.0714513Z  2025-12-04T08:45:01.0715021Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T08:45:01.0715584Z  """ 2025-12-04T08:45:01.0716031Z  Parse users from the rollout state. 2025-12-04T08:45:01.0716557Z  2025-12-04T08:45:01.0717056Z  """ 2025-12-04T08:45:01.0717689Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:45:01.0719067Z  return parse_user_opt_in_from_text(users_text) 2025-12-04T08:45:01.0720073Z  2025-12-04T08:45:01.0721025Z  2025-12-04T08:45:01.0721622Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:45:01.0722344Z  """ 2025-12-04T08:45:01.0722795Z  Check if a user is opted into an experiment 2025-12-04T08:45:01.0723456Z  """ 2025-12-04T08:45:01.0723935Z  return experiment_name in user_optins.get(user, []) 2025-12-04T08:45:01.0724518Z  2025-12-04T08:45:01.0725002Z  2025-12-04T08:45:01.0725605Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:45:01.0726352Z  """ 2025-12-04T08:45:01.0726858Z  Check if a user explicitly opted out of an experiment 2025-12-04T08:45:01.0727440Z  """ 2025-12-04T08:45:01.0728005Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T08:45:01.0728690Z  experiment_optout = "-" + experiment_name 2025-12-04T08:45:01.0729346Z  if experiment_optout not in user_optins.get(user, []): 2025-12-04T08:45:01.0729904Z  return False 2025-12-04T08:45:01.0730395Z  2025-12-04T08:45:01.0730850Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T08:45:01.0731437Z  log.warning( 2025-12-04T08:45:01.0732265Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T08:45:01.0733128Z  ) 2025-12-04T08:45:01.0733515Z  2025-12-04T08:45:01.0733918Z  return True 2025-12-04T08:45:01.0734344Z  2025-12-04T08:45:01.0734678Z  2025-12-04T08:45:01.0735089Z def get_runner_prefix( 2025-12-04T08:45:01.0735577Z  rollout_state: str, 2025-12-04T08:45:01.0736061Z  workflow_requestors: Iterable[str], 2025-12-04T08:45:01.0736968Z  branch: str, 2025-12-04T08:45:01.0737485Z  eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T08:45:01.0738549Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T08:45:01.0739118Z  is_canary: bool = False, 2025-12-04T08:45:01.0739608Z ) -> str: 2025-12-04T08:45:01.0740087Z  settings = parse_settings(rollout_state) 2025-12-04T08:45:01.0740690Z  user_optins = parse_users(rollout_state) 2025-12-04T08:45:01.0741242Z  2025-12-04T08:45:01.0741676Z  fleet_prefix = "" 2025-12-04T08:45:01.0742158Z  prefixes = [] 2025-12-04T08:45:01.0742792Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T08:45:01.0743810Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T08:45:01.0744537Z  log.info( 2025-12-04T08:45:01.0745241Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T08:45:01.0745967Z  ) 2025-12-04T08:45:01.0746430Z  continue 2025-12-04T08:45:01.0746879Z  2025-12-04T08:45:01.0747246Z  if opt_out_experiments: 2025-12-04T08:45:01.0840388Z  if experiment_name in opt_out_experiments: 2025-12-04T08:45:01.0841188Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T08:45:01.0841776Z  log.info( 2025-12-04T08:45:01.0842595Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T08:45:01.0843537Z  ) 2025-12-04T08:45:01.0843908Z  continue 2025-12-04T08:45:01.0844293Z  2025-12-04T08:45:01.0844650Z  if eligible_experiments: 2025-12-04T08:45:01.0845164Z  if experiment_name not in eligible_experiments: 2025-12-04T08:45:01.0845807Z  exp_list = ", ".join(eligible_experiments) 2025-12-04T08:45:01.0846289Z  log.info( 2025-12-04T08:45:01.0846985Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T08:45:01.0847701Z  ) 2025-12-04T08:45:01.0848074Z  continue 2025-12-04T08:45:01.0848765Z  elif not experiment_settings.default: 2025-12-04T08:45:01.0849234Z  log.info( 2025-12-04T08:45:01.0849834Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T08:45:01.0850472Z  ) 2025-12-04T08:45:01.0850814Z  continue 2025-12-04T08:45:01.0851168Z  2025-12-04T08:45:01.0851578Z  # Is any workflow_requestor opted out to this experiment? 2025-12-04T08:45:01.0852111Z  opted_out_users = [ 2025-12-04T08:45:01.0852525Z  requestor 2025-12-04T08:45:01.0852948Z  for requestor in workflow_requestors 2025-12-04T08:45:01.0853622Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T08:45:01.0854169Z  ] 2025-12-04T08:45:01.0854485Z  2025-12-04T08:45:01.0854797Z  if opted_out_users: 2025-12-04T08:45:01.0855207Z  log.info( 2025-12-04T08:45:01.0855779Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T08:45:01.0856380Z  ) 2025-12-04T08:45:01.0856723Z  continue 2025-12-04T08:45:01.0857089Z  2025-12-04T08:45:01.0857493Z  # Is any workflow_requestor opted in to this experiment? 2025-12-04T08:45:01.0858026Z  opted_in_users = [ 2025-12-04T08:45:01.0858424Z  requestor 2025-12-04T08:45:01.0858866Z  for requestor in workflow_requestors 2025-12-04T08:45:01.0859451Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T08:45:01.0859990Z  ] 2025-12-04T08:45:01.0860308Z  2025-12-04T08:45:01.0860607Z  enabled = False 2025-12-04T08:45:01.0861013Z  if opted_in_users: 2025-12-04T08:45:01.0861504Z  log.info( 2025-12-04T08:45:01.0862081Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T08:45:01.0862672Z  ) 2025-12-04T08:45:01.0863136Z  enabled = True 2025-12-04T08:45:01.0863533Z  2025-12-04T08:45:01.0863892Z  elif experiment_settings.rollout_perc: 2025-12-04T08:45:01.0864642Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T08:45:01.0865467Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T08:45:01.0866030Z  log.info( 2025-12-04T08:45:01.0866801Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T08:45:01.0867577Z  ) 2025-12-04T08:45:01.0867965Z  enabled = True 2025-12-04T08:45:01.0868361Z  2025-12-04T08:45:01.0868661Z  if enabled: 2025-12-04T08:45:01.0869058Z  label = experiment_name 2025-12-04T08:45:01.0869563Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T08:45:01.0870298Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T08:45:01.0871062Z  # - If it's enabled, then we always list it's prefix first 2025-12-04T08:45:01.0871745Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T08:45:01.0872317Z  if is_canary: 2025-12-04T08:45:01.0872766Z  label += CANARY_FLEET_SUFFIX 2025-12-04T08:45:01.0873775Z  fleet_prefix = label 2025-12-04T08:45:01.0874218Z  else: 2025-12-04T08:45:01.0874737Z  prefixes.append(label) 2025-12-04T08:45:01.0875171Z  2025-12-04T08:45:01.0875482Z  if len(prefixes) > 1: 2025-12-04T08:45:01.0875888Z  log.error( 2025-12-04T08:45:01.0876805Z  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:45:01.0877747Z  ) 2025-12-04T08:45:01.0878100Z  prefixes = prefixes[:1] 2025-12-04T08:45:01.0878516Z  2025-12-04T08:45:01.0878837Z  # Fleet always comes first 2025-12-04T08:45:01.0879265Z  if fleet_prefix: 2025-12-04T08:45:01.0879678Z  prefixes.insert(0, fleet_prefix) 2025-12-04T08:45:01.0880120Z  2025-12-04T08:45:01.0880511Z  return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T08:45:01.0881001Z  2025-12-04T08:45:01.0881282Z  2025-12-04T08:45:01.0881844Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T08:45:01.0882494Z  """ 2025-12-04T08:45:01.0883015Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T08:45:01.0883724Z  2025-12-04T08:45:01.0884226Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T08:45:01.0884829Z  """ 2025-12-04T08:45:01.0885186Z  gh = get_gh_client(github_token) 2025-12-04T08:45:01.0885677Z  issue = get_issue(gh, repo, issue_num) 2025-12-04T08:45:01.0886253Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T08:45:01.0886761Z  2025-12-04T08:45:01.0887056Z  2025-12-04T08:45:01.0887578Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T08:45:01.0888329Z  for _ in range(num_retries): 2025-12-04T08:45:01.0888746Z  try: 2025-12-04T08:45:01.0889138Z  req = Request(url=url, headers=headers) 2025-12-04T08:45:01.0889729Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T08:45:01.0890299Z  return json.loads(content) 2025-12-04T08:45:01.0890758Z  except Exception as e: 2025-12-04T08:45:01.0891253Z  log.warning(f"Could not download {url}: {e}") 2025-12-04T08:45:01.0891735Z  2025-12-04T08:45:01.0892237Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T08:45:01.0892854Z  return {} 2025-12-04T08:45:01.0893254Z  2025-12-04T08:45:01.0893536Z  2025-12-04T08:45:01.0893823Z @cache 2025-12-04T08:45:01.0894374Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T08:45:01.0895021Z  """ 2025-12-04T08:45:01.0895376Z  Dynamically get PR information 2025-12-04T08:45:01.0895812Z  """ 2025-12-04T08:45:01.0896274Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T08:45:01.0896815Z  headers = { 2025-12-04T08:45:01.0897256Z  "Accept": "application/vnd.github.v3+json", 2025-12-04T08:45:01.0897803Z  "Authorization": f"token {github_token}", 2025-12-04T08:45:01.0898267Z  } 2025-12-04T08:45:01.0898662Z  json_response: dict[str, Any] = download_json( 2025-12-04T08:45:01.0899208Z  url=f"{github_api}/issues/{pr_number}", 2025-12-04T08:45:01.0899684Z  headers=headers, 2025-12-04T08:45:01.0900074Z  ) 2025-12-04T08:45:01.0900381Z  2025-12-04T08:45:01.0900689Z  if not json_response: 2025-12-04T08:45:01.0901216Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T08:45:01.0901823Z  return {} 2025-12-04T08:45:01.0902181Z  2025-12-04T08:45:01.0902487Z  return json_response 2025-12-04T08:45:01.0902880Z  2025-12-04T08:45:01.0903271Z  2025-12-04T08:45:01.0903783Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T08:45:01.0904405Z  """ 2025-12-04T08:45:01.0904878Z  Dynamically get the latest list of labels from the pull request 2025-12-04T08:45:01.0905434Z  """ 2025-12-04T08:45:01.0905871Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T08:45:01.0906407Z  return { 2025-12-04T08:45:01.0906933Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T08:45:01.0907525Z  } 2025-12-04T08:45:01.0907840Z  2025-12-04T08:45:01.0908134Z  2025-12-04T08:45:01.0908448Z def main() -> None: 2025-12-04T08:45:01.0908837Z  args = parse_args() 2025-12-04T08:45:01.0909220Z  2025-12-04T08:45:01.0909584Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T08:45:01.0910047Z  2025-12-04T08:45:01.0910362Z  # Check if the PR is opt-out 2025-12-04T08:45:01.0910795Z  if args.pr_number: 2025-12-04T08:45:01.0911392Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T08:45:01.0912035Z  if OPT_OUT_LABEL in labels: 2025-12-04T08:45:01.0912475Z  log.info( 2025-12-04T08:45:01.0913148Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T08:45:01.0913807Z  ) 2025-12-04T08:45:01.0914313Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:45:01.0914898Z  sys.exit() 2025-12-04T08:45:01.0915347Z  2025-12-04T08:45:01.0915638Z  try: 2025-12-04T08:45:01.0916039Z  rollout_state = get_rollout_state_from_issue( 2025-12-04T08:45:01.0916664Z  args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T08:45:01.0917209Z  ) 2025-12-04T08:45:01.0917524Z  2025-12-04T08:45:01.0917878Z  username = get_potential_pr_author( 2025-12-04T08:45:01.0918349Z  args.github_token, 2025-12-04T08:45:01.0918784Z  args.github_repo, 2025-12-04T08:45:01.0919218Z  args.github_actor, 2025-12-04T08:45:01.0919652Z  args.github_ref_type, 2025-12-04T08:45:01.0920095Z  args.github_branch, 2025-12-04T08:45:01.0920500Z  ) 2025-12-04T08:45:01.0920818Z  2025-12-04T08:45:01.0921231Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T08:45:01.0921751Z  2025-12-04T08:45:01.0922112Z  runner_label_prefix = get_runner_prefix( 2025-12-04T08:45:01.0922587Z  rollout_state, 2025-12-04T08:45:01.0923125Z  (args.github_issue_owner, username), 2025-12-04T08:45:01.0923602Z  args.github_branch, 2025-12-04T08:45:01.0924058Z  args.eligible_experiments, 2025-12-04T08:45:01.0924535Z  args.opt_out_experiments, 2025-12-04T08:45:01.0924989Z  is_canary, 2025-12-04T08:45:01.0925357Z  ) 2025-12-04T08:45:01.0925686Z  2025-12-04T08:45:01.0926005Z  except Exception as e: 2025-12-04T08:45:01.0926411Z  log.error( 2025-12-04T08:45:01.0927028Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T08:45:01.0927666Z  ) 2025-12-04T08:45:01.0928072Z  2025-12-04T08:45:01.0928534Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:45:01.0929091Z  2025-12-04T08:45:01.0929380Z  2025-12-04T08:45:01.0929685Z if __name__ == "__main__": 2025-12-04T08:45:01.0930088Z  main() 2025-12-04T08:45:01.0930412Z  2025-12-04T08:45:01.0930704Z EOF 2025-12-04T08:45:01.0930998Z  2025-12-04T08:45:01.0931318Z cat runner_determinator.py 2025-12-04T08:45:01.1338508Z shell: /usr/bin/bash -e {0} 2025-12-04T08:45:01.1339357Z env: 2025-12-04T08:45:01.1339964Z GITHUB_TOKEN: *** 2025-12-04T08:45:01.1340314Z ISSUE_NUMBER: 5132 2025-12-04T08:45:01.1340675Z TRIGGERING_ACTOR: huydhn 2025-12-04T08:45:01.1341050Z ISSUE_OWNER: 2025-12-04T08:45:01.1341384Z CHECK_EXPERIMENTS: 2025-12-04T08:45:01.1341734Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:45:01.1342115Z PR_NUMBER: 2025-12-04T08:45:01.1342457Z ##[endgroup] 2025-12-04T08:45:01.1521592Z # flake8: noqa: G004 2025-12-04T08:45:01.1521904Z 2025-12-04T08:45:01.1522269Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T08:45:01.1523499Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T08:45:01.1524198Z # python .github/scripts/update_runner_determinator.py 2025-12-04T08:45:01.1524571Z 2025-12-04T08:45:01.1524711Z """ 2025-12-04T08:45:01.1525177Z This runner determinator is used to determine which set of runners to run a 2025-12-04T08:45:01.1525903Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T08:45:01.1526646Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T08:45:01.1527322Z of which runners should be used to run which job. 2025-12-04T08:45:01.1527652Z 2025-12-04T08:45:01.1527966Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T08:45:01.1528899Z separated by a line containing "---". If the line is not present, the 2025-12-04T08:45:01.1529630Z settings are considered to be empty with only the second part, the user 2025-12-04T08:45:01.1530198Z list, defined. 2025-12-04T08:45:01.1530390Z 2025-12-04T08:45:01.1530690Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T08:45:01.1531441Z used to define any settings that are needed to determine which runners to use. 2025-12-04T08:45:01.1532125Z It's fields are defined by the RolloutSettings class below. 2025-12-04T08:45:01.1532491Z 2025-12-04T08:45:01.1532806Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T08:45:01.1533655Z The user list is also a comma separated list of additional features or 2025-12-04T08:45:01.1534272Z experiments which the user could be opted in to. 2025-12-04T08:45:01.1534603Z 2025-12-04T08:45:01.1534770Z The user list has the following rules: 2025-12-04T08:45:01.1535067Z 2025-12-04T08:45:01.1535342Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T08:45:01.1536055Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T08:45:01.1536684Z - A "#" prefix opts the user out of all experiments 2025-12-04T08:45:01.1537012Z 2025-12-04T08:45:01.1537155Z Example config: 2025-12-04T08:45:01.1537525Z # A list of experiments that can be opted into. 2025-12-04T08:45:01.1538084Z # This defines the behavior they'll induce when opted into. 2025-12-04T08:45:01.1538589Z # Expected syntax is: 2025-12-04T08:45:01.1539123Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T08:45:01.1539925Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T08:45:01.1540444Z 2025-12-04T08:45:01.1540583Z experiments: 2025-12-04T08:45:01.1540904Z lf: 2025-12-04T08:45:01.1541207Z rollout_percent: 25 2025-12-04T08:45:01.1541586Z all_branches: false 2025-12-04T08:45:01.1542048Z default: true 2025-12-04T08:45:01.1542388Z --- 2025-12-04T08:45:01.1542550Z 2025-12-04T08:45:01.1542681Z # Opt-ins: 2025-12-04T08:45:01.1543315Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T08:45:01.1544028Z # and specifying experiments to enable in a comma-separated list. 2025-12-04T08:45:01.1544669Z # To always opt out of an experiment, prefix it with a "-". 2025-12-04T08:45:01.1545221Z # Experiments should be from the above list. 2025-12-04T08:45:01.1545559Z 2025-12-04T08:45:01.1545714Z @User1,-lf,split_build 2025-12-04T08:45:01.1546069Z @User2,lf 2025-12-04T08:45:01.1546380Z @User3,split_build 2025-12-04T08:45:01.1546712Z """ 2025-12-04T08:45:01.1546869Z 2025-12-04T08:45:01.1546997Z import json 2025-12-04T08:45:01.1547301Z import logging 2025-12-04T08:45:01.1547608Z import os 2025-12-04T08:45:01.1547909Z import random 2025-12-04T08:45:01.1548212Z import re 2025-12-04T08:45:01.1548513Z import sys 2025-12-04T08:45:01.1548846Z from argparse import ArgumentParser 2025-12-04T08:45:01.1549274Z from collections.abc import Iterable 2025-12-04T08:45:01.1549703Z from functools import cache 2025-12-04T08:45:01.1550088Z from logging import LogRecord 2025-12-04T08:45:01.1550492Z from typing import Any, NamedTuple 2025-12-04T08:45:01.1550933Z from urllib.request import Request, urlopen 2025-12-04T08:45:01.1551245Z 2025-12-04T08:45:01.1551376Z import yaml 2025-12-04T08:45:01.1551691Z from github import Auth, Github 2025-12-04T08:45:01.1552098Z from github.Issue import Issue 2025-12-04T08:45:01.1552340Z 2025-12-04T08:45:01.1552346Z 2025-12-04T08:45:01.1552530Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T08:45:01.1553755Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T08:45:01.1554514Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T08:45:01.1554966Z 2025-12-04T08:45:01.1555155Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T08:45:01.1555756Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T08:45:01.1556172Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T08:45:01.1556638Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T08:45:01.1556932Z 2025-12-04T08:45:01.1557098Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T08:45:01.1557374Z 2025-12-04T08:45:01.1557522Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T08:45:01.1557907Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T08:45:01.1558138Z 2025-12-04T08:45:01.1558144Z 2025-12-04T08:45:01.1558296Z class Experiment(NamedTuple): 2025-12-04T08:45:01.1558715Z rollout_perc: float = ( 2025-12-04T08:45:01.1559240Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T08:45:01.1559811Z ) 2025-12-04T08:45:01.1560121Z all_branches: bool = ( 2025-12-04T08:45:01.1560631Z False # If True, the experiment is also enabled on the exception branches 2025-12-04T08:45:01.1561195Z ) 2025-12-04T08:45:01.1561485Z default: bool = ( 2025-12-04T08:45:01.1561960Z True # If True, the experiment is enabled by default for all queries 2025-12-04T08:45:01.1562481Z ) 2025-12-04T08:45:01.1562642Z 2025-12-04T08:45:01.1562785Z # Add more fields as needed 2025-12-04T08:45:01.1563152Z 2025-12-04T08:45:01.1563162Z 2025-12-04T08:45:01.1563346Z class Settings(NamedTuple): 2025-12-04T08:45:01.1563702Z """ 2025-12-04T08:45:01.1564079Z Settings for the experiments that can be opted into. 2025-12-04T08:45:01.1564544Z """ 2025-12-04T08:45:01.1564701Z 2025-12-04T08:45:01.1564882Z experiments: dict[str, Experiment] = {} 2025-12-04T08:45:01.1565178Z 2025-12-04T08:45:01.1565184Z 2025-12-04T08:45:01.1565351Z class ColorFormatter(logging.Formatter): 2025-12-04T08:45:01.1565871Z """Color codes the log messages based on the log level""" 2025-12-04T08:45:01.1566225Z 2025-12-04T08:45:01.1566360Z COLORS = { 2025-12-04T08:45:01.1566680Z "WARNING": "\033[33m", # Yellow 2025-12-04T08:45:01.1567189Z "ERROR": "\033[31m", # Red 2025-12-04T08:45:01.1567588Z "CRITICAL": "\033[31m", # Red 2025-12-04T08:45:01.1567997Z "INFO": "\033[0m", # Reset 2025-12-04T08:45:01.1568384Z "DEBUG": "\033[0m", # Reset 2025-12-04T08:45:01.1568765Z } 2025-12-04T08:45:01.1568921Z 2025-12-04T08:45:01.1569100Z def format(self, record: LogRecord) -> str: 2025-12-04T08:45:01.1569718Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T08:45:01.1570362Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T08:45:01.1570832Z return super().format(record) 2025-12-04T08:45:01.1571108Z 2025-12-04T08:45:01.1571113Z 2025-12-04T08:45:01.1571276Z handler = logging.StreamHandler() 2025-12-04T08:45:01.1571845Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T08:45:01.1572303Z 2025-12-04T08:45:01.1572504Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T08:45:01.1572970Z log.addHandler(handler) 2025-12-04T08:45:01.1573505Z log.setLevel(logging.INFO) 2025-12-04T08:45:01.1573741Z 2025-12-04T08:45:01.1573746Z 2025-12-04T08:45:01.1573957Z def set_github_output(key: str, value: str) -> None: 2025-12-04T08:45:01.1574410Z """ 2025-12-04T08:45:01.1574825Z Defines outputs of the github action that invokes this script 2025-12-04T08:45:01.1575322Z """ 2025-12-04T08:45:01.1575623Z if not GITHUB_OUTPUT: 2025-12-04T08:45:01.1576512Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T08:45:01.1577435Z log.warning( 2025-12-04T08:45:01.1578137Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T08:45:01.1578896Z ) 2025-12-04T08:45:01.1588724Z print(f"::set-output name={key}::{value}") 2025-12-04T08:45:01.1589246Z return 2025-12-04T08:45:01.1589447Z 2025-12-04T08:45:01.1589642Z with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T08:45:01.1590279Z log.info(f"Setting output: {key}='{value}'") 2025-12-04T08:45:01.1590766Z f.write(f"{key}={value}\n") 2025-12-04T08:45:01.1591032Z 2025-12-04T08:45:01.1591038Z 2025-12-04T08:45:01.1591298Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T08:45:01.1591813Z return frozenset( 2025-12-04T08:45:01.1592336Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T08:45:01.1592909Z ) 2025-12-04T08:45:01.1593318Z 2025-12-04T08:45:01.1593326Z 2025-12-04T08:45:01.1593479Z def parse_args() -> Any: 2025-12-04T08:45:01.1593939Z parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T08:45:01.1594659Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T08:45:01.1595299Z parser.add_argument( 2025-12-04T08:45:01.1595671Z "--github-issue-repo", 2025-12-04T08:45:01.1596049Z type=str, 2025-12-04T08:45:01.1596382Z required=False, 2025-12-04T08:45:01.1596749Z default="pytorch/test-infra", 2025-12-04T08:45:01.1597180Z help="GitHub repo to get the issue", 2025-12-04T08:45:01.1597593Z ) 2025-12-04T08:45:01.1597883Z parser.add_argument( 2025-12-04T08:45:01.1598241Z "--github-repo", 2025-12-04T08:45:01.1598575Z type=str, 2025-12-04T08:45:01.1598893Z required=True, 2025-12-04T08:45:01.1599263Z help="GitHub repo where CI is running", 2025-12-04T08:45:01.1599684Z ) 2025-12-04T08:45:01.1599983Z parser.add_argument( 2025-12-04T08:45:01.1600466Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T08:45:01.1601004Z ) 2025-12-04T08:45:01.1601287Z parser.add_argument( 2025-12-04T08:45:01.1601802Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T08:45:01.1602346Z ) 2025-12-04T08:45:01.1602642Z parser.add_argument( 2025-12-04T08:45:01.1603534Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T08:45:01.1604110Z ) 2025-12-04T08:45:01.1604396Z parser.add_argument( 2025-12-04T08:45:01.1604940Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T08:45:01.1605530Z ) 2025-12-04T08:45:01.1605818Z parser.add_argument( 2025-12-04T08:45:01.1606189Z "--github-ref-type", 2025-12-04T08:45:01.1606549Z type=str, 2025-12-04T08:45:01.1606873Z required=True, 2025-12-04T08:45:01.1607260Z help="Current GitHub ref type, branch or tag", 2025-12-04T08:45:01.1607701Z ) 2025-12-04T08:45:01.1607993Z parser.add_argument( 2025-12-04T08:45:01.1608369Z "--eligible-experiments", 2025-12-04T08:45:01.1608785Z type=_str_comma_separated_to_set, 2025-12-04T08:45:01.1609206Z required=False, 2025-12-04T08:45:01.1609542Z default="", 2025-12-04T08:45:01.1610235Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T08:45:01.1611004Z ) 2025-12-04T08:45:01.1611292Z parser.add_argument( 2025-12-04T08:45:01.1611670Z "--opt-out-experiments", 2025-12-04T08:45:01.1612073Z type=_str_comma_separated_to_set, 2025-12-04T08:45:01.1612502Z required=False, 2025-12-04T08:45:01.1612831Z default="", 2025-12-04T08:45:01.1613304Z help=( 2025-12-04T08:45:01.1613875Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T08:45:01.1614817Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T08:45:01.1615539Z ), 2025-12-04T08:45:01.1615824Z ) 2025-12-04T08:45:01.1616133Z parser.add_argument( 2025-12-04T08:45:01.1616484Z "--pr-number", 2025-12-04T08:45:01.1616832Z type=str, 2025-12-04T08:45:01.1617156Z required=False, 2025-12-04T08:45:01.1617506Z default="", 2025-12-04T08:45:01.1617983Z help="the optional PR number where this is run", 2025-12-04T08:45:01.1618441Z ) 2025-12-04T08:45:01.1618598Z 2025-12-04T08:45:01.1618757Z return parser.parse_args() 2025-12-04T08:45:01.1619004Z 2025-12-04T08:45:01.1619010Z 2025-12-04T08:45:01.1619338Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T08:45:01.1619958Z auth = Auth.Token(github_token) 2025-12-04T08:45:01.1620365Z return Github(auth=auth) 2025-12-04T08:45:01.1620616Z 2025-12-04T08:45:01.1620623Z 2025-12-04T08:45:01.1620998Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T08:45:01.1621661Z repo = gh.get_repo(repo) 2025-12-04T08:45:01.1622062Z return repo.get_issue(number=issue_num) 2025-12-04T08:45:01.1622352Z 2025-12-04T08:45:01.1622358Z 2025-12-04T08:45:01.1622515Z def get_potential_pr_author( 2025-12-04T08:45:01.1623212Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T08:45:01.1623792Z ) -> str: 2025-12-04T08:45:01.1624213Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T08:45:01.1624877Z # Fetch the actual username from the original PR. The PR number is 2025-12-04T08:45:01.1625486Z # embedded in the tag name: ciflow// 2025-12-04T08:45:01.1625826Z 2025-12-04T08:45:01.1625976Z gh = get_gh_client(github_token) 2025-12-04T08:45:01.1626247Z 2025-12-04T08:45:01.1626470Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T08:45:01.1626970Z split_tag = ref_name.split("/") 2025-12-04T08:45:01.1627384Z if ( 2025-12-04T08:45:01.1627695Z len(split_tag) == 3 2025-12-04T08:45:01.1628090Z and split_tag[0] == "ciflow" 2025-12-04T08:45:01.1628515Z and split_tag[2].isnumeric() 2025-12-04T08:45:01.1628911Z ): 2025-12-04T08:45:01.1629222Z pr_number = split_tag[2] 2025-12-04T08:45:01.1629682Z try: 2025-12-04T08:45:01.1630034Z repository = gh.get_repo(repo) 2025-12-04T08:45:01.1630533Z pull = repository.get_pull(number=int(pr_number)) 2025-12-04T08:45:01.1631030Z except Exception as e: 2025-12-04T08:45:01.1631449Z raise Exception( # noqa: TRY002 2025-12-04T08:45:01.1632000Z f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T08:45:01.1632524Z ) from e 2025-12-04T08:45:01.1632969Z return pull.user.login # type: ignore[no-any-return] 2025-12-04T08:45:01.1633711Z # In all other cases, return the original input username 2025-12-04T08:45:01.1634187Z return username 2025-12-04T08:45:01.1634383Z 2025-12-04T08:45:01.1634402Z 2025-12-04T08:45:01.1634584Z def is_exception_branch(branch: str) -> bool: 2025-12-04T08:45:01.1635012Z """ 2025-12-04T08:45:01.1635539Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T08:45:01.1636168Z """ 2025-12-04T08:45:01.1636618Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T08:45:01.1637046Z 2025-12-04T08:45:01.1637053Z 2025-12-04T08:45:01.1637218Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T08:45:01.1637612Z try: 2025-12-04T08:45:01.1637931Z data = yaml.safe_load(yaml_text) 2025-12-04T08:45:01.1638340Z return data 2025-12-04T08:45:01.1638678Z except yaml.YAMLError: 2025-12-04T08:45:01.1639062Z log.exception("Error loading YAML") 2025-12-04T08:45:01.1639474Z raise 2025-12-04T08:45:01.1639648Z 2025-12-04T08:45:01.1639654Z 2025-12-04T08:45:01.1639998Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T08:45:01.1640593Z """ 2025-12-04T08:45:01.1641097Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T08:45:01.1641589Z 2025-12-04T08:45:01.1641943Z If the issue body contains "---" then the text above that is the settings 2025-12-04T08:45:01.1642575Z and the text below is the list of opted in users. 2025-12-04T08:45:01.1642902Z 2025-12-04T08:45:01.1643343Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T08:45:01.1643923Z """ 2025-12-04T08:45:01.1644291Z rollout_state_parts = rollout_state.split("---") 2025-12-04T08:45:01.1644773Z if len(rollout_state_parts) >= 2: 2025-12-04T08:45:01.1645264Z return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T08:45:01.1645759Z else: 2025-12-04T08:45:01.1646071Z return "", rollout_state 2025-12-04T08:45:01.1646315Z 2025-12-04T08:45:01.1646322Z 2025-12-04T08:45:01.1646480Z class UserOptins(dict[str, list[str]]): 2025-12-04T08:45:01.1646887Z """ 2025-12-04T08:45:01.1647304Z Dictionary of users with a list of features they have opted into 2025-12-04T08:45:01.1647827Z """ 2025-12-04T08:45:01.1647982Z 2025-12-04T08:45:01.1647994Z 2025-12-04T08:45:01.1648277Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T08:45:01.1648799Z """ 2025-12-04T08:45:01.1649376Z 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:45:01.1649940Z 2025-12-04T08:45:01.1650447Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T08:45:01.1651264Z - Example line: "@User1,lf,split_build" 2025-12-04T08:45:01.1651819Z - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T08:45:01.1652211Z 2025-12-04T08:45:01.1652217Z 2025-12-04T08:45:01.1652335Z """ 2025-12-04T08:45:01.1652632Z optins = UserOptins() 2025-12-04T08:45:01.1653023Z for user in user_optin_text.split("\n"): 2025-12-04T08:45:01.1653623Z user = user.strip("\r\n\t -") 2025-12-04T08:45:01.1654056Z if not user or not user.startswith("@"): 2025-12-04T08:45:01.1654599Z # Not a valid user. Skip 2025-12-04T08:45:01.1654989Z continue 2025-12-04T08:45:01.1655191Z 2025-12-04T08:45:01.1655315Z if user: 2025-12-04T08:45:01.1655673Z usr_name = user.split(",")[0].strip("@") 2025-12-04T08:45:01.1656235Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T08:45:01.1656653Z 2025-12-04T08:45:01.1656785Z return optins 2025-12-04T08:45:01.1656979Z 2025-12-04T08:45:01.1656985Z 2025-12-04T08:45:01.1657213Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T08:45:01.1657701Z """ 2025-12-04T08:45:01.1658020Z Check if the experiment name is valid. 2025-12-04T08:45:01.1658435Z A valid name: 2025-12-04T08:45:01.1658951Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T08:45:01.1659710Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T08:45:01.1660297Z - Cannot contain spaces 2025-12-04T08:45:01.1660664Z """ 2025-12-04T08:45:01.1660829Z 2025-12-04T08:45:01.1661040Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T08:45:01.1661602Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T08:45:01.1661975Z 2025-12-04T08:45:01.1662100Z if valid: 2025-12-04T08:45:01.1662408Z return True 2025-12-04T08:45:01.1662598Z 2025-12-04T08:45:01.1662725Z log.error( 2025-12-04T08:45:01.1664080Z 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:45:01.1665361Z ) 2025-12-04T08:45:01.1665646Z return False 2025-12-04T08:45:01.1665840Z 2025-12-04T08:45:01.1665846Z 2025-12-04T08:45:01.1666103Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T08:45:01.1666594Z """ 2025-12-04T08:45:01.1667148Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T08:45:01.1667722Z """ 2025-12-04T08:45:01.1668004Z try: 2025-12-04T08:45:01.1668295Z if settings_text: 2025-12-04T08:45:01.1668884Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T08:45:01.1669537Z # for easy reading 2025-12-04T08:45:01.1670172Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T08:45:01.1670903Z # the backtick character in shell commands. 2025-12-04T08:45:01.1671390Z backtick = chr(96) # backtick character 2025-12-04T08:45:01.1671937Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T08:45:01.1672474Z settings = load_yaml(settings_text) 2025-12-04T08:45:01.1672781Z 2025-12-04T08:45:01.1673253Z # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T08:45:01.1673883Z experiments = {} 2025-12-04T08:45:01.1674122Z 2025-12-04T08:45:01.1674436Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T08:45:01.1675057Z if not is_valid_experiment_name(exp_name): 2025-12-04T08:45:01.1675948Z # 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:45:01.1676796Z continue 2025-12-04T08:45:01.1677023Z 2025-12-04T08:45:01.1677173Z valid_settings = {} 2025-12-04T08:45:01.1677583Z for setting in exp_settings: 2025-12-04T08:45:01.1678048Z if setting not in Experiment._fields: 2025-12-04T08:45:01.1678497Z log.warning( 2025-12-04T08:45:01.1679070Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T08:45:01.1679720Z ) 2025-12-04T08:45:01.1680066Z else: 2025-12-04T08:45:01.1680481Z valid_settings[setting] = exp_settings[setting] 2025-12-04T08:45:01.1680838Z 2025-12-04T08:45:01.1681060Z experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T08:45:01.1681574Z return Settings(experiments) 2025-12-04T08:45:01.1681856Z 2025-12-04T08:45:01.1681994Z except Exception: 2025-12-04T08:45:01.1682381Z log.exception("Failed to parse settings") 2025-12-04T08:45:01.1682699Z 2025-12-04T08:45:01.1682831Z return Settings() 2025-12-04T08:45:01.1683110Z 2025-12-04T08:45:01.1683116Z 2025-12-04T08:45:01.1683320Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T08:45:01.1683778Z """ 2025-12-04T08:45:01.1684119Z Parse settings, if any, from the rollout state. 2025-12-04T08:45:01.1684443Z 2025-12-04T08:45:01.1684737Z If the issue body contains "---" then the text above that is the settings 2025-12-04T08:45:01.1685372Z and the text below is the list of opted in users. 2025-12-04T08:45:01.1685715Z 2025-12-04T08:45:01.1686057Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T08:45:01.1686682Z """ 2025-12-04T08:45:01.1687128Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:45:01.1687752Z return parse_settings_from_text(settings_text) 2025-12-04T08:45:01.1688073Z 2025-12-04T08:45:01.1688080Z 2025-12-04T08:45:01.1688274Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T08:45:01.1688721Z """ 2025-12-04T08:45:01.1689027Z Parse users from the rollout state. 2025-12-04T08:45:01.1689318Z 2025-12-04T08:45:01.1689439Z """ 2025-12-04T08:45:01.1689857Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:45:01.1690458Z return parse_user_opt_in_from_text(users_text) 2025-12-04T08:45:01.1690779Z 2025-12-04T08:45:01.1690789Z 2025-12-04T08:45:01.1691206Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:45:01.1691807Z """ 2025-12-04T08:45:01.1692143Z Check if a user is opted into an experiment 2025-12-04T08:45:01.1692568Z """ 2025-12-04T08:45:01.1692930Z return experiment_name in user_optins.get(user, []) 2025-12-04T08:45:01.1693384Z 2025-12-04T08:45:01.1693390Z 2025-12-04T08:45:01.1693737Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:45:01.1694339Z """ 2025-12-04T08:45:01.1694711Z Check if a user explicitly opted out of an experiment 2025-12-04T08:45:01.1695169Z """ 2025-12-04T08:45:01.1695578Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T08:45:01.1696135Z experiment_optout = "-" + experiment_name 2025-12-04T08:45:01.1696663Z if experiment_optout not in user_optins.get(user, []): 2025-12-04T08:45:01.1697142Z return False 2025-12-04T08:45:01.1697357Z 2025-12-04T08:45:01.1697577Z if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T08:45:01.1698060Z log.warning( 2025-12-04T08:45:01.1698702Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T08:45:01.1699409Z ) 2025-12-04T08:45:01.1699571Z 2025-12-04T08:45:01.1699704Z return True 2025-12-04T08:45:01.1699893Z 2025-12-04T08:45:01.1699898Z 2025-12-04T08:45:01.1700033Z def get_runner_prefix( 2025-12-04T08:45:01.1700372Z rollout_state: str, 2025-12-04T08:45:01.1700745Z workflow_requestors: Iterable[str], 2025-12-04T08:45:01.1701156Z branch: str, 2025-12-04T08:45:01.1701539Z eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T08:45:01.1702078Z opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T08:45:01.1702545Z is_canary: bool = False, 2025-12-04T08:45:01.1702905Z ) -> str: 2025-12-04T08:45:01.1703297Z settings = parse_settings(rollout_state) 2025-12-04T08:45:01.1703870Z user_optins = parse_users(rollout_state) 2025-12-04T08:45:01.1704167Z 2025-12-04T08:45:01.1704302Z fleet_prefix = "" 2025-12-04T08:45:01.1704643Z prefixes = [] 2025-12-04T08:45:01.1705145Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T08:45:01.1705898Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T08:45:01.1706473Z log.info( 2025-12-04T08:45:01.1707019Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T08:45:01.1707639Z ) 2025-12-04T08:45:01.1707933Z continue 2025-12-04T08:45:01.1708142Z 2025-12-04T08:45:01.1708294Z if opt_out_experiments: 2025-12-04T08:45:01.1708716Z if experiment_name in opt_out_experiments: 2025-12-04T08:45:01.1709239Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T08:45:01.1709721Z log.info( 2025-12-04T08:45:01.1710467Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T08:45:01.1711260Z ) 2025-12-04T08:45:01.1711566Z continue 2025-12-04T08:45:01.1711790Z 2025-12-04T08:45:01.1711936Z if eligible_experiments: 2025-12-04T08:45:01.1712375Z if experiment_name not in eligible_experiments: 2025-12-04T08:45:01.1712892Z exp_list = ", ".join(eligible_experiments) 2025-12-04T08:45:01.1713408Z log.info( 2025-12-04T08:45:01.1714040Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T08:45:01.1714723Z ) 2025-12-04T08:45:01.1715054Z continue 2025-12-04T08:45:01.1715435Z elif not experiment_settings.default: 2025-12-04T08:45:01.1715855Z log.info( 2025-12-04T08:45:01.1716472Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T08:45:01.1717061Z ) 2025-12-04T08:45:01.1717363Z continue 2025-12-04T08:45:01.1717370Z 2025-12-04T08:45:01.1717591Z # Is any workflow_requestor opted out to this experiment? 2025-12-04T08:45:01.1717740Z opted_out_users = [ 2025-12-04T08:45:01.1717867Z requestor 2025-12-04T08:45:01.1718029Z for requestor in workflow_requestors 2025-12-04T08:45:01.1718270Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T08:45:01.1718398Z ] 2025-12-04T08:45:01.1718405Z 2025-12-04T08:45:01.1718541Z if opted_out_users: 2025-12-04T08:45:01.1718667Z log.info( 2025-12-04T08:45:01.1718976Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T08:45:01.1719098Z ) 2025-12-04T08:45:01.1719224Z continue 2025-12-04T08:45:01.1719235Z 2025-12-04T08:45:01.1719464Z # Is any workflow_requestor opted in to this experiment? 2025-12-04T08:45:01.1719604Z opted_in_users = [ 2025-12-04T08:45:01.1719732Z requestor 2025-12-04T08:45:01.1719894Z for requestor in workflow_requestors 2025-12-04T08:45:01.1720135Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T08:45:01.1720259Z ] 2025-12-04T08:45:01.1720267Z 2025-12-04T08:45:01.1720397Z enabled = False 2025-12-04T08:45:01.1720539Z if opted_in_users: 2025-12-04T08:45:01.1720669Z log.info( 2025-12-04T08:45:01.1720963Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T08:45:01.1721089Z ) 2025-12-04T08:45:01.1721223Z enabled = True 2025-12-04T08:45:01.1721229Z 2025-12-04T08:45:01.1721398Z elif experiment_settings.rollout_perc: 2025-12-04T08:45:01.1721771Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T08:45:01.1722093Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T08:45:01.1722225Z log.info( 2025-12-04T08:45:01.1722699Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T08:45:01.1722829Z ) 2025-12-04T08:45:01.1722966Z enabled = True 2025-12-04T08:45:01.1722973Z 2025-12-04T08:45:01.1723157Z if enabled: 2025-12-04T08:45:01.1723316Z label = experiment_name 2025-12-04T08:45:01.1723497Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T08:45:01.1723854Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T08:45:01.1724082Z # - If it's enabled, then we always list it's prefix first 2025-12-04T08:45:01.1724337Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T08:45:01.1724484Z if is_canary: 2025-12-04T08:45:01.1724640Z label += CANARY_FLEET_SUFFIX 2025-12-04T08:45:01.1724794Z fleet_prefix = label 2025-12-04T08:45:01.1724919Z else: 2025-12-04T08:45:01.1725071Z prefixes.append(label) 2025-12-04T08:45:01.1725078Z 2025-12-04T08:45:01.1725223Z if len(prefixes) > 1: 2025-12-04T08:45:01.1725351Z log.error( 2025-12-04T08:45:01.1725997Z 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:45:01.1726130Z ) 2025-12-04T08:45:01.1726281Z prefixes = prefixes[:1] 2025-12-04T08:45:01.1726288Z 2025-12-04T08:45:01.1726436Z # Fleet always comes first 2025-12-04T08:45:01.1726569Z if fleet_prefix: 2025-12-04T08:45:01.1726734Z prefixes.insert(0, fleet_prefix) 2025-12-04T08:45:01.1726744Z 2025-12-04T08:45:01.1727003Z return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T08:45:01.1727011Z 2025-12-04T08:45:01.1727017Z 2025-12-04T08:45:01.1727368Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T08:45:01.1727501Z """ 2025-12-04T08:45:01.1727814Z Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T08:45:01.1727821Z 2025-12-04T08:45:01.1728131Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T08:45:01.1728264Z """ 2025-12-04T08:45:01.1728417Z gh = get_gh_client(github_token) 2025-12-04T08:45:01.1728580Z issue = get_issue(gh, repo, issue_num) 2025-12-04T08:45:01.1728811Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T08:45:01.1728818Z 2025-12-04T08:45:01.1728823Z 2025-12-04T08:45:01.1729142Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T08:45:01.1729292Z for _ in range(num_retries): 2025-12-04T08:45:01.1729426Z try: 2025-12-04T08:45:01.1729597Z req = Request(url=url, headers=headers) 2025-12-04T08:45:01.1729831Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T08:45:01.1729983Z return json.loads(content) 2025-12-04T08:45:01.1730137Z except Exception as e: 2025-12-04T08:45:01.1730330Z log.warning(f"Could not download {url}: {e}") 2025-12-04T08:45:01.1730337Z 2025-12-04T08:45:01.1730639Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T08:45:01.1730879Z return {} 2025-12-04T08:45:01.1730888Z 2025-12-04T08:45:01.1730894Z 2025-12-04T08:45:01.1731096Z @cache 2025-12-04T08:45:01.1731554Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T08:45:01.1731689Z """ 2025-12-04T08:45:01.1731844Z Dynamically get PR information 2025-12-04T08:45:01.1731966Z """ 2025-12-04T08:45:01.1732284Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T08:45:01.1732427Z headers = { 2025-12-04T08:45:01.1732612Z "Accept": "application/vnd.github.v3+json", 2025-12-04T08:45:01.1732784Z "Authorization": f"token {github_token}", 2025-12-04T08:45:01.1732910Z } 2025-12-04T08:45:01.1733219Z json_response: dict[str, Any] = download_json( 2025-12-04T08:45:01.1733389Z url=f"{github_api}/issues/{pr_number}", 2025-12-04T08:45:01.1733524Z headers=headers, 2025-12-04T08:45:01.1733654Z ) 2025-12-04T08:45:01.1733661Z 2025-12-04T08:45:01.1733800Z if not json_response: 2025-12-04T08:45:01.1734031Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T08:45:01.1734169Z return {} 2025-12-04T08:45:01.1734177Z 2025-12-04T08:45:01.1734316Z return json_response 2025-12-04T08:45:01.1734323Z 2025-12-04T08:45:01.1734329Z 2025-12-04T08:45:01.1734646Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T08:45:01.1734790Z """ 2025-12-04T08:45:01.1735055Z Dynamically get the latest list of labels from the pull request 2025-12-04T08:45:01.1735177Z """ 2025-12-04T08:45:01.1735414Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T08:45:01.1735540Z return { 2025-12-04T08:45:01.1735840Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T08:45:01.1735967Z } 2025-12-04T08:45:01.1735973Z 2025-12-04T08:45:01.1735979Z 2025-12-04T08:45:01.1736120Z def main() -> None: 2025-12-04T08:45:01.1736260Z args = parse_args() 2025-12-04T08:45:01.1736266Z 2025-12-04T08:45:01.1736444Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T08:45:01.1736451Z 2025-12-04T08:45:01.1736612Z # Check if the PR is opt-out 2025-12-04T08:45:01.1736752Z if args.pr_number: 2025-12-04T08:45:01.1737061Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T08:45:01.1737222Z if OPT_OUT_LABEL in labels: 2025-12-04T08:45:01.1737421Z log.info( 2025-12-04T08:45:01.1737776Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T08:45:01.1737897Z ) 2025-12-04T08:45:01.1738169Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:45:01.1738321Z sys.exit() 2025-12-04T08:45:01.1738328Z 2025-12-04T08:45:01.1738456Z try: 2025-12-04T08:45:01.1738650Z rollout_state = get_rollout_state_from_issue( 2025-12-04T08:45:01.1738900Z args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T08:45:01.1739020Z ) 2025-12-04T08:45:01.1739028Z 2025-12-04T08:45:01.1739197Z username = get_potential_pr_author( 2025-12-04T08:45:01.1739340Z args.github_token, 2025-12-04T08:45:01.1739478Z args.github_repo, 2025-12-04T08:45:01.1739615Z args.github_actor, 2025-12-04T08:45:01.1739766Z args.github_ref_type, 2025-12-04T08:45:01.1739908Z args.github_branch, 2025-12-04T08:45:01.1740027Z ) 2025-12-04T08:45:01.1740034Z 2025-12-04T08:45:01.1740270Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T08:45:01.1740278Z 2025-12-04T08:45:01.1740446Z runner_label_prefix = get_runner_prefix( 2025-12-04T08:45:01.1740582Z rollout_state, 2025-12-04T08:45:01.1740766Z (args.github_issue_owner, username), 2025-12-04T08:45:01.1740905Z args.github_branch, 2025-12-04T08:45:01.1741058Z args.eligible_experiments, 2025-12-04T08:45:01.1741210Z args.opt_out_experiments, 2025-12-04T08:45:01.1741341Z is_canary, 2025-12-04T08:45:01.1741462Z ) 2025-12-04T08:45:01.1741469Z 2025-12-04T08:45:01.1741610Z except Exception as e: 2025-12-04T08:45:01.1741740Z log.error( 2025-12-04T08:45:01.1742096Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T08:45:01.1742295Z ) 2025-12-04T08:45:01.1742303Z 2025-12-04T08:45:01.1742573Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:45:01.1742579Z 2025-12-04T08:45:01.1742586Z 2025-12-04T08:45:01.1742724Z if __name__ == "__main__": 2025-12-04T08:45:01.1742843Z main() 2025-12-04T08:45:01.1742850Z 2025-12-04T08:45:01.1823163Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T08:45:01.1823471Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T08:45:01.1841718Z shell: /usr/bin/bash -e {0} 2025-12-04T08:45:01.1841854Z env: 2025-12-04T08:45:01.1842233Z GITHUB_TOKEN: *** 2025-12-04T08:45:01.1842373Z ISSUE_NUMBER: 5132 2025-12-04T08:45:01.1842522Z TRIGGERING_ACTOR: huydhn 2025-12-04T08:45:01.1842651Z ISSUE_OWNER: 2025-12-04T08:45:01.1842785Z CHECK_EXPERIMENTS: 2025-12-04T08:45:01.1842924Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:45:01.1843188Z PR_NUMBER: 2025-12-04T08:45:01.1843331Z ##[endgroup] 2025-12-04T08:45:02.1451336Z Defaulting to user installation because normal site-packages is not writeable 2025-12-04T08:45:02.8947611Z Collecting urllib3==1.26.18 2025-12-04T08:45:02.9751411Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-12-04T08:45:03.0075635Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 2.1 MB/s eta 0:00:00 2025-12-04T08:45:03.0433409Z Collecting PyGithub==2.3.0 2025-12-04T08:45:03.0628375Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-12-04T08:45:03.1227540Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-12-04T08:45:03.1417289Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.8 kB) 2025-12-04T08:45:03.1462047Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-12-04T08:45:03.1480799Z 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:45:03.1495902Z 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:45:03.1884857Z Collecting Deprecated (from PyGithub==2.3.0) 2025-12-04T08:45:03.2076620Z Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB) 2025-12-04T08:45:03.2289106Z 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:45:03.3791421Z Collecting cffi>=2.0.0 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T08:45:03.3980592Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-12-04T08:45:03.5570641Z Collecting wrapt<3,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-12-04T08:45:03.5760808Z 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:45:03.6110871Z Collecting pycparser (from cffi>=2.0.0->pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T08:45:03.6298647Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-12-04T08:45:03.6681974Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-12-04T08:45:03.6917957Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 6.3 MB/s eta 0:00:00 2025-12-04T08:45:03.7138981Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-12-04T08:45:03.7363161Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 16.8 MB/s eta 0:00:00 2025-12-04T08:45:03.7559870Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-12-04T08:45:03.7849213Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 51.2 MB/s eta 0:00:00 2025-12-04T08:45:03.8043979Z Downloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB) 2025-12-04T08:45:03.8265362Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-12-04T08:45:03.8316939Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 65.3 MB/s eta 0:00:00 2025-12-04T08:45:03.8508450Z 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:45:03.8554709Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.5/121.5 kB 40.4 MB/s eta 0:00:00 2025-12-04T08:45:03.8743377Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-12-04T08:45:03.8783235Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 48.0 MB/s eta 0:00:00 2025-12-04T08:45:04.1470471Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-12-04T08:45:04.6571240Z 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:45:04.7604313Z ##[group]Run curr_branch="main" 2025-12-04T08:45:04.7604607Z curr_branch="main" 2025-12-04T08:45:04.7604829Z curr_ref_type="branch" 2025-12-04T08:45:04.7605074Z echo "Current branch is '$curr_branch'" 2025-12-04T08:45:04.7605344Z  2025-12-04T08:45:04.7605520Z python3 runner_determinator.py \ 2025-12-04T08:45:04.7605799Z  --github-token "$GITHUB_TOKEN" \ 2025-12-04T08:45:04.7606044Z  --github-issue "$ISSUE_NUMBER" \ 2025-12-04T08:45:04.7606290Z  --github-branch "$curr_branch" \ 2025-12-04T08:45:04.7606532Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-12-04T08:45:04.7606795Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-12-04T08:45:04.7607076Z  --github-ref-type "$curr_ref_type" \ 2025-12-04T08:45:04.7607326Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-12-04T08:45:04.7607621Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-12-04T08:45:04.7607973Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-12-04T08:45:04.7608244Z  --pr-number "${PR_NUMBER}" 2025-12-04T08:45:04.7627793Z shell: /usr/bin/bash -e {0} 2025-12-04T08:45:04.7628034Z env: 2025-12-04T08:45:04.7628611Z GITHUB_TOKEN: *** 2025-12-04T08:45:04.7628810Z ISSUE_NUMBER: 5132 2025-12-04T08:45:04.7629009Z TRIGGERING_ACTOR: huydhn 2025-12-04T08:45:04.7629198Z ISSUE_OWNER: 2025-12-04T08:45:04.7629376Z CHECK_EXPERIMENTS: 2025-12-04T08:45:04.7629566Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:45:04.7629757Z PR_NUMBER: 2025-12-04T08:45:04.7629911Z ##[endgroup] 2025-12-04T08:45:04.7666584Z Current branch is 'main' 2025-12-04T08:45:06.9811287Z INFO : Based on rollout percentage of 75%, enabling experiment lf. 2025-12-04T08:45:06.9812425Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-12-04T08:45:06.9813427Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-12-04T08:45:06.9814329Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-12-04T08:45:06.9815023Z INFO : Setting output: label-type='lf.' 2025-12-04T08:45:07.0177383Z Evaluate and set job outputs 2025-12-04T08:45:07.0184817Z Set output 'label-type' 2025-12-04T08:45:07.0186603Z Cleaning up orphan processes