2025-07-17T06:33:19.3030971Z Current runner version: '2.326.0' 2025-07-17T06:33:19.3054124Z ##[group]Runner Image Provisioner 2025-07-17T06:33:19.3055275Z Hosted Compute Agent 2025-07-17T06:33:19.3056041Z Version: 20250711.363 2025-07-17T06:33:19.3056588Z Commit: 6785254374ce925a23743850c1cb91912ce5c14c 2025-07-17T06:33:19.3057245Z Build Date: 2025-07-11T20:04:25Z 2025-07-17T06:33:19.3057863Z ##[endgroup] 2025-07-17T06:33:19.3058409Z ##[group]Operating System 2025-07-17T06:33:19.3058934Z Ubuntu 2025-07-17T06:33:19.3059454Z 24.04.2 2025-07-17T06:33:19.3059875Z LTS 2025-07-17T06:33:19.3060321Z ##[endgroup] 2025-07-17T06:33:19.3060854Z ##[group]Runner Image 2025-07-17T06:33:19.3061589Z Image: ubuntu-24.04 2025-07-17T06:33:19.3062078Z Version: 20250710.1.0 2025-07-17T06:33:19.3063427Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250710.1/images/ubuntu/Ubuntu2404-Readme.md 2025-07-17T06:33:19.3064956Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250710.1 2025-07-17T06:33:19.3065943Z ##[endgroup] 2025-07-17T06:33:19.3066993Z ##[group]GITHUB_TOKEN Permissions 2025-07-17T06:33:19.3068840Z Contents: read 2025-07-17T06:33:19.3069359Z Metadata: read 2025-07-17T06:33:19.3069857Z Packages: read 2025-07-17T06:33:19.3070287Z ##[endgroup] 2025-07-17T06:33:19.3072561Z Secret source: Actions 2025-07-17T06:33:19.3073993Z Prepare workflow directory 2025-07-17T06:33:19.3582894Z Prepare all required actions 2025-07-17T06:33:19.3638881Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (a38f433be2e94a64b095a44ba39879d02d0c2316) 2025-07-17T06:33:19.3643782Z ##[group] Inputs 2025-07-17T06:33:19.3644349Z check_experiments: 2025-07-17T06:33:19.3645009Z opt_out_experiments: 2025-07-17T06:33:19.3645547Z triggering_actor: pytorchmergebot 2025-07-17T06:33:19.3646183Z issue_owner: 2025-07-17T06:33:19.3646689Z curr_branch: main 2025-07-17T06:33:19.3647297Z curr_ref_type: branch 2025-07-17T06:33:19.3647868Z issue_number: 5132 2025-07-17T06:33:19.3648378Z ##[endgroup] 2025-07-17T06:33:19.3648964Z Complete job name: get-label-type / runner-determinator 2025-07-17T06:33:19.4226713Z ##[group]Run cat < runner_determinator.py 2025-07-17T06:33:19.4229364Z cat < runner_determinator.py 2025-07-17T06:33:19.4230185Z # flake8: noqa: G004 2025-07-17T06:33:19.4230903Z  2025-07-17T06:33:19.4231755Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:19.4233578Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:19.4235119Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:19.4236199Z  2025-07-17T06:33:19.4237024Z """ 2025-07-17T06:33:19.4238218Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:19.4239915Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:19.4241925Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:19.4243554Z of which runners should be used to run which job. 2025-07-17T06:33:19.4244666Z  2025-07-17T06:33:19.4245716Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:19.4247382Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:19.4249064Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:19.4250470Z list, defined. 2025-07-17T06:33:19.4251343Z  2025-07-17T06:33:19.4252622Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:19.4254373Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:19.4255921Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:19.4257516Z  2025-07-17T06:33:19.4258670Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:19.4260260Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:19.4261797Z experiments which the user could be opted in to. 2025-07-17T06:33:19.4263017Z  2025-07-17T06:33:19.4263864Z The user list has the following rules: 2025-07-17T06:33:19.4265114Z  2025-07-17T06:33:19.4266298Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:19.4267964Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:19.4269423Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:19.4270579Z  2025-07-17T06:33:19.4271335Z Example config: 2025-07-17T06:33:19.4272672Z  # A list of experiments that can be opted into. 2025-07-17T06:33:19.4273792Z  # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:19.4274474Z  # Expected syntax is: 2025-07-17T06:33:19.4275344Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:19.4276366Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:19.4277200Z  2025-07-17T06:33:19.4277710Z  experiments: 2025-07-17T06:33:19.4278212Z  lf: 2025-07-17T06:33:19.4278690Z  rollout_percent: 25 2025-07-17T06:33:19.4279318Z  all_branches: false 2025-07-17T06:33:19.4279882Z  default: true 2025-07-17T06:33:19.4280379Z  --- 2025-07-17T06:33:19.4280907Z  2025-07-17T06:33:19.4281343Z  # Opt-ins: 2025-07-17T06:33:19.4282054Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:19.4283697Z  # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:19.4284632Z  # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:19.4285376Z  # Experiments should be from the above list. 2025-07-17T06:33:19.4286064Z  2025-07-17T06:33:19.4286595Z  @User1,-lf,split_build 2025-07-17T06:33:19.4287138Z  @User2,lf 2025-07-17T06:33:19.4287683Z  @User3,split_build 2025-07-17T06:33:19.4288219Z """ 2025-07-17T06:33:19.4288624Z  2025-07-17T06:33:19.4289147Z import json 2025-07-17T06:33:19.4289611Z import logging 2025-07-17T06:33:19.4290186Z import os 2025-07-17T06:33:19.4290728Z import random 2025-07-17T06:33:19.4291196Z import re 2025-07-17T06:33:19.4291704Z import sys 2025-07-17T06:33:19.4292235Z from argparse import ArgumentParser 2025-07-17T06:33:19.4293258Z from collections.abc import Iterable 2025-07-17T06:33:19.4293883Z from functools import cache 2025-07-17T06:33:19.4294549Z from logging import LogRecord 2025-07-17T06:33:19.4295168Z from typing import Any, NamedTuple 2025-07-17T06:33:19.4295809Z from urllib.request import Request, urlopen 2025-07-17T06:33:19.4296525Z  2025-07-17T06:33:19.4296966Z import yaml 2025-07-17T06:33:19.4297494Z from github import Auth, Github 2025-07-17T06:33:19.4298182Z from github.Issue import Issue 2025-07-17T06:33:19.4298721Z  2025-07-17T06:33:19.4299139Z  2025-07-17T06:33:19.4299735Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:19.4300572Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:19.4301505Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:19.4302785Z  2025-07-17T06:33:19.4303344Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:19.4303991Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:19.4304738Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:19.4305379Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:19.4305983Z  2025-07-17T06:33:19.4306472Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:19.4307075Z  2025-07-17T06:33:19.4307538Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:19.4308149Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:19.4308722Z  2025-07-17T06:33:19.4309131Z  2025-07-17T06:33:19.4309646Z class Experiment(NamedTuple): 2025-07-17T06:33:19.4310216Z  rollout_perc: float = ( 2025-07-17T06:33:19.4310994Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:19.4311832Z  ) 2025-07-17T06:33:19.4312287Z  all_branches: bool = ( 2025-07-17T06:33:19.4313392Z  False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:19.4314172Z  ) 2025-07-17T06:33:19.4314675Z  default: bool = ( 2025-07-17T06:33:19.4315354Z  True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:19.4316160Z  ) 2025-07-17T06:33:19.4316758Z  2025-07-17T06:33:19.4317186Z  # Add more fields as needed 2025-07-17T06:33:19.4317800Z  2025-07-17T06:33:19.4318195Z  2025-07-17T06:33:19.4318655Z class Settings(NamedTuple): 2025-07-17T06:33:19.4319243Z  """ 2025-07-17T06:33:19.4319839Z  Settings for the experiments that can be opted into. 2025-07-17T06:33:19.4320473Z  """ 2025-07-17T06:33:19.4320951Z  2025-07-17T06:33:19.4321470Z  experiments: dict[str, Experiment] = {} 2025-07-17T06:33:19.4322043Z  2025-07-17T06:33:19.4322973Z  2025-07-17T06:33:19.4323514Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:19.4324278Z  """Color codes the log messages based on the log level""" 2025-07-17T06:33:19.4324911Z  2025-07-17T06:33:19.4325430Z  COLORS = { 2025-07-17T06:33:19.4325996Z  "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:19.4326569Z  "ERROR": "\033[31m", # Red 2025-07-17T06:33:19.4327325Z  "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:19.4327898Z  "INFO": "\033[0m", # Reset 2025-07-17T06:33:19.4328535Z  "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:19.4329095Z  } 2025-07-17T06:33:19.4329585Z  2025-07-17T06:33:19.4330128Z  def format(self, record: LogRecord) -> str: 2025-07-17T06:33:19.4330976Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:19.4331853Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:19.4332682Z  return super().format(record) 2025-07-17T06:33:19.4333354Z  2025-07-17T06:33:19.4333749Z  2025-07-17T06:33:19.4334241Z handler = logging.StreamHandler() 2025-07-17T06:33:19.4335133Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:19.4335902Z  2025-07-17T06:33:19.4336438Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:19.4337154Z log.addHandler(handler) 2025-07-17T06:33:19.4337754Z log.setLevel(logging.INFO) 2025-07-17T06:33:19.4338336Z  2025-07-17T06:33:19.4338759Z  2025-07-17T06:33:19.4339304Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:19.4339915Z  """ 2025-07-17T06:33:19.4340633Z  Defines outputs of the github action that invokes this script 2025-07-17T06:33:19.4341502Z  """ 2025-07-17T06:33:19.4341967Z  if not GITHUB_OUTPUT: 2025-07-17T06:33:19.4343506Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:33:19.4344673Z  log.warning( 2025-07-17T06:33:19.4345605Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-07-17T06:33:19.4413559Z  ) 2025-07-17T06:33:19.4414426Z  print(f"::set-output name={key}::{value}") 2025-07-17T06:33:19.4415381Z  return 2025-07-17T06:33:19.4416096Z  2025-07-17T06:33:19.4416811Z  with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:19.4417865Z  log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:19.4418584Z  f.write(f"{key}={value}\n") 2025-07-17T06:33:19.4419085Z  2025-07-17T06:33:19.4419421Z  2025-07-17T06:33:19.4419933Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:19.4420586Z  return frozenset( 2025-07-17T06:33:19.4421246Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:19.4421934Z  ) 2025-07-17T06:33:19.4422286Z  2025-07-17T06:33:19.4422870Z  2025-07-17T06:33:19.4423232Z def parse_args() -> Any: 2025-07-17T06:33:19.4423834Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:19.4424709Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:19.4425449Z  parser.add_argument( 2025-07-17T06:33:19.4425925Z  "--github-issue-repo", 2025-07-17T06:33:19.4426403Z  type=str, 2025-07-17T06:33:19.4426830Z  required=False, 2025-07-17T06:33:19.4427493Z  default="pytorch/test-infra", 2025-07-17T06:33:19.4428055Z  help="GitHub repo to get the issue", 2025-07-17T06:33:19.4428553Z  ) 2025-07-17T06:33:19.4428925Z  parser.add_argument( 2025-07-17T06:33:19.4429377Z  "--github-repo", 2025-07-17T06:33:19.4429822Z  type=str, 2025-07-17T06:33:19.4430241Z  required=True, 2025-07-17T06:33:19.4430742Z  help="GitHub repo where CI is running", 2025-07-17T06:33:19.4431248Z  ) 2025-07-17T06:33:19.4431620Z  parser.add_argument( 2025-07-17T06:33:19.4432248Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:19.4433209Z  ) 2025-07-17T06:33:19.4433590Z  parser.add_argument( 2025-07-17T06:33:19.4434233Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:19.4434901Z  ) 2025-07-17T06:33:19.4435271Z  parser.add_argument( 2025-07-17T06:33:19.4435917Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:19.4436585Z  ) 2025-07-17T06:33:19.4436954Z  parser.add_argument( 2025-07-17T06:33:19.4437628Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:19.4438325Z  ) 2025-07-17T06:33:19.4438692Z  parser.add_argument( 2025-07-17T06:33:19.4439166Z  "--github-ref-type", 2025-07-17T06:33:19.4439631Z  type=str, 2025-07-17T06:33:19.4440055Z  required=True, 2025-07-17T06:33:19.4440565Z  help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:19.4441098Z  ) 2025-07-17T06:33:19.4441470Z  parser.add_argument( 2025-07-17T06:33:19.4442097Z  "--eligible-experiments", 2025-07-17T06:33:19.4442930Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:19.4443450Z  required=False, 2025-07-17T06:33:19.4443890Z  default="", 2025-07-17T06:33:19.4444747Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:19.4445631Z  ) 2025-07-17T06:33:19.4446003Z  parser.add_argument( 2025-07-17T06:33:19.4446491Z  "--opt-out-experiments", 2025-07-17T06:33:19.4447022Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:19.4447528Z  required=False, 2025-07-17T06:33:19.4447975Z  default="", 2025-07-17T06:33:19.4448390Z  help=( 2025-07-17T06:33:19.4449066Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:19.4450180Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:19.4450992Z  ), 2025-07-17T06:33:19.4451371Z  ) 2025-07-17T06:33:19.4451740Z  parser.add_argument( 2025-07-17T06:33:19.4452191Z  "--pr-number", 2025-07-17T06:33:19.4452832Z  type=str, 2025-07-17T06:33:19.4453254Z  required=False, 2025-07-17T06:33:19.4453691Z  default="", 2025-07-17T06:33:19.4454195Z  help="the optional PR number where this is run", 2025-07-17T06:33:19.4454742Z  ) 2025-07-17T06:33:19.4455089Z  2025-07-17T06:33:19.4455470Z  return parser.parse_args() 2025-07-17T06:33:19.4455938Z  2025-07-17T06:33:19.4456268Z  2025-07-17T06:33:19.4456854Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:19.4457739Z  auth = Auth.Token(github_token) 2025-07-17T06:33:19.4458256Z  return Github(auth=auth) 2025-07-17T06:33:19.4458703Z  2025-07-17T06:33:19.4459026Z  2025-07-17T06:33:19.4459667Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:19.4460438Z  repo = gh.get_repo(repo) 2025-07-17T06:33:19.4460957Z  return repo.get_issue(number=issue_num) 2025-07-17T06:33:19.4461457Z  2025-07-17T06:33:19.4461791Z  2025-07-17T06:33:19.4462151Z def get_potential_pr_author( 2025-07-17T06:33:19.4463000Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:19.4463665Z ) -> str: 2025-07-17T06:33:19.4464197Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:19.4464981Z  # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:19.4465731Z  # embedded in the tag name: ciflow// 2025-07-17T06:33:19.4466293Z  2025-07-17T06:33:19.4466668Z  gh = get_gh_client(github_token) 2025-07-17T06:33:19.4467152Z  2025-07-17T06:33:19.4467630Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:19.4468280Z  split_tag = ref_name.split("/") 2025-07-17T06:33:19.4468777Z  if ( 2025-07-17T06:33:19.4469185Z  len(split_tag) == 3 2025-07-17T06:33:19.4469692Z  and split_tag[0] == "ciflow" 2025-07-17T06:33:19.4470224Z  and split_tag[2].isnumeric() 2025-07-17T06:33:19.4470713Z  ): 2025-07-17T06:33:19.4471129Z  pr_number = split_tag[2] 2025-07-17T06:33:19.4471616Z  try: 2025-07-17T06:33:19.4472064Z  repository = gh.get_repo(repo) 2025-07-17T06:33:19.4473090Z  pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:19.4473700Z  except Exception as e: 2025-07-17T06:33:19.4474229Z  raise Exception( # noqa: TRY002 2025-07-17T06:33:19.4474894Z  f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:19.4475514Z  ) from e 2025-07-17T06:33:19.4476072Z  return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:19.4476763Z  # In all other cases, return the original input username 2025-07-17T06:33:19.4477339Z  return username 2025-07-17T06:33:19.4477751Z  2025-07-17T06:33:19.4478085Z  2025-07-17T06:33:19.4478495Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:19.4479007Z  """ 2025-07-17T06:33:19.4479662Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:19.4480424Z  """ 2025-07-17T06:33:19.4480983Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:19.4481629Z  2025-07-17T06:33:19.4481953Z  2025-07-17T06:33:19.4482864Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:19.4483391Z  try: 2025-07-17T06:33:19.4483825Z  data = yaml.safe_load(yaml_text) 2025-07-17T06:33:19.4484350Z  return data 2025-07-17T06:33:19.4484789Z  except yaml.YAMLError: 2025-07-17T06:33:19.4485290Z  log.exception("Error loading YAML") 2025-07-17T06:33:19.4485788Z  raise 2025-07-17T06:33:19.4486173Z  2025-07-17T06:33:19.4486498Z  2025-07-17T06:33:19.4487103Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:19.4487821Z  """ 2025-07-17T06:33:19.4488593Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:19.4489315Z  2025-07-17T06:33:19.4489854Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:19.4490588Z  and the text below is the list of opted in users. 2025-07-17T06:33:19.4491122Z  2025-07-17T06:33:19.4491679Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:19.4492467Z  """ 2025-07-17T06:33:19.4492927Z  rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:19.4493510Z  if len(rollout_state_parts) >= 2: 2025-07-17T06:33:19.4494122Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:19.4494735Z  else: 2025-07-17T06:33:19.4495118Z  return "", rollout_state 2025-07-17T06:33:19.4495587Z  2025-07-17T06:33:19.4495914Z  2025-07-17T06:33:19.4496309Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:19.4496803Z  """ 2025-07-17T06:33:19.4497330Z  Dictionary of users with a list of features they have opted into 2025-07-17T06:33:19.4497938Z  """ 2025-07-17T06:33:19.4498277Z  2025-07-17T06:33:19.4498585Z  2025-07-17T06:33:19.4499096Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:19.4499760Z  """ 2025-07-17T06:33:19.4500509Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-07-17T06:33:19.4501306Z  2025-07-17T06:33:19.4502068Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:33:19.4503129Z  - Example line: "@User1,lf,split_build" 2025-07-17T06:33:19.4503931Z  - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:19.4504558Z  2025-07-17T06:33:19.4504930Z  2025-07-17T06:33:19.4505298Z  """ 2025-07-17T06:33:19.4505670Z  optins = UserOptins() 2025-07-17T06:33:19.4506175Z  for user in user_optin_text.split("\n"): 2025-07-17T06:33:19.4506721Z  user = user.strip("\r\n\t -") 2025-07-17T06:33:19.4507272Z  if not user or not user.startswith("@"): 2025-07-17T06:33:19.4507816Z  # Not a valid user. Skip 2025-07-17T06:33:19.4508302Z  continue 2025-07-17T06:33:19.4508700Z  2025-07-17T06:33:19.4509031Z  if user: 2025-07-17T06:33:19.4509485Z  usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:19.4510173Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:19.4510784Z  2025-07-17T06:33:19.4511123Z  return optins 2025-07-17T06:33:19.4511523Z  2025-07-17T06:33:19.4511835Z  2025-07-17T06:33:19.4512529Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:19.4513242Z  """ 2025-07-17T06:33:19.4513665Z  Check if the experiment name is valid. 2025-07-17T06:33:19.4514167Z  A valid name: 2025-07-17T06:33:19.4514824Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:19.4515733Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:19.4516413Z  - Cannot contain spaces 2025-07-17T06:33:19.4516879Z  """ 2025-07-17T06:33:19.4517225Z  2025-07-17T06:33:19.4517671Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:19.4518377Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:19.4519136Z  2025-07-17T06:33:19.4519476Z  if valid: 2025-07-17T06:33:19.4519875Z  return True 2025-07-17T06:33:19.4520284Z  2025-07-17T06:33:19.4520613Z  log.error( 2025-07-17T06:33:19.4522552Z  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-07-17T06:33:19.4524036Z  ) 2025-07-17T06:33:19.4524399Z  return False 2025-07-17T06:33:19.4524795Z  2025-07-17T06:33:19.4525118Z  2025-07-17T06:33:19.4525644Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:19.4526308Z  """ 2025-07-17T06:33:19.4526902Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:19.4527594Z  """ 2025-07-17T06:33:19.4527954Z  try: 2025-07-17T06:33:19.4528321Z  if settings_text: 2025-07-17T06:33:19.4529052Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:33:19.4529809Z  # for easy reading 2025-07-17T06:33:19.4530597Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:19.4531463Z  # the backtick character in shell commands. 2025-07-17T06:33:19.4532064Z  backtick = chr(96) # backtick character 2025-07-17T06:33:19.4532831Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:19.4533482Z  settings = load_yaml(settings_text) 2025-07-17T06:33:19.4533969Z  2025-07-17T06:33:19.4534698Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:19.4535412Z  experiments = {} 2025-07-17T06:33:19.4535850Z  2025-07-17T06:33:19.4536388Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:19.4537117Z  if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:19.4538184Z  # 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-07-17T06:33:19.4539164Z  continue 2025-07-17T06:33:19.4539616Z  2025-07-17T06:33:19.4539979Z  valid_settings = {} 2025-07-17T06:33:19.4540559Z  for setting in exp_settings: 2025-07-17T06:33:19.4541181Z  if setting not in Experiment._fields: 2025-07-17T06:33:19.4541782Z  log.warning( 2025-07-17T06:33:19.4542624Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:19.4543317Z  ) 2025-07-17T06:33:19.4543751Z  else: 2025-07-17T06:33:19.4544280Z  valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:19.4544826Z  2025-07-17T06:33:19.4545281Z  experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:19.4545899Z  return Settings(experiments) 2025-07-17T06:33:19.4546375Z  2025-07-17T06:33:19.4546716Z  except Exception: 2025-07-17T06:33:19.4547211Z  log.exception("Failed to parse settings") 2025-07-17T06:33:19.4547724Z  2025-07-17T06:33:19.4548064Z  return Settings() 2025-07-17T06:33:19.4548470Z  2025-07-17T06:33:19.4548788Z  2025-07-17T06:33:19.4549336Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:19.4549895Z  """ 2025-07-17T06:33:19.4550338Z  Parse settings, if any, from the rollout state. 2025-07-17T06:33:19.4550881Z  2025-07-17T06:33:19.4551416Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:19.4552158Z  and the text below is the list of opted in users. 2025-07-17T06:33:19.4552959Z  2025-07-17T06:33:19.4553546Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:19.4554233Z  """ 2025-07-17T06:33:19.4554795Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:19.4555533Z  return parse_settings_from_text(settings_text) 2025-07-17T06:33:19.4556056Z  2025-07-17T06:33:19.4556383Z  2025-07-17T06:33:19.4556810Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:19.4557354Z  """ 2025-07-17T06:33:19.4557744Z  Parse users from the rollout state. 2025-07-17T06:33:19.4558230Z  2025-07-17T06:33:19.4558546Z  """ 2025-07-17T06:33:19.4559077Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:19.4559802Z  return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:19.4560328Z  2025-07-17T06:33:19.4560647Z  2025-07-17T06:33:19.4561235Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:19.4561949Z  """ 2025-07-17T06:33:19.4562570Z  Check if a user is opted into an experiment 2025-07-17T06:33:19.4563097Z  """ 2025-07-17T06:33:19.4563558Z  return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:19.4564256Z  2025-07-17T06:33:19.4564578Z  2025-07-17T06:33:19.4565174Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:19.4565898Z  """ 2025-07-17T06:33:19.4566361Z  Check if a user explicitly opted out of an experiment 2025-07-17T06:33:19.4566917Z  """ 2025-07-17T06:33:19.4567427Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:19.4568111Z  experiment_optout = "-" + experiment_name 2025-07-17T06:33:19.4568753Z  if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:19.4569327Z  return False 2025-07-17T06:33:19.4569742Z  2025-07-17T06:33:19.4570184Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:19.4570761Z  log.warning( 2025-07-17T06:33:19.4571552Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:19.4572500Z  ) 2025-07-17T06:33:19.4572859Z  2025-07-17T06:33:19.4573194Z  return True 2025-07-17T06:33:19.4573591Z  2025-07-17T06:33:19.4573913Z  2025-07-17T06:33:19.4574265Z def get_runner_prefix( 2025-07-17T06:33:19.4574706Z  rollout_state: str, 2025-07-17T06:33:19.4575189Z  workflow_requestors: Iterable[str], 2025-07-17T06:33:19.4575687Z  branch: str, 2025-07-17T06:33:19.4576202Z  eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:19.4576866Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:19.4577428Z  is_canary: bool = False, 2025-07-17T06:33:19.4577882Z ) -> str: 2025-07-17T06:33:19.4578304Z  settings = parse_settings(rollout_state) 2025-07-17T06:33:19.4578880Z  user_optins = parse_users(rollout_state) 2025-07-17T06:33:19.4579374Z  2025-07-17T06:33:19.4579837Z  fleet_prefix = "" 2025-07-17T06:33:19.4580278Z  prefixes = [] 2025-07-17T06:33:19.4580951Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:19.4581872Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:19.4582658Z  log.info( 2025-07-17T06:33:19.4583334Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:19.4584041Z  ) 2025-07-17T06:33:19.4584432Z  continue 2025-07-17T06:33:19.4584831Z  2025-07-17T06:33:19.4585184Z  if opt_out_experiments: 2025-07-17T06:33:19.4585727Z  if experiment_name in opt_out_experiments: 2025-07-17T06:33:19.4586344Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:19.4586911Z  log.info( 2025-07-17T06:33:19.4587811Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:19.4588725Z  ) 2025-07-17T06:33:19.4589130Z  continue 2025-07-17T06:33:19.4589545Z  2025-07-17T06:33:19.4589898Z  if eligible_experiments: 2025-07-17T06:33:19.4590456Z  if experiment_name not in eligible_experiments: 2025-07-17T06:33:19.4591076Z  exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:19.4591603Z  log.info( 2025-07-17T06:33:19.4592592Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:19.4593422Z  ) 2025-07-17T06:33:19.4593970Z  continue 2025-07-17T06:33:19.4594508Z  elif not experiment_settings.default: 2025-07-17T06:33:19.4595023Z  log.info( 2025-07-17T06:33:19.4595688Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:19.4596383Z  ) 2025-07-17T06:33:19.4596768Z  continue 2025-07-17T06:33:19.4597170Z  2025-07-17T06:33:19.4597620Z  # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:19.4598213Z  opted_out_users = [ 2025-07-17T06:33:19.4598668Z  requestor 2025-07-17T06:33:19.4599145Z  for requestor in workflow_requestors 2025-07-17T06:33:19.4599800Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:19.4600397Z  ] 2025-07-17T06:33:19.4600762Z  2025-07-17T06:33:19.4601105Z  if opted_out_users: 2025-07-17T06:33:19.4601572Z  log.info( 2025-07-17T06:33:19.4602190Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:19.4603080Z  ) 2025-07-17T06:33:19.4603464Z  continue 2025-07-17T06:33:19.4603864Z  2025-07-17T06:33:19.4604309Z  # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:19.4604896Z  opted_in_users = [ 2025-07-17T06:33:19.4605356Z  requestor 2025-07-17T06:33:19.4605825Z  for requestor in workflow_requestors 2025-07-17T06:33:19.4606477Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:19.4607063Z  ] 2025-07-17T06:33:19.4607419Z  2025-07-17T06:33:19.4607754Z  enabled = False 2025-07-17T06:33:19.4608207Z  if opted_in_users: 2025-07-17T06:33:19.4608822Z  log.info( 2025-07-17T06:33:19.4609442Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:19.4610091Z  ) 2025-07-17T06:33:19.4610477Z  enabled = True 2025-07-17T06:33:19.4610908Z  2025-07-17T06:33:19.4611291Z  elif experiment_settings.rollout_perc: 2025-07-17T06:33:19.4612092Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:19.4613103Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:19.4613720Z  log.info( 2025-07-17T06:33:19.4614573Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:19.4615442Z  ) 2025-07-17T06:33:19.4615863Z  enabled = True 2025-07-17T06:33:19.4616308Z  2025-07-17T06:33:19.4616647Z  if enabled: 2025-07-17T06:33:19.4617089Z  label = experiment_name 2025-07-17T06:33:19.4617636Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:19.4618429Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:19.4619262Z  # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:19.4619999Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:19.4620637Z  if is_canary: 2025-07-17T06:33:19.4621130Z  label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:19.4621661Z  fleet_prefix = label 2025-07-17T06:33:19.4622262Z  else: 2025-07-17T06:33:19.4622817Z  prefixes.append(label) 2025-07-17T06:33:19.4623292Z  2025-07-17T06:33:19.4623641Z  if len(prefixes) > 1: 2025-07-17T06:33:19.4624087Z  log.error( 2025-07-17T06:33:19.4625083Z  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-07-17T06:33:19.4626131Z  ) 2025-07-17T06:33:19.4626520Z  prefixes = prefixes[:1] 2025-07-17T06:33:19.4626983Z  2025-07-17T06:33:19.4627335Z  # Fleet always comes first 2025-07-17T06:33:19.4627826Z  if fleet_prefix: 2025-07-17T06:33:19.4628299Z  prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:19.4628789Z  2025-07-17T06:33:19.4629230Z  return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:19.4629772Z  2025-07-17T06:33:19.4630090Z  2025-07-17T06:33:19.4630702Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:19.4631446Z  """ 2025-07-17T06:33:19.4632030Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:19.4632956Z  2025-07-17T06:33:19.4633517Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:19.4634188Z  """ 2025-07-17T06:33:19.4634588Z  gh = get_gh_client(github_token) 2025-07-17T06:33:19.4635132Z  issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:19.4635763Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:19.4636331Z  2025-07-17T06:33:19.4636645Z  2025-07-17T06:33:19.4637227Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:19.4638086Z  for _ in range(num_retries): 2025-07-17T06:33:19.4638566Z  try: 2025-07-17T06:33:19.4639002Z  req = Request(url=url, headers=headers) 2025-07-17T06:33:19.4639646Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:19.4640274Z  return json.loads(content) 2025-07-17T06:33:19.4640779Z  except Exception as e: 2025-07-17T06:33:19.4641329Z  log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:19.4641855Z  2025-07-17T06:33:19.4642618Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:19.4643316Z  return {} 2025-07-17T06:33:19.4643695Z  2025-07-17T06:33:19.4644007Z  2025-07-17T06:33:19.4644326Z @cache 2025-07-17T06:33:19.4644984Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:19.4645716Z  """ 2025-07-17T06:33:19.4646108Z  Dynamically get PR information 2025-07-17T06:33:19.4646585Z  """ 2025-07-17T06:33:19.4647085Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:19.4647683Z  headers = { 2025-07-17T06:33:19.4648162Z  "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:19.4648769Z  "Authorization": f"token {github_token}", 2025-07-17T06:33:19.4649275Z  } 2025-07-17T06:33:19.4649714Z  json_response: dict[str, Any] = download_json( 2025-07-17T06:33:19.4650311Z  url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:19.4650837Z  headers=headers, 2025-07-17T06:33:19.4651264Z  ) 2025-07-17T06:33:19.4651609Z  2025-07-17T06:33:19.4651959Z  if not json_response: 2025-07-17T06:33:19.4652786Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:19.4653390Z  return {} 2025-07-17T06:33:19.4653782Z  2025-07-17T06:33:19.4654131Z  return json_response 2025-07-17T06:33:19.4654555Z  2025-07-17T06:33:19.4654870Z  2025-07-17T06:33:19.4655435Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:19.4656121Z  """ 2025-07-17T06:33:19.4656650Z  Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:19.4657265Z  """ 2025-07-17T06:33:19.4657747Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:19.4658330Z  return { 2025-07-17T06:33:19.4658909Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:19.4659555Z  } 2025-07-17T06:33:19.4659902Z  2025-07-17T06:33:19.4660238Z  2025-07-17T06:33:19.4660586Z def main() -> None: 2025-07-17T06:33:19.4661047Z  args = parse_args() 2025-07-17T06:33:19.4661529Z  2025-07-17T06:33:19.4661937Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:19.4662541Z  2025-07-17T06:33:19.4662900Z  # Check if the PR is opt-out 2025-07-17T06:33:19.4663387Z  if args.pr_number: 2025-07-17T06:33:19.4664051Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:19.4664772Z  if OPT_OUT_LABEL in labels: 2025-07-17T06:33:19.4665253Z  log.info( 2025-07-17T06:33:19.4665946Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:19.4666664Z  ) 2025-07-17T06:33:19.4667231Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:19.4667877Z  sys.exit() 2025-07-17T06:33:19.4668426Z  2025-07-17T06:33:19.4668765Z  try: 2025-07-17T06:33:19.4669204Z  rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:19.4669895Z  args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:19.4670499Z  ) 2025-07-17T06:33:19.4670878Z  2025-07-17T06:33:19.4671261Z  username = get_potential_pr_author( 2025-07-17T06:33:19.4671783Z  args.github_token, 2025-07-17T06:33:19.4672258Z  args.github_repo, 2025-07-17T06:33:19.4673037Z  args.github_actor, 2025-07-17T06:33:19.4673535Z  args.github_ref_type, 2025-07-17T06:33:19.4674020Z  args.github_branch, 2025-07-17T06:33:19.4674479Z  ) 2025-07-17T06:33:19.4674834Z  2025-07-17T06:33:19.4675307Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:19.4675887Z  2025-07-17T06:33:19.4676342Z  runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:19.4676875Z  rollout_state, 2025-07-17T06:33:19.4677377Z  (args.github_issue_owner, username), 2025-07-17T06:33:19.4677913Z  args.github_branch, 2025-07-17T06:33:19.4678416Z  args.eligible_experiments, 2025-07-17T06:33:19.4678943Z  args.opt_out_experiments, 2025-07-17T06:33:19.4679430Z  is_canary, 2025-07-17T06:33:19.4679850Z  ) 2025-07-17T06:33:19.4680204Z  2025-07-17T06:33:19.4680557Z  except Exception as e: 2025-07-17T06:33:19.4681011Z  log.error( 2025-07-17T06:33:19.4681682Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:19.4682764Z  ) 2025-07-17T06:33:19.4683125Z  2025-07-17T06:33:19.4683634Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:19.4684256Z  2025-07-17T06:33:19.4684679Z  2025-07-17T06:33:19.4685015Z if __name__ == "__main__": 2025-07-17T06:33:19.4685462Z  main() 2025-07-17T06:33:19.4685824Z  2025-07-17T06:33:19.4686140Z EOF 2025-07-17T06:33:19.4686478Z  2025-07-17T06:33:19.4686827Z cat runner_determinator.py 2025-07-17T06:33:19.5026298Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:19.5027495Z env: 2025-07-17T06:33:19.5028448Z GITHUB_TOKEN: *** 2025-07-17T06:33:19.5029164Z ISSUE_NUMBER: 5132 2025-07-17T06:33:19.5029905Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:19.5030767Z ISSUE_OWNER: 2025-07-17T06:33:19.5031500Z CHECK_EXPERIMENTS: 2025-07-17T06:33:19.5032265Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:19.5033236Z PR_NUMBER: 2025-07-17T06:33:19.5033883Z ##[endgroup] 2025-07-17T06:33:19.5329060Z # flake8: noqa: G004 2025-07-17T06:33:19.5329579Z 2025-07-17T06:33:19.5330305Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:19.5332005Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:19.5333752Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:19.5334494Z 2025-07-17T06:33:19.5334756Z """ 2025-07-17T06:33:19.5335778Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:19.5337317Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:19.5338943Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:19.5340369Z of which runners should be used to run which job. 2025-07-17T06:33:19.5341198Z 2025-07-17T06:33:19.5341883Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:19.5343917Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:19.5345472Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:19.5346677Z list, defined. 2025-07-17T06:33:19.5347075Z 2025-07-17T06:33:19.5347686Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:19.5349271Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:19.5350689Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:19.5351425Z 2025-07-17T06:33:19.5352037Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:19.5354785Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:19.5356101Z experiments which the user could be opted in to. 2025-07-17T06:33:19.5356826Z 2025-07-17T06:33:19.5357168Z The user list has the following rules: 2025-07-17T06:33:19.5357794Z 2025-07-17T06:33:19.5358342Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:19.5359785Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:19.5361110Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:19.5361793Z 2025-07-17T06:33:19.5362082Z Example config: 2025-07-17T06:33:19.5363070Z # A list of experiments that can be opted into. 2025-07-17T06:33:19.5364177Z # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:19.5365195Z # Expected syntax is: 2025-07-17T06:33:19.5366260Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:19.5367877Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:19.5368893Z 2025-07-17T06:33:19.5369200Z experiments: 2025-07-17T06:33:19.5369862Z lf: 2025-07-17T06:33:19.5370493Z rollout_percent: 25 2025-07-17T06:33:19.5371595Z all_branches: false 2025-07-17T06:33:19.5372582Z default: true 2025-07-17T06:33:19.5373280Z --- 2025-07-17T06:33:19.5373622Z 2025-07-17T06:33:19.5373879Z # Opt-ins: 2025-07-17T06:33:19.5374814Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:19.5376228Z # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:19.5377492Z # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:19.5378590Z # Experiments should be from the above list. 2025-07-17T06:33:19.5379266Z 2025-07-17T06:33:19.5379566Z @User1,-lf,split_build 2025-07-17T06:33:19.5380278Z @User2,lf 2025-07-17T06:33:19.5380894Z @User3,split_build 2025-07-17T06:33:19.5381558Z """ 2025-07-17T06:33:19.5381878Z 2025-07-17T06:33:19.5382143Z import json 2025-07-17T06:33:19.5382988Z import logging 2025-07-17T06:33:19.5383661Z import os 2025-07-17T06:33:19.5384368Z import random 2025-07-17T06:33:19.5385030Z import re 2025-07-17T06:33:19.5385643Z import sys 2025-07-17T06:33:19.5386319Z from argparse import ArgumentParser 2025-07-17T06:33:19.5387255Z from collections.abc import Iterable 2025-07-17T06:33:19.5388164Z from functools import cache 2025-07-17T06:33:19.5388997Z from logging import LogRecord 2025-07-17T06:33:19.5389844Z from typing import Any, NamedTuple 2025-07-17T06:33:19.5390785Z from urllib.request import Request, urlopen 2025-07-17T06:33:19.5391435Z 2025-07-17T06:33:19.5391740Z import yaml 2025-07-17T06:33:19.5392811Z from github import Auth, Github 2025-07-17T06:33:19.5393666Z from github.Issue import Issue 2025-07-17T06:33:19.5394170Z 2025-07-17T06:33:19.5394181Z 2025-07-17T06:33:19.5394556Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:19.5395678Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:19.5397175Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:19.5398119Z 2025-07-17T06:33:19.5398519Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:19.5399743Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:19.5400684Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:19.5401653Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:19.5402500Z 2025-07-17T06:33:19.5402864Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:19.5403463Z 2025-07-17T06:33:19.5403781Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:19.5404564Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:19.5405089Z 2025-07-17T06:33:19.5405100Z 2025-07-17T06:33:19.5405424Z class Experiment(NamedTuple): 2025-07-17T06:33:19.5406266Z rollout_perc: float = ( 2025-07-17T06:33:19.5407814Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:19.5409554Z ) 2025-07-17T06:33:19.5410176Z all_branches: bool = ( 2025-07-17T06:33:19.5411222Z False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:19.5412588Z ) 2025-07-17T06:33:19.5413255Z default: bool = ( 2025-07-17T06:33:19.5414311Z True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:19.5415451Z ) 2025-07-17T06:33:19.5415792Z 2025-07-17T06:33:19.5416100Z # Add more fields as needed 2025-07-17T06:33:19.5416604Z 2025-07-17T06:33:19.5416614Z 2025-07-17T06:33:19.5416922Z class Settings(NamedTuple): 2025-07-17T06:33:19.5417683Z """ 2025-07-17T06:33:19.5418486Z Settings for the experiments that can be opted into. 2025-07-17T06:33:19.5419487Z """ 2025-07-17T06:33:19.5419831Z 2025-07-17T06:33:19.5420184Z experiments: dict[str, Experiment] = {} 2025-07-17T06:33:19.5420840Z 2025-07-17T06:33:19.5420851Z 2025-07-17T06:33:19.5421210Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:19.5422533Z """Color codes the log messages based on the log level""" 2025-07-17T06:33:19.5423281Z 2025-07-17T06:33:19.5423549Z COLORS = { 2025-07-17T06:33:19.5424267Z "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:19.5425540Z "ERROR": "\033[31m", # Red 2025-07-17T06:33:19.5426415Z "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:19.5427303Z "INFO": "\033[0m", # Reset 2025-07-17T06:33:19.5428092Z "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:19.5428849Z } 2025-07-17T06:33:19.5429173Z 2025-07-17T06:33:19.5429519Z def format(self, record: LogRecord) -> str: 2025-07-17T06:33:19.5430739Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:19.5432047Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:19.5433295Z return super().format(record) 2025-07-17T06:33:19.5433872Z 2025-07-17T06:33:19.5433885Z 2025-07-17T06:33:19.5434211Z handler = logging.StreamHandler() 2025-07-17T06:33:19.5435429Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:19.5436457Z 2025-07-17T06:33:19.5436882Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:19.5437972Z log.addHandler(handler) 2025-07-17T06:33:19.5438798Z log.setLevel(logging.INFO) 2025-07-17T06:33:19.5439279Z 2025-07-17T06:33:19.5439290Z 2025-07-17T06:33:19.5439694Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:19.5440717Z """ 2025-07-17T06:33:19.5441584Z Defines outputs of the github action that invokes this script 2025-07-17T06:33:19.5442931Z """ 2025-07-17T06:33:19.5443554Z if not GITHUB_OUTPUT: 2025-07-17T06:33:19.5445384Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:33:19.5447404Z log.warning( 2025-07-17T06:33:19.5448861Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-07-17T06:33:19.5450486Z ) 2025-07-17T06:33:19.5465669Z print(f"::set-output name={key}::{value}") 2025-07-17T06:33:19.5466621Z return 2025-07-17T06:33:19.5467014Z 2025-07-17T06:33:19.5467561Z with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:19.5468545Z log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:19.5469551Z f.write(f"{key}={value}\n") 2025-07-17T06:33:19.5470114Z 2025-07-17T06:33:19.5470126Z 2025-07-17T06:33:19.5470644Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:19.5471770Z return frozenset( 2025-07-17T06:33:19.5473000Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:19.5474160Z ) 2025-07-17T06:33:19.5474510Z 2025-07-17T06:33:19.5474524Z 2025-07-17T06:33:19.5474849Z def parse_args() -> Any: 2025-07-17T06:33:19.5475791Z parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:19.5477290Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:19.5478626Z parser.add_argument( 2025-07-17T06:33:19.5479394Z "--github-issue-repo", 2025-07-17T06:33:19.5480223Z type=str, 2025-07-17T06:33:19.5480872Z required=False, 2025-07-17T06:33:19.5481603Z default="pytorch/test-infra", 2025-07-17T06:33:19.5482652Z help="GitHub repo to get the issue", 2025-07-17T06:33:19.5483498Z ) 2025-07-17T06:33:19.5484157Z parser.add_argument( 2025-07-17T06:33:19.5484863Z "--github-repo", 2025-07-17T06:33:19.5485534Z type=str, 2025-07-17T06:33:19.5486155Z required=True, 2025-07-17T06:33:19.5486869Z help="GitHub repo where CI is running", 2025-07-17T06:33:19.5487718Z ) 2025-07-17T06:33:19.5488284Z parser.add_argument( 2025-07-17T06:33:19.5489239Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:19.5490281Z ) 2025-07-17T06:33:19.5490929Z parser.add_argument( 2025-07-17T06:33:19.5491949Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:19.5493325Z ) 2025-07-17T06:33:19.5494208Z parser.add_argument( 2025-07-17T06:33:19.5495240Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:19.5496472Z ) 2025-07-17T06:33:19.5497116Z parser.add_argument( 2025-07-17T06:33:19.5498278Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:19.5499532Z ) 2025-07-17T06:33:19.5500162Z parser.add_argument( 2025-07-17T06:33:19.5500952Z "--github-ref-type", 2025-07-17T06:33:19.5501758Z type=str, 2025-07-17T06:33:19.5502674Z required=True, 2025-07-17T06:33:19.5503502Z help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:19.5504426Z ) 2025-07-17T06:33:19.5505025Z parser.add_argument( 2025-07-17T06:33:19.5505814Z "--eligible-experiments", 2025-07-17T06:33:19.5506677Z type=_str_comma_separated_to_set, 2025-07-17T06:33:19.5507565Z required=False, 2025-07-17T06:33:19.5508244Z default="", 2025-07-17T06:33:19.5509681Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:19.5511302Z ) 2025-07-17T06:33:19.5511935Z parser.add_argument( 2025-07-17T06:33:19.5512909Z "--opt-out-experiments", 2025-07-17T06:33:19.5513753Z type=_str_comma_separated_to_set, 2025-07-17T06:33:19.5514644Z required=False, 2025-07-17T06:33:19.5515323Z default="", 2025-07-17T06:33:19.5515948Z help=( 2025-07-17T06:33:19.5517030Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:19.5518945Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:19.5520436Z ), 2025-07-17T06:33:19.5521042Z ) 2025-07-17T06:33:19.5521677Z parser.add_argument( 2025-07-17T06:33:19.5522688Z "--pr-number", 2025-07-17T06:33:19.5523428Z type=str, 2025-07-17T06:33:19.5524101Z required=False, 2025-07-17T06:33:19.5524776Z default="", 2025-07-17T06:33:19.5525797Z help="the optional PR number where this is run", 2025-07-17T06:33:19.5526790Z ) 2025-07-17T06:33:19.5527130Z 2025-07-17T06:33:19.5527453Z return parser.parse_args() 2025-07-17T06:33:19.5527982Z 2025-07-17T06:33:19.5527992Z 2025-07-17T06:33:19.5528658Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:19.5529920Z auth = Auth.Token(github_token) 2025-07-17T06:33:19.5530755Z return Github(auth=auth) 2025-07-17T06:33:19.5531244Z 2025-07-17T06:33:19.5531258Z 2025-07-17T06:33:19.5532022Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:19.5533570Z repo = gh.get_repo(repo) 2025-07-17T06:33:19.5534388Z return repo.get_issue(number=issue_num) 2025-07-17T06:33:19.5534986Z 2025-07-17T06:33:19.5534996Z 2025-07-17T06:33:19.5535306Z def get_potential_pr_author( 2025-07-17T06:33:19.5536797Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:19.5537976Z ) -> str: 2025-07-17T06:33:19.5538831Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:19.5588225Z # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:19.5589473Z # embedded in the tag name: ciflow// 2025-07-17T06:33:19.5589889Z 2025-07-17T06:33:19.5590070Z gh = get_gh_client(github_token) 2025-07-17T06:33:19.5590393Z 2025-07-17T06:33:19.5590660Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:19.5591243Z split_tag = ref_name.split("/") 2025-07-17T06:33:19.5591708Z if ( 2025-07-17T06:33:19.5592237Z len(split_tag) == 3 2025-07-17T06:33:19.5592949Z and split_tag[0] == "ciflow" 2025-07-17T06:33:19.5593437Z and split_tag[2].isnumeric() 2025-07-17T06:33:19.5593895Z ): 2025-07-17T06:33:19.5594462Z pr_number = split_tag[2] 2025-07-17T06:33:19.5595133Z try: 2025-07-17T06:33:19.5595542Z repository = gh.get_repo(repo) 2025-07-17T06:33:19.5596116Z pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:19.5596665Z except Exception as e: 2025-07-17T06:33:19.5597138Z raise Exception( # noqa: TRY002 2025-07-17T06:33:19.5597776Z f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:19.5598543Z ) from e 2025-07-17T06:33:19.5599049Z return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:19.5599697Z # In all other cases, return the original input username 2025-07-17T06:33:19.5600234Z return username 2025-07-17T06:33:19.5600458Z 2025-07-17T06:33:19.5600470Z 2025-07-17T06:33:19.5600680Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:19.5601170Z """ 2025-07-17T06:33:19.5601770Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:19.5602710Z """ 2025-07-17T06:33:19.5603223Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:19.5603707Z 2025-07-17T06:33:19.5603714Z 2025-07-17T06:33:19.5603901Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:19.5604349Z try: 2025-07-17T06:33:19.5604708Z data = yaml.safe_load(yaml_text) 2025-07-17T06:33:19.5605174Z return data 2025-07-17T06:33:19.5605557Z except yaml.YAMLError: 2025-07-17T06:33:19.5605999Z log.exception("Error loading YAML") 2025-07-17T06:33:19.5606475Z raise 2025-07-17T06:33:19.5606673Z 2025-07-17T06:33:19.5606680Z 2025-07-17T06:33:19.5607071Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:19.5607752Z """ 2025-07-17T06:33:19.5608320Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:19.5608880Z 2025-07-17T06:33:19.5609346Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:19.5610051Z and the text below is the list of opted in users. 2025-07-17T06:33:19.5610422Z 2025-07-17T06:33:19.5610770Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:19.5611417Z """ 2025-07-17T06:33:19.5611823Z rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:19.5612535Z if len(rollout_state_parts) >= 2: 2025-07-17T06:33:19.5613107Z return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:19.5613647Z else: 2025-07-17T06:33:19.5613998Z return "", rollout_state 2025-07-17T06:33:19.5614278Z 2025-07-17T06:33:19.5614286Z 2025-07-17T06:33:19.5614467Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:19.5614936Z """ 2025-07-17T06:33:19.5615410Z Dictionary of users with a list of features they have opted into 2025-07-17T06:33:19.5616001Z """ 2025-07-17T06:33:19.5616186Z 2025-07-17T06:33:19.5616192Z 2025-07-17T06:33:19.5616511Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:19.5617115Z """ 2025-07-17T06:33:19.5617785Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-07-17T06:33:19.5618415Z 2025-07-17T06:33:19.5618988Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:33:19.5619910Z - Example line: "@User1,lf,split_build" 2025-07-17T06:33:19.5620541Z - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:19.5620981Z 2025-07-17T06:33:19.5620988Z 2025-07-17T06:33:19.5621130Z """ 2025-07-17T06:33:19.5621472Z optins = UserOptins() 2025-07-17T06:33:19.5621933Z for user in user_optin_text.split("\n"): 2025-07-17T06:33:19.5622641Z user = user.strip("\r\n\t -") 2025-07-17T06:33:19.5623290Z if not user or not user.startswith("@"): 2025-07-17T06:33:19.5623803Z # Not a valid user. Skip 2025-07-17T06:33:19.5624252Z continue 2025-07-17T06:33:19.5624486Z 2025-07-17T06:33:19.5624635Z if user: 2025-07-17T06:33:19.5625034Z usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:19.5625671Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:19.5626130Z 2025-07-17T06:33:19.5626283Z return optins 2025-07-17T06:33:19.5626495Z 2025-07-17T06:33:19.5626501Z 2025-07-17T06:33:19.5626762Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:19.5627310Z """ 2025-07-17T06:33:19.5627671Z Check if the experiment name is valid. 2025-07-17T06:33:19.5628141Z A valid name: 2025-07-17T06:33:19.5628726Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:19.5629587Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:19.5630257Z - Cannot contain spaces 2025-07-17T06:33:19.5630673Z """ 2025-07-17T06:33:19.5630856Z 2025-07-17T06:33:19.5631097Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:19.5631733Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:19.5632159Z 2025-07-17T06:33:19.5632489Z if valid: 2025-07-17T06:33:19.5632873Z return True 2025-07-17T06:33:19.5633089Z 2025-07-17T06:33:19.5633241Z log.error( 2025-07-17T06:33:19.5634599Z 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-07-17T06:33:19.5636090Z ) 2025-07-17T06:33:19.5636408Z return False 2025-07-17T06:33:19.5636617Z 2025-07-17T06:33:19.5636623Z 2025-07-17T06:33:19.5636904Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:19.5637478Z """ 2025-07-17T06:33:19.5638148Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:19.5638818Z """ 2025-07-17T06:33:19.5639139Z try: 2025-07-17T06:33:19.5639472Z if settings_text: 2025-07-17T06:33:19.5640139Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:33:19.5640873Z # for easy reading 2025-07-17T06:33:19.5641592Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:19.5642580Z # the backtick character in shell commands. 2025-07-17T06:33:19.5643145Z backtick = chr(96) # backtick character 2025-07-17T06:33:19.5643763Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:19.5644364Z settings = load_yaml(settings_text) 2025-07-17T06:33:19.5644714Z 2025-07-17T06:33:19.5645093Z # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:19.5645789Z experiments = {} 2025-07-17T06:33:19.5646056Z 2025-07-17T06:33:19.5646398Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:19.5647091Z if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:19.5648108Z # 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-07-17T06:33:19.5649075Z continue 2025-07-17T06:33:19.5649328Z 2025-07-17T06:33:19.5649503Z valid_settings = {} 2025-07-17T06:33:19.5649978Z for setting in exp_settings: 2025-07-17T06:33:19.5650511Z if setting not in Experiment._fields: 2025-07-17T06:33:19.5651016Z log.warning( 2025-07-17T06:33:19.5651668Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:19.5652623Z ) 2025-07-17T06:33:19.5653020Z else: 2025-07-17T06:33:19.5653484Z valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:19.5653875Z 2025-07-17T06:33:19.5654127Z experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:19.5654704Z return Settings(experiments) 2025-07-17T06:33:19.5655018Z 2025-07-17T06:33:19.5655178Z except Exception: 2025-07-17T06:33:19.5655619Z log.exception("Failed to parse settings") 2025-07-17T06:33:19.5655971Z 2025-07-17T06:33:19.5656125Z return Settings() 2025-07-17T06:33:19.5656366Z 2025-07-17T06:33:19.5656372Z 2025-07-17T06:33:19.5656601Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:19.5657126Z """ 2025-07-17T06:33:19.5657514Z Parse settings, if any, from the rollout state. 2025-07-17T06:33:19.5657880Z 2025-07-17T06:33:19.5658212Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:19.5658903Z and the text below is the list of opted in users. 2025-07-17T06:33:19.5659280Z 2025-07-17T06:33:19.5659655Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:19.5660332Z """ 2025-07-17T06:33:19.5660822Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:19.5661516Z return parse_settings_from_text(settings_text) 2025-07-17T06:33:19.5661872Z 2025-07-17T06:33:19.5661879Z 2025-07-17T06:33:19.5662100Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:19.5662829Z """ 2025-07-17T06:33:19.5663178Z Parse users from the rollout state. 2025-07-17T06:33:19.5663504Z 2025-07-17T06:33:19.5663648Z """ 2025-07-17T06:33:19.5664136Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:19.5664799Z return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:19.5665163Z 2025-07-17T06:33:19.5665170Z 2025-07-17T06:33:19.5665685Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:19.5666373Z """ 2025-07-17T06:33:19.5666748Z Check if a user is opted into an experiment 2025-07-17T06:33:19.5667226Z """ 2025-07-17T06:33:19.5667636Z return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:19.5668016Z 2025-07-17T06:33:19.5668022Z 2025-07-17T06:33:19.5668406Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:19.5669087Z """ 2025-07-17T06:33:19.5669525Z Check if a user explicitly opted out of an experiment 2025-07-17T06:33:19.5670047Z """ 2025-07-17T06:33:19.5670499Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:19.5671122Z experiment_optout = "-" + experiment_name 2025-07-17T06:33:19.5671709Z if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:19.5672265Z return False 2025-07-17T06:33:19.5672701Z 2025-07-17T06:33:19.5672978Z if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:19.5673529Z log.warning( 2025-07-17T06:33:19.5674261Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:19.5675074Z ) 2025-07-17T06:33:19.5675257Z 2025-07-17T06:33:19.5675408Z return True 2025-07-17T06:33:19.5675623Z 2025-07-17T06:33:19.5675630Z 2025-07-17T06:33:19.5675791Z def get_runner_prefix( 2025-07-17T06:33:19.5676189Z rollout_state: str, 2025-07-17T06:33:19.5676599Z workflow_requestors: Iterable[str], 2025-07-17T06:33:19.5677067Z branch: str, 2025-07-17T06:33:19.5677503Z eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:19.5678108Z opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:19.5678638Z is_canary: bool = False, 2025-07-17T06:33:19.5679053Z ) -> str: 2025-07-17T06:33:19.5679606Z settings = parse_settings(rollout_state) 2025-07-17T06:33:19.5680136Z user_optins = parse_users(rollout_state) 2025-07-17T06:33:19.5680470Z 2025-07-17T06:33:19.5680626Z fleet_prefix = "" 2025-07-17T06:33:19.5681006Z prefixes = [] 2025-07-17T06:33:19.5681572Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:19.5682599Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:19.5683259Z log.info( 2025-07-17T06:33:19.5683902Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:19.5684589Z ) 2025-07-17T06:33:19.5684930Z continue 2025-07-17T06:33:19.5685156Z 2025-07-17T06:33:19.5685328Z if opt_out_experiments: 2025-07-17T06:33:19.5685808Z if experiment_name in opt_out_experiments: 2025-07-17T06:33:19.5686378Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:19.5686914Z log.info( 2025-07-17T06:33:19.5687755Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:19.5688651Z ) 2025-07-17T06:33:19.5688997Z continue 2025-07-17T06:33:19.5689239Z 2025-07-17T06:33:19.5689407Z if eligible_experiments: 2025-07-17T06:33:19.5689902Z if experiment_name not in eligible_experiments: 2025-07-17T06:33:19.5690476Z exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:19.5690979Z log.info( 2025-07-17T06:33:19.5691691Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:19.5692627Z ) 2025-07-17T06:33:19.5692982Z continue 2025-07-17T06:33:19.5693410Z elif not experiment_settings.default: 2025-07-17T06:33:19.5693894Z log.info( 2025-07-17T06:33:19.5694613Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:19.5695298Z ) 2025-07-17T06:33:19.5695635Z continue 2025-07-17T06:33:19.5695854Z 2025-07-17T06:33:19.5696109Z # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:19.5696669Z opted_out_users = [ 2025-07-17T06:33:19.5697071Z requestor 2025-07-17T06:33:19.5697477Z for requestor in workflow_requestors 2025-07-17T06:33:19.5698087Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:19.5698652Z ] 2025-07-17T06:33:19.5698842Z 2025-07-17T06:33:19.5699002Z if opted_out_users: 2025-07-17T06:33:19.5699406Z log.info( 2025-07-17T06:33:19.5699959Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:19.5700607Z ) 2025-07-17T06:33:19.5700951Z continue 2025-07-17T06:33:19.5701171Z 2025-07-17T06:33:19.5701428Z # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:19.5701986Z opted_in_users = [ 2025-07-17T06:33:19.5702584Z requestor 2025-07-17T06:33:19.5703011Z for requestor in workflow_requestors 2025-07-17T06:33:19.5703608Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:19.5704172Z ] 2025-07-17T06:33:19.5704353Z 2025-07-17T06:33:19.5704510Z enabled = False 2025-07-17T06:33:19.5704903Z if opted_in_users: 2025-07-17T06:33:19.5705296Z log.info( 2025-07-17T06:33:19.5705841Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:19.5706445Z ) 2025-07-17T06:33:19.5706794Z enabled = True 2025-07-17T06:33:19.5707043Z 2025-07-17T06:33:19.5707244Z elif experiment_settings.rollout_perc: 2025-07-17T06:33:19.5707998Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:19.5708981Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:19.5709575Z log.info( 2025-07-17T06:33:19.5710375Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:19.5711218Z ) 2025-07-17T06:33:19.5711579Z enabled = True 2025-07-17T06:33:19.5711843Z 2025-07-17T06:33:19.5711996Z if enabled: 2025-07-17T06:33:19.5712576Z label = experiment_name 2025-07-17T06:33:19.5713093Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:19.5713834Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:19.5714636Z # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:19.5715330Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:19.5715932Z if is_canary: 2025-07-17T06:33:19.5716372Z label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:19.5716869Z fleet_prefix = label 2025-07-17T06:33:19.5717313Z else: 2025-07-17T06:33:19.5717690Z prefixes.append(label) 2025-07-17T06:33:19.5718002Z 2025-07-17T06:33:19.5718170Z if len(prefixes) > 1: 2025-07-17T06:33:19.5718560Z log.error( 2025-07-17T06:33:19.5719496Z 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-07-17T06:33:19.5720520Z ) 2025-07-17T06:33:19.5720874Z prefixes = prefixes[:1] 2025-07-17T06:33:19.5721178Z 2025-07-17T06:33:19.5721350Z # Fleet always comes first 2025-07-17T06:33:19.5721776Z if fleet_prefix: 2025-07-17T06:33:19.5722193Z prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:19.5722695Z 2025-07-17T06:33:19.5723056Z return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:19.5723453Z 2025-07-17T06:33:19.5723459Z 2025-07-17T06:33:19.5723867Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:19.5724576Z """ 2025-07-17T06:33:19.5725112Z Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:19.5725626Z 2025-07-17T06:33:19.5725989Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:19.5726632Z """ 2025-07-17T06:33:19.5726983Z gh = get_gh_client(github_token) 2025-07-17T06:33:19.5727466Z issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:19.5728044Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:19.5728441Z 2025-07-17T06:33:19.5728447Z 2025-07-17T06:33:19.5728811Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:19.5729503Z for _ in range(num_retries): 2025-07-17T06:33:19.5729936Z try: 2025-07-17T06:33:19.5730318Z req = Request(url=url, headers=headers) 2025-07-17T06:33:19.5730924Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:19.5731502Z return json.loads(content) 2025-07-17T06:33:19.5731976Z except Exception as e: 2025-07-17T06:33:19.5732624Z log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:19.5733000Z 2025-07-17T06:33:19.5733347Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:19.5734002Z return {} 2025-07-17T06:33:19.5734196Z 2025-07-17T06:33:19.5734203Z 2025-07-17T06:33:19.5734346Z @cache 2025-07-17T06:33:19.5734904Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:19.5735590Z """ 2025-07-17T06:33:19.5735944Z Dynamically get PR information 2025-07-17T06:33:19.5736523Z """ 2025-07-17T06:33:19.5737000Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:19.5737578Z headers = { 2025-07-17T06:33:19.5737994Z "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:19.5738541Z "Authorization": f"token {github_token}", 2025-07-17T06:33:19.5739021Z } 2025-07-17T06:33:19.5739415Z json_response: dict[str, Any] = download_json( 2025-07-17T06:33:19.5739958Z url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:19.5740448Z headers=headers, 2025-07-17T06:33:19.5740820Z ) 2025-07-17T06:33:19.5741000Z 2025-07-17T06:33:19.5741164Z if not json_response: 2025-07-17T06:33:19.5741668Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:19.5742235Z return {} 2025-07-17T06:33:19.5742631Z 2025-07-17T06:33:19.5742807Z return json_response 2025-07-17T06:33:19.5743060Z 2025-07-17T06:33:19.5743067Z 2025-07-17T06:33:19.5743441Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:19.5744122Z """ 2025-07-17T06:33:19.5744596Z Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:19.5745186Z """ 2025-07-17T06:33:19.5745615Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:19.5746171Z return { 2025-07-17T06:33:19.5746695Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:19.5747327Z } 2025-07-17T06:33:19.5747500Z 2025-07-17T06:33:19.5747506Z 2025-07-17T06:33:19.5747668Z def main() -> None: 2025-07-17T06:33:19.5748037Z args = parse_args() 2025-07-17T06:33:19.5748282Z 2025-07-17T06:33:19.5748482Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:19.5748825Z 2025-07-17T06:33:19.5748999Z # Check if the PR is opt-out 2025-07-17T06:33:19.5749438Z if args.pr_number: 2025-07-17T06:33:19.5750031Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:19.5750892Z if OPT_OUT_LABEL in labels: 2025-07-17T06:33:19.5751361Z log.info( 2025-07-17T06:33:19.5751981Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:19.5753176Z ) 2025-07-17T06:33:19.5753692Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:19.5754298Z sys.exit() 2025-07-17T06:33:19.5754531Z 2025-07-17T06:33:19.5754681Z try: 2025-07-17T06:33:19.5755067Z rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:19.5755698Z args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:19.5756276Z ) 2025-07-17T06:33:19.5756455Z 2025-07-17T06:33:19.5756640Z username = get_potential_pr_author( 2025-07-17T06:33:19.5757133Z args.github_token, 2025-07-17T06:33:19.5757558Z args.github_repo, 2025-07-17T06:33:19.5757979Z args.github_actor, 2025-07-17T06:33:19.5758419Z args.github_ref_type, 2025-07-17T06:33:19.5758857Z args.github_branch, 2025-07-17T06:33:19.5759255Z ) 2025-07-17T06:33:19.5759430Z 2025-07-17T06:33:19.5759690Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:19.5760097Z 2025-07-17T06:33:19.5760291Z runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:19.5760786Z rollout_state, 2025-07-17T06:33:19.5761208Z (args.github_issue_owner, username), 2025-07-17T06:33:19.5761702Z args.github_branch, 2025-07-17T06:33:19.5762153Z args.eligible_experiments, 2025-07-17T06:33:19.5762890Z args.opt_out_experiments, 2025-07-17T06:33:19.5763341Z is_canary, 2025-07-17T06:33:19.5763708Z ) 2025-07-17T06:33:19.5763890Z 2025-07-17T06:33:19.5764057Z except Exception as e: 2025-07-17T06:33:19.5764457Z log.error( 2025-07-17T06:33:19.5765066Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:19.5765967Z ) 2025-07-17T06:33:19.5766182Z 2025-07-17T06:33:19.5766485Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:19.5766937Z 2025-07-17T06:33:19.5766944Z 2025-07-17T06:33:19.5767104Z if __name__ == "__main__": 2025-07-17T06:33:19.5767495Z main() 2025-07-17T06:33:19.5767675Z 2025-07-17T06:33:19.5854028Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:19.5854833Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:19.5882075Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:19.5882618Z env: 2025-07-17T06:33:19.5883163Z GITHUB_TOKEN: *** 2025-07-17T06:33:19.5883542Z ISSUE_NUMBER: 5132 2025-07-17T06:33:19.5883971Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:19.5884429Z ISSUE_OWNER: 2025-07-17T06:33:19.5884784Z CHECK_EXPERIMENTS: 2025-07-17T06:33:19.5885175Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:19.5885568Z PR_NUMBER: 2025-07-17T06:33:19.5885897Z ##[endgroup] 2025-07-17T06:33:20.6490513Z Defaulting to user installation because normal site-packages is not writeable 2025-07-17T06:33:21.6405070Z Collecting urllib3==1.26.18 2025-07-17T06:33:21.6855842Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-07-17T06:33:21.7090895Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.8 MB/s eta 0:00:00 2025-07-17T06:33:21.7348971Z Collecting PyGithub==2.3.0 2025-07-17T06:33:21.7418717Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-07-17T06:33:21.7862860Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-07-17T06:33:21.7934741Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB) 2025-07-17T06:33:21.7976960Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-07-17T06:33:21.7993577Z 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-07-17T06:33:21.8008959Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-07-17T06:33:21.8300747Z Collecting Deprecated (from PyGithub==2.3.0) 2025-07-17T06:33:21.8370128Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-07-17T06:33:21.8592002Z 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-07-17T06:33:21.9750803Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:21.9821812Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-07-17T06:33:22.0865090Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-07-17T06:33:22.0938247Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.4 kB) 2025-07-17T06:33:22.1170874Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:22.1241725Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-07-17T06:33:22.1501974Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-07-17T06:33:22.1637393Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 11.4 MB/s eta 0:00:00 2025-07-17T06:33:22.1710358Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-07-17T06:33:22.1979576Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 13.6 MB/s eta 0:00:00 2025-07-17T06:33:22.2051157Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-07-17T06:33:22.2517746Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 18.8 MB/s eta 0:00:00 2025-07-17T06:33:22.2586610Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-07-17T06:33:22.2673317Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-07-17T06:33:22.2891791Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 23.1 MB/s eta 0:00:00 2025-07-17T06:33:22.2961290Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (89 kB) 2025-07-17T06:33:22.3008647Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 25.1 MB/s eta 0:00:00 2025-07-17T06:33:22.3078639Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-07-17T06:33:22.3128096Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 32.5 MB/s eta 0:00:00 2025-07-17T06:33:22.6229743Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-07-17T06:33:23.1491504Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.2 2025-07-17T06:33:23.2242961Z ##[group]Run curr_branch="main" 2025-07-17T06:33:23.2243338Z curr_branch="main" 2025-07-17T06:33:23.2243566Z curr_ref_type="branch" 2025-07-17T06:33:23.2243824Z echo "Current branch is '$curr_branch'" 2025-07-17T06:33:23.2244084Z  2025-07-17T06:33:23.2244289Z python3 runner_determinator.py \ 2025-07-17T06:33:23.2244572Z  --github-token "$GITHUB_TOKEN" \ 2025-07-17T06:33:23.2244847Z  --github-issue "$ISSUE_NUMBER" \ 2025-07-17T06:33:23.2245113Z  --github-branch "$curr_branch" \ 2025-07-17T06:33:23.2245378Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-07-17T06:33:23.2245664Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-07-17T06:33:23.2245940Z  --github-ref-type "$curr_ref_type" \ 2025-07-17T06:33:23.2246235Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-07-17T06:33:23.2246539Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-07-17T06:33:23.2246909Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-07-17T06:33:23.2247203Z  --pr-number "${PR_NUMBER}" 2025-07-17T06:33:23.2275857Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:23.2276086Z env: 2025-07-17T06:33:23.2276650Z GITHUB_TOKEN: *** 2025-07-17T06:33:23.2276840Z ISSUE_NUMBER: 5132 2025-07-17T06:33:23.2277047Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:23.2277285Z ISSUE_OWNER: 2025-07-17T06:33:23.2277466Z CHECK_EXPERIMENTS: 2025-07-17T06:33:23.2277658Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:23.2277855Z PR_NUMBER: 2025-07-17T06:33:23.2278020Z ##[endgroup] 2025-07-17T06:33:23.2325933Z Current branch is 'main' 2025-07-17T06:33:24.6388756Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-07-17T06:33:24.6390748Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-07-17T06:33:24.6391500Z INFO : Setting output: label-type='' 2025-07-17T06:33:24.6699935Z Evaluate and set job outputs 2025-07-17T06:33:24.6707456Z Cleaning up orphan processes