2025-06-26T07:50:29.9608363Z Current runner version: '2.325.0' 2025-06-26T07:50:29.9635043Z ##[group]Operating System 2025-06-26T07:50:29.9635849Z Ubuntu 2025-06-26T07:50:29.9636292Z 24.04.2 2025-06-26T07:50:29.9636841Z LTS 2025-06-26T07:50:29.9637268Z ##[endgroup] 2025-06-26T07:50:29.9637768Z ##[group]Runner Image 2025-06-26T07:50:29.9638411Z Image: ubuntu-24.04 2025-06-26T07:50:29.9638899Z Version: 20250622.1.0 2025-06-26T07:50:29.9640041Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250622.1/images/ubuntu/Ubuntu2404-Readme.md 2025-06-26T07:50:29.9641361Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250622.1 2025-06-26T07:50:29.9642265Z ##[endgroup] 2025-06-26T07:50:29.9642730Z ##[group]Runner Image Provisioner 2025-06-26T07:50:29.9643420Z 2.0.437.1 2025-06-26T07:50:29.9643892Z ##[endgroup] 2025-06-26T07:50:29.9644790Z ##[group]GITHUB_TOKEN Permissions 2025-06-26T07:50:29.9647077Z Contents: read 2025-06-26T07:50:29.9647617Z Metadata: read 2025-06-26T07:50:29.9648318Z ##[endgroup] 2025-06-26T07:50:29.9650367Z Secret source: Actions 2025-06-26T07:50:29.9651088Z Prepare workflow directory 2025-06-26T07:50:30.0160388Z Prepare all required actions 2025-06-26T07:50:30.0218431Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (455dfd258980294f0745bd90aee12a323e37224d) 2025-06-26T07:50:30.0223375Z ##[group] Inputs 2025-06-26T07:50:30.0223925Z check_experiments: 2025-06-26T07:50:30.0224554Z opt_out_experiments: 2025-06-26T07:50:30.0225545Z triggering_actor: nautsimon 2025-06-26T07:50:30.0226171Z issue_owner: nautsimon 2025-06-26T07:50:30.0226751Z curr_branch: gh/nautsimon/7/head 2025-06-26T07:50:30.0227374Z curr_ref_type: branch 2025-06-26T07:50:30.0227893Z issue_number: 5132 2025-06-26T07:50:30.0228406Z ##[endgroup] 2025-06-26T07:50:30.0229073Z Complete job name: before-test / get-label-type / runner-determinator 2025-06-26T07:50:30.7623661Z ##[group]Run cat < runner_determinator.py 2025-06-26T07:50:30.7625419Z cat < runner_determinator.py 2025-06-26T07:50:30.7625980Z # flake8: noqa: G004 2025-06-26T07:50:30.7626417Z  2025-06-26T07:50:30.7627042Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-06-26T07:50:30.7627993Z # must be kept in sync. You can do it easily by running the following command: 2025-06-26T07:50:30.7628793Z # python .github/scripts/update_runner_determinator.py 2025-06-26T07:50:30.7629392Z  2025-06-26T07:50:30.7629728Z """ 2025-06-26T07:50:30.7630322Z This runner determinator is used to determine which set of runners to run a 2025-06-26T07:50:30.7631204Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-06-26T07:50:30.7632147Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-06-26T07:50:30.7632995Z of which runners should be used to run which job. 2025-06-26T07:50:30.7633569Z  2025-06-26T07:50:30.7634144Z The configuration has two parts, the settings and a list of opted-in users, 2025-06-26T07:50:30.7635216Z separated by a line containing "---". If the line is not present, the 2025-06-26T07:50:30.7636110Z settings are considered to be empty with only the second part, the user 2025-06-26T07:50:30.7636806Z list, defined. 2025-06-26T07:50:30.7637210Z  2025-06-26T07:50:30.7637764Z The first part is a YAML block that defines the rollout settings. This can be 2025-06-26T07:50:30.7638693Z used to define any settings that are needed to determine which runners to use. 2025-06-26T07:50:30.7639548Z It's fields are defined by the RolloutSettings class below. 2025-06-26T07:50:30.7640135Z  2025-06-26T07:50:30.7640698Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-06-26T07:50:30.7641610Z The user list is also a comma separated list of additional features or 2025-06-26T07:50:30.7642604Z experiments which the user could be opted in to. 2025-06-26T07:50:30.7643161Z  2025-06-26T07:50:30.7643553Z The user list has the following rules: 2025-06-26T07:50:30.7644052Z  2025-06-26T07:50:30.7644563Z - Users are GitHub usernames, which must start with the @ prefix 2025-06-26T07:50:30.7645572Z - Each user is also a comma-separated list of features/experiments to enable 2025-06-26T07:50:30.7646342Z - A "#" prefix opts the user out of all experiments 2025-06-26T07:50:30.7646886Z  2025-06-26T07:50:30.7647230Z Example config: 2025-06-26T07:50:30.7647722Z  # A list of experiments that can be opted into. 2025-06-26T07:50:30.7648400Z  # This defines the behavior they'll induce when opted into. 2025-06-26T07:50:30.7649019Z  # Expected syntax is: 2025-06-26T07:50:30.7649692Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-06-26T07:50:30.7650659Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-06-26T07:50:30.7651398Z  2025-06-26T07:50:30.7651735Z  experiments: 2025-06-26T07:50:30.7652145Z  lf: 2025-06-26T07:50:30.7652533Z  rollout_percent: 25 2025-06-26T07:50:30.7653008Z  all_branches: false 2025-06-26T07:50:30.7653472Z  default: true 2025-06-26T07:50:30.7653894Z  --- 2025-06-26T07:50:30.7654248Z  2025-06-26T07:50:30.7654586Z  # Opt-ins: 2025-06-26T07:50:30.7655307Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-06-26T07:50:30.7656318Z  # and specifying experiments to enable in a comma-separated list. 2025-06-26T07:50:30.7657130Z  # To always opt out of an experiment, prefix it with a "-". 2025-06-26T07:50:30.7657816Z  # Experiments should be from the above list. 2025-06-26T07:50:30.7658360Z  2025-06-26T07:50:30.7658739Z  @User1,-lf,split_build 2025-06-26T07:50:30.7659213Z  @User2,lf 2025-06-26T07:50:30.7659643Z  @User3,split_build 2025-06-26T07:50:30.7660113Z """ 2025-06-26T07:50:30.7660500Z  2025-06-26T07:50:30.7660848Z import json 2025-06-26T07:50:30.7661254Z import logging 2025-06-26T07:50:30.7661670Z import os 2025-06-26T07:50:30.7662052Z import random 2025-06-26T07:50:30.7662451Z import re 2025-06-26T07:50:30.7662820Z import sys 2025-06-26T07:50:30.7663255Z from argparse import ArgumentParser 2025-06-26T07:50:30.7663871Z from collections.abc import Iterable 2025-06-26T07:50:30.7664416Z from functools import cache 2025-06-26T07:50:30.7665012Z from logging import LogRecord 2025-06-26T07:50:30.7665540Z from typing import Any, NamedTuple 2025-06-26T07:50:30.7666123Z from urllib.request import Request, urlopen 2025-06-26T07:50:30.7666654Z  2025-06-26T07:50:30.7667003Z import yaml 2025-06-26T07:50:30.7667425Z from github import Auth, Github 2025-06-26T07:50:30.7667946Z from github.Issue import Issue 2025-06-26T07:50:30.7668422Z  2025-06-26T07:50:30.7668754Z  2025-06-26T07:50:30.7669179Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-06-26T07:50:30.7669888Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-06-26T07:50:30.7670758Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-06-26T07:50:30.7671451Z  2025-06-26T07:50:30.7671887Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-06-26T07:50:30.7672472Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-06-26T07:50:30.7673010Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-06-26T07:50:30.7673733Z OPT_OUT_LABEL = "no-runner-experiments" 2025-06-26T07:50:30.7674238Z  2025-06-26T07:50:30.7674628Z SETTING_EXPERIMENTS = "experiments" 2025-06-26T07:50:30.7675276Z  2025-06-26T07:50:30.7675647Z LF_FLEET_EXPERIMENT = "lf" 2025-06-26T07:50:30.7676136Z CANARY_FLEET_SUFFIX = ".c" 2025-06-26T07:50:30.7676587Z  2025-06-26T07:50:30.7676917Z  2025-06-26T07:50:30.7677283Z class Experiment(NamedTuple): 2025-06-26T07:50:30.7677789Z  rollout_perc: float = ( 2025-06-26T07:50:30.7678462Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-06-26T07:50:30.7679135Z  ) 2025-06-26T07:50:30.7679513Z  all_branches: bool = ( 2025-06-26T07:50:30.7680177Z  False # If True, the experiment is also enabled on the exception branches 2025-06-26T07:50:30.7680839Z  ) 2025-06-26T07:50:30.7681215Z  default: bool = ( 2025-06-26T07:50:30.7681813Z  True # If True, the experiment is enabled by default for all queries 2025-06-26T07:50:30.7682436Z  ) 2025-06-26T07:50:30.7682790Z  2025-06-26T07:50:30.7683152Z  # Add more fields as needed 2025-06-26T07:50:30.7683619Z  2025-06-26T07:50:30.7683948Z  2025-06-26T07:50:30.7684316Z class Settings(NamedTuple): 2025-06-26T07:50:30.7684791Z  """ 2025-06-26T07:50:30.7685393Z  Settings for the experiments that can be opted into. 2025-06-26T07:50:30.7685969Z  """ 2025-06-26T07:50:30.7686321Z  2025-06-26T07:50:30.7686722Z  experiments: dict[str, Experiment] = {} 2025-06-26T07:50:30.7687232Z  2025-06-26T07:50:30.7687688Z  2025-06-26T07:50:30.7688097Z class ColorFormatter(logging.Formatter): 2025-06-26T07:50:30.7688782Z  """Color codes the log messages based on the log level""" 2025-06-26T07:50:30.7689376Z  2025-06-26T07:50:30.7689719Z  COLORS = { 2025-06-26T07:50:30.7690163Z  "WARNING": "\033[33m", # Yellow 2025-06-26T07:50:30.7690682Z  "ERROR": "\033[31m", # Red 2025-06-26T07:50:30.7691192Z  "CRITICAL": "\033[31m", # Red 2025-06-26T07:50:30.7691707Z  "INFO": "\033[0m", # Reset 2025-06-26T07:50:30.7692211Z  "DEBUG": "\033[0m", # Reset 2025-06-26T07:50:30.7692679Z  } 2025-06-26T07:50:30.7693035Z  2025-06-26T07:50:30.7693452Z  def format(self, record: LogRecord) -> str: 2025-06-26T07:50:30.7694191Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-06-26T07:50:30.7695069Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-06-26T07:50:30.7695654Z  return super().format(record) 2025-06-26T07:50:30.7696149Z  2025-06-26T07:50:30.7696480Z  2025-06-26T07:50:30.7696860Z handler = logging.StreamHandler() 2025-06-26T07:50:30.7697599Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-06-26T07:50:30.7698301Z  2025-06-26T07:50:30.7698748Z log = logging.getLogger(os.path.basename(__file__)) 2025-06-26T07:50:30.7699335Z log.addHandler(handler) 2025-06-26T07:50:30.7699803Z log.setLevel(logging.INFO) 2025-06-26T07:50:30.7700254Z  2025-06-26T07:50:30.7700586Z  2025-06-26T07:50:30.7701029Z def set_github_output(key: str, value: str) -> None: 2025-06-26T07:50:30.7701604Z  """ 2025-06-26T07:50:30.7702139Z  Defines outputs of the github action that invokes this script 2025-06-26T07:50:30.7702767Z  """ 2025-06-26T07:50:30.7703149Z  if not GITHUB_OUTPUT: 2025-06-26T07:50:30.7704219Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-06-26T07:50:30.7705520Z  log.warning( 2025-06-26T07:50:30.7706386Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-06-26T07:50:30.7707300Z  ) 2025-06-26T07:50:30.7707757Z  print(f"::set-output name={key}::{value}") 2025-06-26T07:50:30.7708299Z  return 2025-06-26T07:50:30.7708697Z  2025-06-26T07:50:30.7709087Z  with open(GITHUB_OUTPUT, "a") as f: 2025-06-26T07:50:30.7709668Z  log.info(f"Setting output: {key}='{value}'") 2025-06-26T07:50:30.7710245Z  f.write(f"{key}={value}\n") 2025-06-26T07:50:30.7710726Z  2025-06-26T07:50:30.7711066Z  2025-06-26T07:50:30.7711562Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-06-26T07:50:30.7712211Z  return frozenset( 2025-06-26T07:50:30.7712846Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-06-26T07:50:30.7713508Z  ) 2025-06-26T07:50:30.7713855Z  2025-06-26T07:50:30.7714189Z  2025-06-26T07:50:30.7714549Z def parse_args() -> Any: 2025-06-26T07:50:30.7715278Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-06-26T07:50:30.7716157Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-06-26T07:50:30.7716909Z  parser.add_argument( 2025-06-26T07:50:30.7717392Z  "--github-issue-repo", 2025-06-26T07:50:30.7717894Z  type=str, 2025-06-26T07:50:30.7718323Z  required=False, 2025-06-26T07:50:30.7718933Z  default="pytorch/test-infra", 2025-06-26T07:50:30.7719484Z  help="GitHub repo to get the issue", 2025-06-26T07:50:30.7719994Z  ) 2025-06-26T07:50:30.7720375Z  parser.add_argument( 2025-06-26T07:50:30.7720846Z  "--github-repo", 2025-06-26T07:50:30.7721302Z  type=str, 2025-06-26T07:50:30.7721731Z  required=True, 2025-06-26T07:50:30.7722228Z  help="GitHub repo where CI is running", 2025-06-26T07:50:30.7722748Z  ) 2025-06-26T07:50:30.7723127Z  parser.add_argument( 2025-06-26T07:50:30.7723773Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-06-26T07:50:30.7724426Z  ) 2025-06-26T07:50:30.7724798Z  parser.add_argument( 2025-06-26T07:50:30.7725626Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-06-26T07:50:30.7726310Z  ) 2025-06-26T07:50:30.7726689Z  parser.add_argument( 2025-06-26T07:50:30.7727357Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-06-26T07:50:30.7728033Z  ) 2025-06-26T07:50:30.7728418Z  parser.add_argument( 2025-06-26T07:50:30.7729102Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-06-26T07:50:30.7729797Z  ) 2025-06-26T07:50:30.7730177Z  parser.add_argument( 2025-06-26T07:50:30.7730648Z  "--github-ref-type", 2025-06-26T07:50:30.7731128Z  type=str, 2025-06-26T07:50:30.7731556Z  required=True, 2025-06-26T07:50:30.7732102Z  help="Current GitHub ref type, branch or tag", 2025-06-26T07:50:30.7732658Z  ) 2025-06-26T07:50:30.7733043Z  parser.add_argument( 2025-06-26T07:50:30.7733538Z  "--eligible-experiments", 2025-06-26T07:50:30.7734088Z  type=_str_comma_separated_to_set, 2025-06-26T07:50:30.7734610Z  required=False, 2025-06-26T07:50:30.7735292Z  default="", 2025-06-26T07:50:30.7736156Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-06-26T07:50:30.7737064Z  ) 2025-06-26T07:50:30.7737438Z  parser.add_argument( 2025-06-26T07:50:30.7737924Z  "--opt-out-experiments", 2025-06-26T07:50:30.7738460Z  type=_str_comma_separated_to_set, 2025-06-26T07:50:30.7738976Z  required=False, 2025-06-26T07:50:30.7739436Z  default="", 2025-06-26T07:50:30.7739855Z  help=( 2025-06-26T07:50:30.7740547Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-06-26T07:50:30.7741686Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-06-26T07:50:30.7742503Z  ), 2025-06-26T07:50:30.7742886Z  ) 2025-06-26T07:50:30.7743264Z  parser.add_argument( 2025-06-26T07:50:30.7743729Z  "--pr-number", 2025-06-26T07:50:30.7744172Z  type=str, 2025-06-26T07:50:30.7744605Z  required=False, 2025-06-26T07:50:30.7745168Z  default="", 2025-06-26T07:50:30.7745713Z  help="the optional PR number where this is run", 2025-06-26T07:50:30.7746272Z  ) 2025-06-26T07:50:30.7746620Z  2025-06-26T07:50:30.7746990Z  return parser.parse_args() 2025-06-26T07:50:30.7747467Z  2025-06-26T07:50:30.7747796Z  2025-06-26T07:50:30.7748388Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-06-26T07:50:30.7749280Z  auth = Auth.Token(github_token) 2025-06-26T07:50:30.7749800Z  return Github(auth=auth) 2025-06-26T07:50:30.7750261Z  2025-06-26T07:50:30.7750602Z  2025-06-26T07:50:30.7751243Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-06-26T07:50:30.7752031Z  repo = gh.get_repo(repo) 2025-06-26T07:50:30.7752551Z  return repo.get_issue(number=issue_num) 2025-06-26T07:50:30.7753069Z  2025-06-26T07:50:30.7753400Z  2025-06-26T07:50:30.7753763Z def get_potential_pr_author( 2025-06-26T07:50:30.7754427Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-06-26T07:50:30.7755242Z ) -> str: 2025-06-26T07:50:30.7755788Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-06-26T07:50:30.7756587Z  # Fetch the actual username from the original PR. The PR number is 2025-06-26T07:50:30.7757347Z  # embedded in the tag name: ciflow// 2025-06-26T07:50:30.7757915Z  2025-06-26T07:50:30.7758305Z  gh = get_gh_client(github_token) 2025-06-26T07:50:30.7758786Z  2025-06-26T07:50:30.7759249Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-06-26T07:50:30.7759882Z  split_tag = ref_name.split("/") 2025-06-26T07:50:30.7760380Z  if ( 2025-06-26T07:50:30.7760791Z  len(split_tag) == 3 2025-06-26T07:50:30.7761300Z  and split_tag[0] == "ciflow" 2025-06-26T07:50:30.7761839Z  and split_tag[2].isnumeric() 2025-06-26T07:50:30.7762330Z  ): 2025-06-26T07:50:30.7762745Z  pr_number = split_tag[2] 2025-06-26T07:50:30.7763238Z  try: 2025-06-26T07:50:30.7763693Z  repository = gh.get_repo(repo) 2025-06-26T07:50:30.7764318Z  pull = repository.get_pull(number=int(pr_number)) 2025-06-26T07:50:30.7765025Z  except Exception as e: 2025-06-26T07:50:30.7765695Z  raise Exception( # noqa: TRY002 2025-06-26T07:50:30.7766366Z  f"issue with pull request {pr_number} from repo {repository}" 2025-06-26T07:50:30.7767009Z  ) from e 2025-06-26T07:50:30.7767584Z  return pull.user.login # type: ignore[no-any-return] 2025-06-26T07:50:30.7768279Z  # In all other cases, return the original input username 2025-06-26T07:50:30.7768870Z  return username 2025-06-26T07:50:30.7769292Z  2025-06-26T07:50:30.7769630Z  2025-06-26T07:50:30.7770045Z def is_exception_branch(branch: str) -> bool: 2025-06-26T07:50:30.7770577Z  """ 2025-06-26T07:50:30.7771245Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-06-26T07:50:30.7771996Z  """ 2025-06-26T07:50:30.7772558Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-06-26T07:50:30.7773206Z  2025-06-26T07:50:30.7773541Z  2025-06-26T07:50:30.7773918Z def load_yaml(yaml_text: str) -> Any: 2025-06-26T07:50:30.7774413Z  try: 2025-06-26T07:50:30.7774906Z  data = yaml.safe_load(yaml_text) 2025-06-26T07:50:30.7775429Z  return data 2025-06-26T07:50:30.7775874Z  except yaml.YAMLError: 2025-06-26T07:50:30.7776386Z  log.exception("Error loading YAML") 2025-06-26T07:50:30.7776901Z  raise 2025-06-26T07:50:30.7777283Z  2025-06-26T07:50:30.7777613Z  2025-06-26T07:50:30.7778207Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-06-26T07:50:30.7778924Z  """ 2025-06-26T07:50:30.7779836Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-06-26T07:50:30.7780667Z  2025-06-26T07:50:30.7781205Z  If the issue body contains "---" then the text above that is the settings 2025-06-26T07:50:30.7781950Z  and the text below is the list of opted in users. 2025-06-26T07:50:30.7782494Z  2025-06-26T07:50:30.7783044Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-06-26T07:50:30.7783729Z  """ 2025-06-26T07:50:30.7784194Z  rollout_state_parts = rollout_state.split("---") 2025-06-26T07:50:30.7784783Z  if len(rollout_state_parts) >= 2: 2025-06-26T07:50:30.7785510Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-06-26T07:50:30.7786093Z  else: 2025-06-26T07:50:30.7786488Z  return "", rollout_state 2025-06-26T07:50:30.7786944Z  2025-06-26T07:50:30.7787268Z  2025-06-26T07:50:30.7787655Z class UserOptins(dict[str, list[str]]): 2025-06-26T07:50:30.7788161Z  """ 2025-06-26T07:50:30.7788697Z  Dictionary of users with a list of features they have opted into 2025-06-26T07:50:30.7789321Z  """ 2025-06-26T07:50:30.7789673Z  2025-06-26T07:50:30.7789989Z  2025-06-26T07:50:30.7790508Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-06-26T07:50:30.7791139Z  """ 2025-06-26T07:50:30.7791858Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-06-26T07:50:30.7792660Z  2025-06-26T07:50:30.7793427Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-06-26T07:50:30.7794400Z  - Example line: "@User1,lf,split_build" 2025-06-26T07:50:30.7795220Z  - A "#" prefix indicates the user is opted out of all experiments 2025-06-26T07:50:30.7795870Z  2025-06-26T07:50:30.7796318Z  2025-06-26T07:50:30.7796647Z  """ 2025-06-26T07:50:30.7797025Z  optins = UserOptins() 2025-06-26T07:50:30.7797530Z  for user in user_optin_text.split("\n"): 2025-06-26T07:50:30.7798087Z  user = user.strip("\r\n\t -") 2025-06-26T07:50:30.7798635Z  if not user or not user.startswith("@"): 2025-06-26T07:50:30.7799183Z  # Not a valid user. Skip 2025-06-26T07:50:30.7799693Z  continue 2025-06-26T07:50:30.7800101Z  2025-06-26T07:50:30.7800430Z  if user: 2025-06-26T07:50:30.7800884Z  usr_name = user.split(",")[0].strip("@") 2025-06-26T07:50:30.7801564Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-06-26T07:50:30.7802175Z  2025-06-26T07:50:30.7802522Z  return optins 2025-06-26T07:50:30.7802923Z  2025-06-26T07:50:30.7803243Z  2025-06-26T07:50:30.7803727Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-06-26T07:50:30.7804334Z  """ 2025-06-26T07:50:30.7805002Z  Check if the experiment name is valid. 2025-06-26T07:50:30.7805676Z  A valid name: 2025-06-26T07:50:30.7806344Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-06-26T07:50:30.7807255Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-06-26T07:50:30.7807947Z  - Cannot contain spaces 2025-06-26T07:50:30.7808405Z  """ 2025-06-26T07:50:30.7808756Z  2025-06-26T07:50:30.7809202Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-06-26T07:50:30.7809912Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-06-26T07:50:30.7810611Z  2025-06-26T07:50:30.7810946Z  if valid: 2025-06-26T07:50:30.7811341Z  return True 2025-06-26T07:50:30.7811752Z  2025-06-26T07:50:30.7812094Z  log.error( 2025-06-26T07:50:30.7813512Z  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-06-26T07:50:30.7815068Z  ) 2025-06-26T07:50:30.7815431Z  return False 2025-06-26T07:50:30.7815818Z  2025-06-26T07:50:30.7816139Z  2025-06-26T07:50:30.7816641Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-06-26T07:50:30.7817282Z  """ 2025-06-26T07:50:30.7817870Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-06-26T07:50:30.7818565Z  """ 2025-06-26T07:50:30.7818921Z  try: 2025-06-26T07:50:30.7819289Z  if settings_text: 2025-06-26T07:50:30.7820022Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-06-26T07:50:30.7820781Z  # for easy reading 2025-06-26T07:50:30.7821592Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-06-26T07:50:30.7822457Z  # the backtick character in shell commands. 2025-06-26T07:50:30.7823054Z  backtick = chr(96) # backtick character 2025-06-26T07:50:30.7823718Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-06-26T07:50:30.7824366Z  settings = load_yaml(settings_text) 2025-06-26T07:50:30.7824965Z  2025-06-26T07:50:30.7825539Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-06-26T07:50:30.7826254Z  experiments = {} 2025-06-26T07:50:30.7826832Z  2025-06-26T07:50:30.7827366Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-06-26T07:50:30.7828114Z  if not is_valid_experiment_name(exp_name): 2025-06-26T07:50:30.7829177Z  # 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-06-26T07:50:30.7830172Z  continue 2025-06-26T07:50:30.7830614Z  2025-06-26T07:50:30.7830971Z  valid_settings = {} 2025-06-26T07:50:30.7831500Z  for setting in exp_settings: 2025-06-26T07:50:30.7832062Z  if setting not in Experiment._fields: 2025-06-26T07:50:30.7832615Z  log.warning( 2025-06-26T07:50:30.7833329Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-06-26T07:50:30.7834025Z  ) 2025-06-26T07:50:30.7834460Z  else: 2025-06-26T07:50:30.7835091Z  valid_settings[setting] = exp_settings[setting] 2025-06-26T07:50:30.7835673Z  2025-06-26T07:50:30.7836133Z  experiments[exp_name] = Experiment(**valid_settings) 2025-06-26T07:50:30.7836765Z  return Settings(experiments) 2025-06-26T07:50:30.7837251Z  2025-06-26T07:50:30.7837601Z  except Exception: 2025-06-26T07:50:30.7838112Z  log.exception("Failed to parse settings") 2025-06-26T07:50:30.7838626Z  2025-06-26T07:50:30.7838973Z  return Settings() 2025-06-26T07:50:30.7839387Z  2025-06-26T07:50:30.7839709Z  2025-06-26T07:50:30.7840265Z def parse_settings(rollout_state: str) -> Settings: 2025-06-26T07:50:30.7840840Z  """ 2025-06-26T07:50:30.7841296Z  Parse settings, if any, from the rollout state. 2025-06-26T07:50:30.7841871Z  2025-06-26T07:50:30.7842405Z  If the issue body contains "---" then the text above that is the settings 2025-06-26T07:50:30.7843150Z  and the text below is the list of opted in users. 2025-06-26T07:50:30.7843692Z  2025-06-26T07:50:30.7844276Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-06-26T07:50:30.7845135Z  """ 2025-06-26T07:50:30.7845695Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-06-26T07:50:30.7846458Z  return parse_settings_from_text(settings_text) 2025-06-26T07:50:30.7846999Z  2025-06-26T07:50:30.7847324Z  2025-06-26T07:50:30.7847776Z def parse_users(rollout_state: str) -> UserOptins: 2025-06-26T07:50:30.7848326Z  """ 2025-06-26T07:50:30.7848730Z  Parse users from the rollout state. 2025-06-26T07:50:30.7849222Z  2025-06-26T07:50:30.7849544Z  """ 2025-06-26T07:50:30.7850078Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-06-26T07:50:30.7850806Z  return parse_user_opt_in_from_text(users_text) 2025-06-26T07:50:30.7851346Z  2025-06-26T07:50:30.7851680Z  2025-06-26T07:50:30.7852284Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-06-26T07:50:30.7853003Z  """ 2025-06-26T07:50:30.7853435Z  Check if a user is opted into an experiment 2025-06-26T07:50:30.7853956Z  """ 2025-06-26T07:50:30.7854427Z  return experiment_name in user_optins.get(user, []) 2025-06-26T07:50:30.7855082Z  2025-06-26T07:50:30.7855404Z  2025-06-26T07:50:30.7856012Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-06-26T07:50:30.7856864Z  """ 2025-06-26T07:50:30.7857332Z  Check if a user explicitly opted out of an experiment 2025-06-26T07:50:30.7857895Z  """ 2025-06-26T07:50:30.7858417Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-06-26T07:50:30.7859101Z  experiment_optout = "-" + experiment_name 2025-06-26T07:50:30.7859739Z  if experiment_optout not in user_optins.get(user, []): 2025-06-26T07:50:30.7860323Z  return False 2025-06-26T07:50:30.7860726Z  2025-06-26T07:50:30.7861176Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-06-26T07:50:30.7861760Z  log.warning( 2025-06-26T07:50:30.7862563Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-06-26T07:50:30.7863399Z  ) 2025-06-26T07:50:30.7863754Z  2025-06-26T07:50:30.7864101Z  return True 2025-06-26T07:50:30.7864488Z  2025-06-26T07:50:30.7864908Z  2025-06-26T07:50:30.7865254Z def get_runner_prefix( 2025-06-26T07:50:30.7865704Z  rollout_state: str, 2025-06-26T07:50:30.7866182Z  workflow_requestors: Iterable[str], 2025-06-26T07:50:30.7866687Z  branch: str, 2025-06-26T07:50:30.7867204Z  eligible_experiments: frozenset[str] = frozenset(), 2025-06-26T07:50:30.7867864Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-06-26T07:50:30.7868425Z  is_canary: bool = False, 2025-06-26T07:50:30.7868871Z ) -> str: 2025-06-26T07:50:30.7869307Z  settings = parse_settings(rollout_state) 2025-06-26T07:50:30.7869879Z  user_optins = parse_users(rollout_state) 2025-06-26T07:50:30.7870385Z  2025-06-26T07:50:30.7870852Z  fleet_prefix = "" 2025-06-26T07:50:30.7871288Z  prefixes = [] 2025-06-26T07:50:30.7871946Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-06-26T07:50:30.7872858Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-06-26T07:50:30.7873582Z  log.info( 2025-06-26T07:50:30.7874268Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-06-26T07:50:30.7875092Z  ) 2025-06-26T07:50:30.7875499Z  continue 2025-06-26T07:50:30.7875898Z  2025-06-26T07:50:30.7876257Z  if opt_out_experiments: 2025-06-26T07:50:30.7876799Z  if experiment_name in opt_out_experiments: 2025-06-26T07:50:30.7877423Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-06-26T07:50:30.7877998Z  log.info( 2025-06-26T07:50:30.7878904Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-06-26T07:50:30.7879831Z  ) 2025-06-26T07:50:30.7880237Z  continue 2025-06-26T07:50:30.7880666Z  2025-06-26T07:50:30.7881025Z  if eligible_experiments: 2025-06-26T07:50:30.7881592Z  if experiment_name not in eligible_experiments: 2025-06-26T07:50:30.7882217Z  exp_list = ", ".join(eligible_experiments) 2025-06-26T07:50:30.7882754Z  log.info( 2025-06-26T07:50:30.7883538Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-06-26T07:50:30.7884333Z  ) 2025-06-26T07:50:30.7884748Z  continue 2025-06-26T07:50:30.7885342Z  elif not experiment_settings.default: 2025-06-26T07:50:30.7885857Z  log.info( 2025-06-26T07:50:30.7886647Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-06-26T07:50:30.7887355Z  ) 2025-06-26T07:50:30.7887747Z  continue 2025-06-26T07:50:30.7888155Z  2025-06-26T07:50:30.7888611Z  # Is any workflow_requestor opted out to this experiment? 2025-06-26T07:50:30.7889216Z  opted_out_users = [ 2025-06-26T07:50:30.7889680Z  requestor 2025-06-26T07:50:30.7890160Z  for requestor in workflow_requestors 2025-06-26T07:50:30.7890822Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-06-26T07:50:30.7891432Z  ] 2025-06-26T07:50:30.7891789Z  2025-06-26T07:50:30.7892140Z  if opted_out_users: 2025-06-26T07:50:30.7892604Z  log.info( 2025-06-26T07:50:30.7893242Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-06-26T07:50:30.7893915Z  ) 2025-06-26T07:50:30.7894308Z  continue 2025-06-26T07:50:30.7894722Z  2025-06-26T07:50:30.7895267Z  # Is any workflow_requestor opted in to this experiment? 2025-06-26T07:50:30.7895867Z  opted_in_users = [ 2025-06-26T07:50:30.7896330Z  requestor 2025-06-26T07:50:30.7896819Z  for requestor in workflow_requestors 2025-06-26T07:50:30.7897471Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-06-26T07:50:30.7898073Z  ] 2025-06-26T07:50:30.7898434Z  2025-06-26T07:50:30.7898767Z  enabled = False 2025-06-26T07:50:30.7899214Z  if opted_in_users: 2025-06-26T07:50:30.7899777Z  log.info( 2025-06-26T07:50:30.7900406Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-06-26T07:50:30.7901061Z  ) 2025-06-26T07:50:30.7901460Z  enabled = True 2025-06-26T07:50:30.7901898Z  2025-06-26T07:50:30.7902298Z  elif experiment_settings.rollout_perc: 2025-06-26T07:50:30.7903100Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-06-26T07:50:30.7904001Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-06-26T07:50:30.7904629Z  log.info( 2025-06-26T07:50:30.7905586Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-06-26T07:50:30.7906467Z  ) 2025-06-26T07:50:30.7906897Z  enabled = True 2025-06-26T07:50:30.7907359Z  2025-06-26T07:50:30.7907703Z  if enabled: 2025-06-26T07:50:30.7908151Z  label = experiment_name 2025-06-26T07:50:30.7908709Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-06-26T07:50:30.7909505Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-06-26T07:50:30.7910350Z  # - If it's enabled, then we always list it's prefix first 2025-06-26T07:50:30.7911096Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-06-26T07:50:30.7911734Z  if is_canary: 2025-06-26T07:50:30.7912235Z  label += CANARY_FLEET_SUFFIX 2025-06-26T07:50:30.7912765Z  fleet_prefix = label 2025-06-26T07:50:30.7913250Z  else: 2025-06-26T07:50:30.7913699Z  prefixes.append(label) 2025-06-26T07:50:30.7914182Z  2025-06-26T07:50:30.7914525Z  if len(prefixes) > 1: 2025-06-26T07:50:30.7915191Z  log.error( 2025-06-26T07:50:30.7916222Z  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-06-26T07:50:30.7917269Z  ) 2025-06-26T07:50:30.7917672Z  prefixes = prefixes[:1] 2025-06-26T07:50:30.7918138Z  2025-06-26T07:50:30.7918487Z  # Fleet always comes first 2025-06-26T07:50:30.7918973Z  if fleet_prefix: 2025-06-26T07:50:30.7919433Z  prefixes.insert(0, fleet_prefix) 2025-06-26T07:50:30.7919933Z  2025-06-26T07:50:30.7920364Z  return ".".join(prefixes) + "." if prefixes else "" 2025-06-26T07:50:30.7920919Z  2025-06-26T07:50:30.7921241Z  2025-06-26T07:50:30.7921868Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-06-26T07:50:30.7922615Z  """ 2025-06-26T07:50:30.7923193Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-06-26T07:50:30.7923871Z  2025-06-26T07:50:30.7924432Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-06-26T07:50:30.7925472Z  """ 2025-06-26T07:50:30.7926064Z  gh = get_gh_client(github_token) 2025-06-26T07:50:30.7926618Z  issue = get_issue(gh, repo, issue_num) 2025-06-26T07:50:30.7927282Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-06-26T07:50:30.7927858Z  2025-06-26T07:50:30.7928185Z  2025-06-26T07:50:30.7928765Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-06-26T07:50:30.7929645Z  for _ in range(num_retries): 2025-06-26T07:50:30.7930123Z  try: 2025-06-26T07:50:30.7930570Z  req = Request(url=url, headers=headers) 2025-06-26T07:50:30.7931232Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-06-26T07:50:30.7931859Z  return json.loads(content) 2025-06-26T07:50:30.7932374Z  except Exception as e: 2025-06-26T07:50:30.7932925Z  log.warning(f"Could not download {url}: {e}") 2025-06-26T07:50:30.7933466Z  2025-06-26T07:50:30.7934022Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-06-26T07:50:30.7934720Z  return {} 2025-06-26T07:50:30.7935231Z  2025-06-26T07:50:30.7935557Z  2025-06-26T07:50:30.7935888Z @cache 2025-06-26T07:50:30.7936503Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-06-26T07:50:30.7937232Z  """ 2025-06-26T07:50:30.7937624Z  Dynamically get PR information 2025-06-26T07:50:30.7938108Z  """ 2025-06-26T07:50:30.7938613Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-06-26T07:50:30.7939222Z  headers = { 2025-06-26T07:50:30.7939702Z  "Accept": "application/vnd.github.v3+json", 2025-06-26T07:50:30.7940302Z  "Authorization": f"token {github_token}", 2025-06-26T07:50:30.7940817Z  } 2025-06-26T07:50:30.7941242Z  json_response: dict[str, Any] = download_json( 2025-06-26T07:50:30.7941874Z  url=f"{github_api}/issues/{pr_number}", 2025-06-26T07:50:30.7942401Z  headers=headers, 2025-06-26T07:50:30.7942838Z  ) 2025-06-26T07:50:30.7943177Z  2025-06-26T07:50:30.7943523Z  if not json_response: 2025-06-26T07:50:30.7944109Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-06-26T07:50:30.7944711Z  return {} 2025-06-26T07:50:30.7945218Z  2025-06-26T07:50:30.7945692Z  return json_response 2025-06-26T07:50:30.7946130Z  2025-06-26T07:50:30.7946454Z  2025-06-26T07:50:30.7947020Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-06-26T07:50:30.7947713Z  """ 2025-06-26T07:50:30.7948247Z  Dynamically get the latest list of labels from the pull request 2025-06-26T07:50:30.7948873Z  """ 2025-06-26T07:50:30.7949356Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-06-26T07:50:30.7949952Z  return { 2025-06-26T07:50:30.7950534Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-06-26T07:50:30.7951194Z  } 2025-06-26T07:50:30.7951535Z  2025-06-26T07:50:30.7951863Z  2025-06-26T07:50:30.7952215Z def main() -> None: 2025-06-26T07:50:30.7952648Z  args = parse_args() 2025-06-26T07:50:30.7953083Z  2025-06-26T07:50:30.7953492Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-06-26T07:50:30.7954019Z  2025-06-26T07:50:30.7954374Z  # Check if the PR is opt-out 2025-06-26T07:50:30.7954961Z  if args.pr_number: 2025-06-26T07:50:30.7955630Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-06-26T07:50:30.7956361Z  if OPT_OUT_LABEL in labels: 2025-06-26T07:50:30.7956855Z  log.info( 2025-06-26T07:50:30.7957548Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-06-26T07:50:30.7958278Z  ) 2025-06-26T07:50:30.7958844Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-06-26T07:50:30.7959491Z  sys.exit() 2025-06-26T07:50:30.7960032Z  2025-06-26T07:50:30.7960368Z  try: 2025-06-26T07:50:30.7960820Z  rollout_state = get_rollout_state_from_issue( 2025-06-26T07:50:30.7961515Z  args.github_token, args.github_issue_repo, args.github_issue 2025-06-26T07:50:30.7962135Z  ) 2025-06-26T07:50:30.7962492Z  2025-06-26T07:50:30.7962878Z  username = get_potential_pr_author( 2025-06-26T07:50:30.7963393Z  args.github_token, 2025-06-26T07:50:30.7963881Z  args.github_repo, 2025-06-26T07:50:30.7964367Z  args.github_actor, 2025-06-26T07:50:30.7964973Z  args.github_ref_type, 2025-06-26T07:50:30.7965477Z  args.github_branch, 2025-06-26T07:50:30.7965931Z  ) 2025-06-26T07:50:30.7966282Z  2025-06-26T07:50:30.7966748Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-06-26T07:50:30.7967336Z  2025-06-26T07:50:30.7967740Z  runner_label_prefix = get_runner_prefix( 2025-06-26T07:50:30.7968288Z  rollout_state, 2025-06-26T07:50:30.7968793Z  (args.github_issue_owner, username), 2025-06-26T07:50:30.7969324Z  args.github_branch, 2025-06-26T07:50:30.7969834Z  args.eligible_experiments, 2025-06-26T07:50:30.7970358Z  args.opt_out_experiments, 2025-06-26T07:50:30.7970854Z  is_canary, 2025-06-26T07:50:30.7971273Z  ) 2025-06-26T07:50:30.7971635Z  2025-06-26T07:50:30.7971986Z  except Exception as e: 2025-06-26T07:50:30.7972451Z  log.error( 2025-06-26T07:50:30.7973155Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-06-26T07:50:30.7973876Z  ) 2025-06-26T07:50:30.7974245Z  2025-06-26T07:50:30.7974748Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-06-26T07:50:30.7975610Z  2025-06-26T07:50:30.7975934Z  2025-06-26T07:50:30.7976284Z if __name__ == "__main__": 2025-06-26T07:50:30.7976739Z  main() 2025-06-26T07:50:30.7977103Z  2025-06-26T07:50:30.7977433Z EOF 2025-06-26T07:50:30.7977763Z  2025-06-26T07:50:30.7978119Z cat runner_determinator.py 2025-06-26T07:50:30.8377920Z shell: /usr/bin/bash -e {0} 2025-06-26T07:50:30.8378665Z env: 2025-06-26T07:50:30.8379285Z GITHUB_TOKEN: *** 2025-06-26T07:50:30.8379679Z ISSUE_NUMBER: 5132 2025-06-26T07:50:30.8380080Z TRIGGERING_ACTOR: nautsimon 2025-06-26T07:50:30.8380519Z ISSUE_OWNER: nautsimon 2025-06-26T07:50:30.8380930Z CHECK_EXPERIMENTS: 2025-06-26T07:50:30.8381315Z OPT_OUT_EXPERIMENTS: 2025-06-26T07:50:30.8381713Z PR_NUMBER: 156936 2025-06-26T07:50:30.8382072Z ##[endgroup] 2025-06-26T07:50:30.8603304Z # flake8: noqa: G004 2025-06-26T07:50:30.8603611Z 2025-06-26T07:50:30.8604076Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-06-26T07:50:30.8605287Z # must be kept in sync. You can do it easily by running the following command: 2025-06-26T07:50:30.8606045Z # python .github/scripts/update_runner_determinator.py 2025-06-26T07:50:30.8606454Z 2025-06-26T07:50:30.8606603Z """ 2025-06-26T07:50:30.8607133Z This runner determinator is used to determine which set of runners to run a 2025-06-26T07:50:30.8607931Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-06-26T07:50:30.8608766Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-06-26T07:50:30.8609513Z of which runners should be used to run which job. 2025-06-26T07:50:30.8609885Z 2025-06-26T07:50:30.8610241Z The configuration has two parts, the settings and a list of opted-in users, 2025-06-26T07:50:30.8611266Z separated by a line containing "---". If the line is not present, the 2025-06-26T07:50:30.8612077Z settings are considered to be empty with only the second part, the user 2025-06-26T07:50:30.8612735Z list, defined. 2025-06-26T07:50:30.8612940Z 2025-06-26T07:50:30.8613278Z The first part is a YAML block that defines the rollout settings. This can be 2025-06-26T07:50:30.8614124Z used to define any settings that are needed to determine which runners to use. 2025-06-26T07:50:30.8615220Z It's fields are defined by the RolloutSettings class below. 2025-06-26T07:50:30.8615669Z 2025-06-26T07:50:30.8616023Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-06-26T07:50:30.8616833Z The user list is also a comma separated list of additional features or 2025-06-26T07:50:30.8617505Z experiments which the user could be opted in to. 2025-06-26T07:50:30.8617875Z 2025-06-26T07:50:30.8618069Z The user list has the following rules: 2025-06-26T07:50:30.8618389Z 2025-06-26T07:50:30.8618685Z - Users are GitHub usernames, which must start with the @ prefix 2025-06-26T07:50:30.8619472Z - Each user is also a comma-separated list of features/experiments to enable 2025-06-26T07:50:30.8620181Z - A "#" prefix opts the user out of all experiments 2025-06-26T07:50:30.8620556Z 2025-06-26T07:50:30.8620712Z Example config: 2025-06-26T07:50:30.8621129Z # A list of experiments that can be opted into. 2025-06-26T07:50:30.8621743Z # This defines the behavior they'll induce when opted into. 2025-06-26T07:50:30.8622320Z # Expected syntax is: 2025-06-26T07:50:30.8622909Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-06-26T07:50:30.8623812Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-06-26T07:50:30.8624364Z 2025-06-26T07:50:30.8624527Z experiments: 2025-06-26T07:50:30.8625141Z lf: 2025-06-26T07:50:30.8625550Z rollout_percent: 25 2025-06-26T07:50:30.8625967Z all_branches: false 2025-06-26T07:50:30.8626387Z default: true 2025-06-26T07:50:30.8626757Z --- 2025-06-26T07:50:30.8626941Z 2025-06-26T07:50:30.8627247Z # Opt-ins: 2025-06-26T07:50:30.8627774Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-06-26T07:50:30.8628574Z # and specifying experiments to enable in a comma-separated list. 2025-06-26T07:50:30.8629270Z # To always opt out of an experiment, prefix it with a "-". 2025-06-26T07:50:30.8629873Z # Experiments should be from the above list. 2025-06-26T07:50:30.8630217Z 2025-06-26T07:50:30.8630400Z @User1,-lf,split_build 2025-06-26T07:50:30.8630797Z @User2,lf 2025-06-26T07:50:30.8631154Z @User3,split_build 2025-06-26T07:50:30.8631524Z """ 2025-06-26T07:50:30.8631704Z 2025-06-26T07:50:30.8631866Z import json 2025-06-26T07:50:30.8632202Z import logging 2025-06-26T07:50:30.8632562Z import os 2025-06-26T07:50:30.8632891Z import random 2025-06-26T07:50:30.8633243Z import re 2025-06-26T07:50:30.8633576Z import sys 2025-06-26T07:50:30.8684657Z from argparse import ArgumentParser 2025-06-26T07:50:30.8685610Z from collections.abc import Iterable 2025-06-26T07:50:30.8686165Z from functools import cache 2025-06-26T07:50:30.8686627Z from logging import LogRecord 2025-06-26T07:50:30.8687089Z from typing import Any, NamedTuple 2025-06-26T07:50:30.8687600Z from urllib.request import Request, urlopen 2025-06-26T07:50:30.8687952Z 2025-06-26T07:50:30.8688112Z import yaml 2025-06-26T07:50:30.8688472Z from github import Auth, Github 2025-06-26T07:50:30.8688930Z from github.Issue import Issue 2025-06-26T07:50:30.8689209Z 2025-06-26T07:50:30.8689218Z 2025-06-26T07:50:30.8689425Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-06-26T07:50:30.8690074Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-06-26T07:50:30.8690876Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-06-26T07:50:30.8691396Z 2025-06-26T07:50:30.8691609Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-06-26T07:50:30.8692325Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-06-26T07:50:30.8692811Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-06-26T07:50:30.8693334Z OPT_OUT_LABEL = "no-runner-experiments" 2025-06-26T07:50:30.8693660Z 2025-06-26T07:50:30.8693846Z SETTING_EXPERIMENTS = "experiments" 2025-06-26T07:50:30.8694161Z 2025-06-26T07:50:30.8694336Z LF_FLEET_EXPERIMENT = "lf" 2025-06-26T07:50:30.8694769Z CANARY_FLEET_SUFFIX = ".c" 2025-06-26T07:50:30.8695283Z 2025-06-26T07:50:30.8695291Z 2025-06-26T07:50:30.8695473Z class Experiment(NamedTuple): 2025-06-26T07:50:30.8695928Z rollout_perc: float = ( 2025-06-26T07:50:30.8696523Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-06-26T07:50:30.8697159Z ) 2025-06-26T07:50:30.8697494Z all_branches: bool = ( 2025-06-26T07:50:30.8698085Z False # If True, the experiment is also enabled on the exception branches 2025-06-26T07:50:30.8698708Z ) 2025-06-26T07:50:30.8699042Z default: bool = ( 2025-06-26T07:50:30.8699564Z True # If True, the experiment is enabled by default for all queries 2025-06-26T07:50:30.8700157Z ) 2025-06-26T07:50:30.8700341Z 2025-06-26T07:50:30.8700516Z # Add more fields as needed 2025-06-26T07:50:30.8700794Z 2025-06-26T07:50:30.8700801Z 2025-06-26T07:50:30.8700973Z class Settings(NamedTuple): 2025-06-26T07:50:30.8701390Z """ 2025-06-26T07:50:30.8701801Z Settings for the experiments that can be opted into. 2025-06-26T07:50:30.8702332Z """ 2025-06-26T07:50:30.8702509Z 2025-06-26T07:50:30.8702703Z experiments: dict[str, Experiment] = {} 2025-06-26T07:50:30.8703048Z 2025-06-26T07:50:30.8703054Z 2025-06-26T07:50:30.8703255Z class ColorFormatter(logging.Formatter): 2025-06-26T07:50:30.8703845Z """Color codes the log messages based on the log level""" 2025-06-26T07:50:30.8704286Z 2025-06-26T07:50:30.8704438Z COLORS = { 2025-06-26T07:50:30.8704999Z "WARNING": "\033[33m", # Yellow 2025-06-26T07:50:30.8705536Z "ERROR": "\033[31m", # Red 2025-06-26T07:50:30.8706001Z "CRITICAL": "\033[31m", # Red 2025-06-26T07:50:30.8706465Z "INFO": "\033[0m", # Reset 2025-06-26T07:50:30.8707105Z "DEBUG": "\033[0m", # Reset 2025-06-26T07:50:30.8707545Z } 2025-06-26T07:50:30.8707719Z 2025-06-26T07:50:30.8707926Z def format(self, record: LogRecord) -> str: 2025-06-26T07:50:30.8708624Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-06-26T07:50:30.8709336Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-06-26T07:50:30.8709892Z return super().format(record) 2025-06-26T07:50:30.8710201Z 2025-06-26T07:50:30.8710207Z 2025-06-26T07:50:30.8710396Z handler = logging.StreamHandler() 2025-06-26T07:50:30.8711047Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-06-26T07:50:30.8711556Z 2025-06-26T07:50:30.8711791Z log = logging.getLogger(os.path.basename(__file__)) 2025-06-26T07:50:30.8712328Z log.addHandler(handler) 2025-06-26T07:50:30.8712746Z log.setLevel(logging.INFO) 2025-06-26T07:50:30.8713005Z 2025-06-26T07:50:30.8713012Z 2025-06-26T07:50:30.8713246Z def set_github_output(key: str, value: str) -> None: 2025-06-26T07:50:30.8713771Z """ 2025-06-26T07:50:30.8714226Z Defines outputs of the github action that invokes this script 2025-06-26T07:50:30.8714947Z """ 2025-06-26T07:50:30.8715294Z if not GITHUB_OUTPUT: 2025-06-26T07:50:30.8716276Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-06-26T07:50:30.8717312Z log.warning( 2025-06-26T07:50:30.8718088Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-06-26T07:50:30.8718949Z ) 2025-06-26T07:50:30.8729513Z print(f"::set-output name={key}::{value}") 2025-06-26T07:50:30.8730079Z return 2025-06-26T07:50:30.8730287Z 2025-06-26T07:50:30.8730648Z with open(GITHUB_OUTPUT, "a") as f: 2025-06-26T07:50:30.8731194Z log.info(f"Setting output: {key}='{value}'") 2025-06-26T07:50:30.8731729Z f.write(f"{key}={value}\n") 2025-06-26T07:50:30.8732028Z 2025-06-26T07:50:30.8732034Z 2025-06-26T07:50:30.8732314Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-06-26T07:50:30.8732904Z return frozenset( 2025-06-26T07:50:30.8733469Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-06-26T07:50:30.8734117Z ) 2025-06-26T07:50:30.8734295Z 2025-06-26T07:50:30.8734302Z 2025-06-26T07:50:30.8734477Z def parse_args() -> Any: 2025-06-26T07:50:30.8735369Z parser = ArgumentParser("Get dynamic rollout settings") 2025-06-26T07:50:30.8736197Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-06-26T07:50:30.8736917Z parser.add_argument( 2025-06-26T07:50:30.8737343Z "--github-issue-repo", 2025-06-26T07:50:30.8737773Z type=str, 2025-06-26T07:50:30.8738154Z required=False, 2025-06-26T07:50:30.8738566Z default="pytorch/test-infra", 2025-06-26T07:50:30.8739060Z help="GitHub repo to get the issue", 2025-06-26T07:50:30.8739541Z ) 2025-06-26T07:50:30.8739869Z parser.add_argument( 2025-06-26T07:50:30.8740270Z "--github-repo", 2025-06-26T07:50:30.8740662Z type=str, 2025-06-26T07:50:30.8741036Z required=True, 2025-06-26T07:50:30.8741455Z help="GitHub repo where CI is running", 2025-06-26T07:50:30.8741937Z ) 2025-06-26T07:50:30.8742270Z parser.add_argument( 2025-06-26T07:50:30.8742832Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-06-26T07:50:30.8743436Z ) 2025-06-26T07:50:30.8743779Z parser.add_argument( 2025-06-26T07:50:30.8744341Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-06-26T07:50:30.8745470Z ) 2025-06-26T07:50:30.8745810Z parser.add_argument( 2025-06-26T07:50:30.8746399Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-06-26T07:50:30.8747044Z ) 2025-06-26T07:50:30.8747531Z parser.add_argument( 2025-06-26T07:50:30.8748129Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-06-26T07:50:30.8748786Z ) 2025-06-26T07:50:30.8749124Z parser.add_argument( 2025-06-26T07:50:30.8749527Z "--github-ref-type", 2025-06-26T07:50:30.8749946Z type=str, 2025-06-26T07:50:30.8750304Z required=True, 2025-06-26T07:50:30.8750734Z help="Current GitHub ref type, branch or tag", 2025-06-26T07:50:30.8751234Z ) 2025-06-26T07:50:30.8751568Z parser.add_argument( 2025-06-26T07:50:30.8751987Z "--eligible-experiments", 2025-06-26T07:50:30.8752459Z type=_str_comma_separated_to_set, 2025-06-26T07:50:30.8752942Z required=False, 2025-06-26T07:50:30.8753335Z default="", 2025-06-26T07:50:30.8754122Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-06-26T07:50:30.8755101Z ) 2025-06-26T07:50:30.8755462Z parser.add_argument( 2025-06-26T07:50:30.8755916Z "--opt-out-experiments", 2025-06-26T07:50:30.8756371Z type=_str_comma_separated_to_set, 2025-06-26T07:50:30.8756848Z required=False, 2025-06-26T07:50:30.8757241Z default="", 2025-06-26T07:50:30.8757597Z help=( 2025-06-26T07:50:30.8758208Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-06-26T07:50:30.8759252Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-06-26T07:50:30.8760011Z ), 2025-06-26T07:50:30.8760333Z ) 2025-06-26T07:50:30.8760673Z parser.add_argument( 2025-06-26T07:50:30.8761072Z "--pr-number", 2025-06-26T07:50:30.8761454Z type=str, 2025-06-26T07:50:30.8761810Z required=False, 2025-06-26T07:50:30.8762195Z default="", 2025-06-26T07:50:30.8762736Z help="the optional PR number where this is run", 2025-06-26T07:50:30.8763257Z ) 2025-06-26T07:50:30.8763436Z 2025-06-26T07:50:30.8763613Z return parser.parse_args() 2025-06-26T07:50:30.8763895Z 2025-06-26T07:50:30.8763902Z 2025-06-26T07:50:30.8764267Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-06-26T07:50:30.8765087Z auth = Auth.Token(github_token) 2025-06-26T07:50:30.8765548Z return Github(auth=auth) 2025-06-26T07:50:30.8765815Z 2025-06-26T07:50:30.8765821Z 2025-06-26T07:50:30.8766240Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-06-26T07:50:30.8766972Z repo = gh.get_repo(repo) 2025-06-26T07:50:30.8767432Z return repo.get_issue(number=issue_num) 2025-06-26T07:50:30.8767770Z 2025-06-26T07:50:30.8767776Z 2025-06-26T07:50:30.8767948Z def get_potential_pr_author( 2025-06-26T07:50:30.8768546Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-06-26T07:50:30.8769165Z ) -> str: 2025-06-26T07:50:30.8769632Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-06-26T07:50:30.8770380Z # Fetch the actual username from the original PR. The PR number is 2025-06-26T07:50:30.8771052Z # embedded in the tag name: ciflow// 2025-06-26T07:50:30.8771432Z 2025-06-26T07:50:30.8771611Z gh = get_gh_client(github_token) 2025-06-26T07:50:30.8771916Z 2025-06-26T07:50:30.8772159Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-06-26T07:50:30.8772732Z split_tag = ref_name.split("/") 2025-06-26T07:50:30.8773194Z if ( 2025-06-26T07:50:30.8773540Z len(split_tag) == 3 2025-06-26T07:50:30.8773975Z and split_tag[0] == "ciflow" 2025-06-26T07:50:30.8774454Z and split_tag[2].isnumeric() 2025-06-26T07:50:30.8775154Z ): 2025-06-26T07:50:30.8775533Z pr_number = split_tag[2] 2025-06-26T07:50:30.8775992Z try: 2025-06-26T07:50:30.8776382Z repository = gh.get_repo(repo) 2025-06-26T07:50:30.8776954Z pull = repository.get_pull(number=int(pr_number)) 2025-06-26T07:50:30.8777669Z except Exception as e: 2025-06-26T07:50:30.8778147Z raise Exception( # noqa: TRY002 2025-06-26T07:50:30.8778773Z f"issue with pull request {pr_number} from repo {repository}" 2025-06-26T07:50:30.8779363Z ) from e 2025-06-26T07:50:30.8779859Z return pull.user.login # type: ignore[no-any-return] 2025-06-26T07:50:30.8780493Z # In all other cases, return the original input username 2025-06-26T07:50:30.8781035Z return username 2025-06-26T07:50:30.8781252Z 2025-06-26T07:50:30.8781259Z 2025-06-26T07:50:30.8781474Z def is_exception_branch(branch: str) -> bool: 2025-06-26T07:50:30.8781953Z """ 2025-06-26T07:50:30.8782537Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-06-26T07:50:30.8783243Z """ 2025-06-26T07:50:30.8783743Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-06-26T07:50:30.8784224Z 2025-06-26T07:50:30.8784230Z 2025-06-26T07:50:30.8784408Z def load_yaml(yaml_text: str) -> Any: 2025-06-26T07:50:30.8785002Z try: 2025-06-26T07:50:30.8785355Z data = yaml.safe_load(yaml_text) 2025-06-26T07:50:30.8785821Z return data 2025-06-26T07:50:30.8786198Z except yaml.YAMLError: 2025-06-26T07:50:30.8786633Z log.exception("Error loading YAML") 2025-06-26T07:50:30.8787115Z raise 2025-06-26T07:50:30.8787305Z 2025-06-26T07:50:30.8787312Z 2025-06-26T07:50:30.8787704Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-06-26T07:50:30.8788381Z """ 2025-06-26T07:50:30.8788960Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-06-26T07:50:30.8789514Z 2025-06-26T07:50:30.8789948Z If the issue body contains "---" then the text above that is the settings 2025-06-26T07:50:30.8790648Z and the text below is the list of opted in users. 2025-06-26T07:50:30.8791020Z 2025-06-26T07:50:30.8791358Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-06-26T07:50:30.8791999Z """ 2025-06-26T07:50:30.8792392Z rollout_state_parts = rollout_state.split("---") 2025-06-26T07:50:30.8792944Z if len(rollout_state_parts) >= 2: 2025-06-26T07:50:30.8793491Z return rollout_state_parts[0], rollout_state_parts[1] 2025-06-26T07:50:30.8794032Z else: 2025-06-26T07:50:30.8794373Z return "", rollout_state 2025-06-26T07:50:30.8794657Z 2025-06-26T07:50:30.8794663Z 2025-06-26T07:50:30.8794944Z class UserOptins(dict[str, list[str]]): 2025-06-26T07:50:30.8795414Z """ 2025-06-26T07:50:30.8795878Z Dictionary of users with a list of features they have opted into 2025-06-26T07:50:30.8796470Z """ 2025-06-26T07:50:30.8796642Z 2025-06-26T07:50:30.8796649Z 2025-06-26T07:50:30.8796966Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-06-26T07:50:30.8797583Z """ 2025-06-26T07:50:30.8798234Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-06-26T07:50:30.8798858Z 2025-06-26T07:50:30.8799427Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-06-26T07:50:30.8800339Z - Example line: "@User1,lf,split_build" 2025-06-26T07:50:30.8800963Z - A "#" prefix indicates the user is opted out of all experiments 2025-06-26T07:50:30.8801405Z 2025-06-26T07:50:30.8801412Z 2025-06-26T07:50:30.8801559Z """ 2025-06-26T07:50:30.8801894Z optins = UserOptins() 2025-06-26T07:50:30.8802347Z for user in user_optin_text.split("\n"): 2025-06-26T07:50:30.8802858Z user = user.strip("\r\n\t -") 2025-06-26T07:50:30.8803361Z if not user or not user.startswith("@"): 2025-06-26T07:50:30.8803875Z # Not a valid user. Skip 2025-06-26T07:50:30.8804350Z continue 2025-06-26T07:50:30.8804575Z 2025-06-26T07:50:30.8804967Z if user: 2025-06-26T07:50:30.8805367Z usr_name = user.split(",")[0].strip("@") 2025-06-26T07:50:30.8806008Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-06-26T07:50:30.8806456Z 2025-06-26T07:50:30.8806613Z return optins 2025-06-26T07:50:30.8806825Z 2025-06-26T07:50:30.8806832Z 2025-06-26T07:50:30.8807093Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-06-26T07:50:30.8807642Z """ 2025-06-26T07:50:30.8807997Z Check if the experiment name is valid. 2025-06-26T07:50:30.8808471Z A valid name: 2025-06-26T07:50:30.8809042Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-06-26T07:50:30.8809902Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-06-26T07:50:30.8810562Z - Cannot contain spaces 2025-06-26T07:50:30.8810983Z """ 2025-06-26T07:50:30.8811158Z 2025-06-26T07:50:30.8811405Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-06-26T07:50:30.8812044Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-06-26T07:50:30.8812453Z 2025-06-26T07:50:30.8812603Z if valid: 2025-06-26T07:50:30.8812940Z return True 2025-06-26T07:50:30.8813158Z 2025-06-26T07:50:30.8813315Z log.error( 2025-06-26T07:50:30.8814642Z 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-06-26T07:50:30.8816359Z ) 2025-06-26T07:50:30.8816690Z return False 2025-06-26T07:50:30.8816895Z 2025-06-26T07:50:30.8816903Z 2025-06-26T07:50:30.8817182Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-06-26T07:50:30.8817747Z """ 2025-06-26T07:50:30.8818407Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-06-26T07:50:30.8819082Z """ 2025-06-26T07:50:30.8819411Z try: 2025-06-26T07:50:30.8819746Z if settings_text: 2025-06-26T07:50:30.8820407Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-06-26T07:50:30.8821130Z # for easy reading 2025-06-26T07:50:30.8821847Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-06-26T07:50:30.8822656Z # the backtick character in shell commands. 2025-06-26T07:50:30.8823212Z backtick = chr(96) # backtick character 2025-06-26T07:50:30.8823813Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-06-26T07:50:30.8824409Z settings = load_yaml(settings_text) 2025-06-26T07:50:30.8824752Z 2025-06-26T07:50:30.8825319Z # For now we just load experiments. We can expand this if/when we add more settings 2025-06-26T07:50:30.8826012Z experiments = {} 2025-06-26T07:50:30.8826282Z 2025-06-26T07:50:30.8826636Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-06-26T07:50:30.8827316Z if not is_valid_experiment_name(exp_name): 2025-06-26T07:50:30.8828326Z # 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-06-26T07:50:30.8829277Z continue 2025-06-26T07:50:30.8829534Z 2025-06-26T07:50:30.8829704Z valid_settings = {} 2025-06-26T07:50:30.8830179Z for setting in exp_settings: 2025-06-26T07:50:30.8830692Z if setting not in Experiment._fields: 2025-06-26T07:50:30.8831205Z log.warning( 2025-06-26T07:50:30.8831844Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-06-26T07:50:30.8832510Z ) 2025-06-26T07:50:30.8832903Z else: 2025-06-26T07:50:30.8833363Z valid_settings[setting] = exp_settings[setting] 2025-06-26T07:50:30.8833876Z 2025-06-26T07:50:30.8834131Z experiments[exp_name] = Experiment(**valid_settings) 2025-06-26T07:50:30.8834707Z return Settings(experiments) 2025-06-26T07:50:30.8835170Z 2025-06-26T07:50:30.8835335Z except Exception: 2025-06-26T07:50:30.8835764Z log.exception("Failed to parse settings") 2025-06-26T07:50:30.8836115Z 2025-06-26T07:50:30.8836275Z return Settings() 2025-06-26T07:50:30.8836509Z 2025-06-26T07:50:30.8836515Z 2025-06-26T07:50:30.8836751Z def parse_settings(rollout_state: str) -> Settings: 2025-06-26T07:50:30.8837268Z """ 2025-06-26T07:50:30.8837650Z Parse settings, if any, from the rollout state. 2025-06-26T07:50:30.8838009Z 2025-06-26T07:50:30.8838332Z If the issue body contains "---" then the text above that is the settings 2025-06-26T07:50:30.8839029Z and the text below is the list of opted in users. 2025-06-26T07:50:30.8839397Z 2025-06-26T07:50:30.8839784Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-06-26T07:50:30.8840445Z """ 2025-06-26T07:50:30.8840947Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-06-26T07:50:30.8841630Z return parse_settings_from_text(settings_text) 2025-06-26T07:50:30.8841991Z 2025-06-26T07:50:30.8841998Z 2025-06-26T07:50:30.8842220Z def parse_users(rollout_state: str) -> UserOptins: 2025-06-26T07:50:30.8842722Z """ 2025-06-26T07:50:30.8843071Z Parse users from the rollout state. 2025-06-26T07:50:30.8843386Z 2025-06-26T07:50:30.8843536Z """ 2025-06-26T07:50:30.8844004Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-06-26T07:50:30.8844663Z return parse_user_opt_in_from_text(users_text) 2025-06-26T07:50:30.8845123Z 2025-06-26T07:50:30.8845129Z 2025-06-26T07:50:30.8845634Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-06-26T07:50:30.8846333Z """ 2025-06-26T07:50:30.8846705Z Check if a user is opted into an experiment 2025-06-26T07:50:30.8847192Z """ 2025-06-26T07:50:30.8847590Z return experiment_name in user_optins.get(user, []) 2025-06-26T07:50:30.8847965Z 2025-06-26T07:50:30.8847971Z 2025-06-26T07:50:30.8848352Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-06-26T07:50:30.8849028Z """ 2025-06-26T07:50:30.8849434Z Check if a user explicitly opted out of an experiment 2025-06-26T07:50:30.8849960Z """ 2025-06-26T07:50:30.8850397Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-06-26T07:50:30.8851010Z experiment_optout = "-" + experiment_name 2025-06-26T07:50:30.8851587Z if experiment_optout not in user_optins.get(user, []): 2025-06-26T07:50:30.8852120Z return False 2025-06-26T07:50:30.8852343Z 2025-06-26T07:50:30.8852601Z if is_user_opted_in(user, user_optins, experiment_name): 2025-06-26T07:50:30.8853138Z log.warning( 2025-06-26T07:50:30.8853872Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-06-26T07:50:30.8854667Z ) 2025-06-26T07:50:30.8855052Z 2025-06-26T07:50:30.8855257Z return True 2025-06-26T07:50:30.8855467Z 2025-06-26T07:50:30.8855473Z 2025-06-26T07:50:30.8855645Z def get_runner_prefix( 2025-06-26T07:50:30.8856036Z rollout_state: str, 2025-06-26T07:50:30.8856453Z workflow_requestors: Iterable[str], 2025-06-26T07:50:30.8856931Z branch: str, 2025-06-26T07:50:30.8857533Z eligible_experiments: frozenset[str] = frozenset(), 2025-06-26T07:50:30.8858134Z opt_out_experiments: frozenset[str] = frozenset(), 2025-06-26T07:50:30.8858672Z is_canary: bool = False, 2025-06-26T07:50:30.8859076Z ) -> str: 2025-06-26T07:50:30.8859450Z settings = parse_settings(rollout_state) 2025-06-26T07:50:30.8860060Z user_optins = parse_users(rollout_state) 2025-06-26T07:50:30.8860463Z 2025-06-26T07:50:30.8860768Z fleet_prefix = "" 2025-06-26T07:50:30.8861151Z prefixes = [] 2025-06-26T07:50:30.8861706Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-06-26T07:50:30.8862557Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-06-26T07:50:30.8863200Z log.info( 2025-06-26T07:50:30.8863813Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-06-26T07:50:30.8864498Z ) 2025-06-26T07:50:30.8864954Z continue 2025-06-26T07:50:30.8865183Z 2025-06-26T07:50:30.8865364Z if opt_out_experiments: 2025-06-26T07:50:30.8865835Z if experiment_name in opt_out_experiments: 2025-06-26T07:50:30.8866414Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-06-26T07:50:30.8866940Z log.info( 2025-06-26T07:50:30.8867789Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-06-26T07:50:30.8868678Z ) 2025-06-26T07:50:30.8869034Z continue 2025-06-26T07:50:30.8869270Z 2025-06-26T07:50:30.8869444Z if eligible_experiments: 2025-06-26T07:50:30.8869963Z if experiment_name not in eligible_experiments: 2025-06-26T07:50:30.8870540Z exp_list = ", ".join(eligible_experiments) 2025-06-26T07:50:30.8871043Z log.info( 2025-06-26T07:50:30.8871752Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-06-26T07:50:30.8872508Z ) 2025-06-26T07:50:30.8872870Z continue 2025-06-26T07:50:30.8873290Z elif not experiment_settings.default: 2025-06-26T07:50:30.8873777Z log.info( 2025-06-26T07:50:30.8874489Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-06-26T07:50:30.8875274Z ) 2025-06-26T07:50:30.8875620Z continue 2025-06-26T07:50:30.8875834Z 2025-06-26T07:50:30.8876088Z # Is any workflow_requestor opted out to this experiment? 2025-06-26T07:50:30.8876642Z opted_out_users = [ 2025-06-26T07:50:30.8877036Z requestor 2025-06-26T07:50:30.8877454Z for requestor in workflow_requestors 2025-06-26T07:50:30.8878048Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-06-26T07:50:30.8878624Z ] 2025-06-26T07:50:30.8878804Z 2025-06-26T07:50:30.8878975Z if opted_out_users: 2025-06-26T07:50:30.8879379Z log.info( 2025-06-26T07:50:30.8879931Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-06-26T07:50:30.8880559Z ) 2025-06-26T07:50:30.8880899Z continue 2025-06-26T07:50:30.8881117Z 2025-06-26T07:50:30.8881370Z # Is any workflow_requestor opted in to this experiment? 2025-06-26T07:50:30.8881924Z opted_in_users = [ 2025-06-26T07:50:30.8882324Z requestor 2025-06-26T07:50:30.8882732Z for requestor in workflow_requestors 2025-06-26T07:50:30.8883325Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-06-26T07:50:30.8883881Z ] 2025-06-26T07:50:30.8884061Z 2025-06-26T07:50:30.8884213Z enabled = False 2025-06-26T07:50:30.8884598Z if opted_in_users: 2025-06-26T07:50:30.8885127Z log.info( 2025-06-26T07:50:30.8885655Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-06-26T07:50:30.8886278Z ) 2025-06-26T07:50:30.8886616Z enabled = True 2025-06-26T07:50:30.8886874Z 2025-06-26T07:50:30.8887073Z elif experiment_settings.rollout_perc: 2025-06-26T07:50:30.8887833Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-06-26T07:50:30.8888674Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-06-26T07:50:30.8889389Z log.info( 2025-06-26T07:50:30.8890167Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-06-26T07:50:30.8891004Z ) 2025-06-26T07:50:30.8891367Z enabled = True 2025-06-26T07:50:30.8891637Z 2025-06-26T07:50:30.8891786Z if enabled: 2025-06-26T07:50:30.8892171Z label = experiment_name 2025-06-26T07:50:30.8892657Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-06-26T07:50:30.8893406Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-06-26T07:50:30.8894197Z # - If it's enabled, then we always list it's prefix first 2025-06-26T07:50:30.8895115Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-06-26T07:50:30.8895761Z if is_canary: 2025-06-26T07:50:30.8896212Z label += CANARY_FLEET_SUFFIX 2025-06-26T07:50:30.8896713Z fleet_prefix = label 2025-06-26T07:50:30.8897147Z else: 2025-06-26T07:50:30.8897527Z prefixes.append(label) 2025-06-26T07:50:30.8897834Z 2025-06-26T07:50:30.8898000Z if len(prefixes) > 1: 2025-06-26T07:50:30.8898402Z log.error( 2025-06-26T07:50:30.8899322Z 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-06-26T07:50:30.8900335Z ) 2025-06-26T07:50:30.8900680Z prefixes = prefixes[:1] 2025-06-26T07:50:30.8900956Z 2025-06-26T07:50:30.8901126Z # Fleet always comes first 2025-06-26T07:50:30.8901555Z if fleet_prefix: 2025-06-26T07:50:30.8901951Z prefixes.insert(0, fleet_prefix) 2025-06-26T07:50:30.8902273Z 2025-06-26T07:50:30.8902622Z return ".".join(prefixes) + "." if prefixes else "" 2025-06-26T07:50:30.8903006Z 2025-06-26T07:50:30.8903018Z 2025-06-26T07:50:30.8903418Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-06-26T07:50:30.8904163Z """ 2025-06-26T07:50:30.8904695Z Gets the first comment of the issue, which contains the desired rollout state. 2025-06-26T07:50:30.8905329Z 2025-06-26T07:50:30.8905677Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-06-26T07:50:30.8906311Z """ 2025-06-26T07:50:30.8906656Z gh = get_gh_client(github_token) 2025-06-26T07:50:30.8907134Z issue = get_issue(gh, repo, issue_num) 2025-06-26T07:50:30.8907704Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-06-26T07:50:30.8908105Z 2025-06-26T07:50:30.8908112Z 2025-06-26T07:50:30.8908478Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-06-26T07:50:30.8909172Z for _ in range(num_retries): 2025-06-26T07:50:30.8909606Z try: 2025-06-26T07:50:30.8910008Z req = Request(url=url, headers=headers) 2025-06-26T07:50:30.8910607Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-06-26T07:50:30.8911207Z return json.loads(content) 2025-06-26T07:50:30.8911684Z except Exception as e: 2025-06-26T07:50:30.8912178Z log.warning(f"Could not download {url}: {e}") 2025-06-26T07:50:30.8912538Z 2025-06-26T07:50:30.8912906Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-06-26T07:50:30.8913546Z return {} 2025-06-26T07:50:30.8913741Z 2025-06-26T07:50:30.8913748Z 2025-06-26T07:50:30.8913903Z @cache 2025-06-26T07:50:30.8914456Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-06-26T07:50:30.8915330Z """ 2025-06-26T07:50:30.8915684Z Dynamically get PR information 2025-06-26T07:50:30.8916125Z """ 2025-06-26T07:50:30.8916577Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-06-26T07:50:30.8917153Z headers = { 2025-06-26T07:50:30.8917568Z "Accept": "application/vnd.github.v3+json", 2025-06-26T07:50:30.8918242Z "Authorization": f"token {github_token}", 2025-06-26T07:50:30.8918732Z } 2025-06-26T07:50:30.8919109Z json_response: dict[str, Any] = download_json( 2025-06-26T07:50:30.8919661Z url=f"{github_api}/issues/{pr_number}", 2025-06-26T07:50:30.8920178Z headers=headers, 2025-06-26T07:50:30.8920560Z ) 2025-06-26T07:50:30.8920734Z 2025-06-26T07:50:30.8920898Z if not json_response: 2025-06-26T07:50:30.8921407Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-06-26T07:50:30.8921969Z return {} 2025-06-26T07:50:30.8922177Z 2025-06-26T07:50:30.8922337Z return json_response 2025-06-26T07:50:30.8922583Z 2025-06-26T07:50:30.8922590Z 2025-06-26T07:50:30.8922957Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-06-26T07:50:30.8923616Z """ 2025-06-26T07:50:30.8924089Z Dynamically get the latest list of labels from the pull request 2025-06-26T07:50:30.8924687Z """ 2025-06-26T07:50:30.8925224Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-06-26T07:50:30.8925780Z return { 2025-06-26T07:50:30.8926291Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-06-26T07:50:30.8926926Z } 2025-06-26T07:50:30.8927097Z 2025-06-26T07:50:30.8927104Z 2025-06-26T07:50:30.8927259Z def main() -> None: 2025-06-26T07:50:30.8927635Z args = parse_args() 2025-06-26T07:50:30.8927867Z 2025-06-26T07:50:30.8928069Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-06-26T07:50:30.8928415Z 2025-06-26T07:50:30.8928584Z # Check if the PR is opt-out 2025-06-26T07:50:30.8929023Z if args.pr_number: 2025-06-26T07:50:30.8929613Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-06-26T07:50:30.8930695Z if OPT_OUT_LABEL in labels: 2025-06-26T07:50:30.8931148Z log.info( 2025-06-26T07:50:30.8931769Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-06-26T07:50:30.8932595Z ) 2025-06-26T07:50:30.8933182Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-06-26T07:50:30.8933911Z sys.exit() 2025-06-26T07:50:30.8934146Z 2025-06-26T07:50:30.8934290Z try: 2025-06-26T07:50:30.8934688Z rollout_state = get_rollout_state_from_issue( 2025-06-26T07:50:30.8935466Z args.github_token, args.github_issue_repo, args.github_issue 2025-06-26T07:50:30.8936046Z ) 2025-06-26T07:50:30.8936227Z 2025-06-26T07:50:30.8936413Z username = get_potential_pr_author( 2025-06-26T07:50:30.8936901Z args.github_token, 2025-06-26T07:50:30.8937323Z args.github_repo, 2025-06-26T07:50:30.8937748Z args.github_actor, 2025-06-26T07:50:30.8938181Z args.github_ref_type, 2025-06-26T07:50:30.8938624Z args.github_branch, 2025-06-26T07:50:30.8939035Z ) 2025-06-26T07:50:30.8939220Z 2025-06-26T07:50:30.8939474Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-06-26T07:50:30.8939879Z 2025-06-26T07:50:30.8940083Z runner_label_prefix = get_runner_prefix( 2025-06-26T07:50:30.8940582Z rollout_state, 2025-06-26T07:50:30.8941017Z (args.github_issue_owner, username), 2025-06-26T07:50:30.8941516Z args.github_branch, 2025-06-26T07:50:30.8941965Z args.eligible_experiments, 2025-06-26T07:50:30.8942440Z args.opt_out_experiments, 2025-06-26T07:50:30.8942902Z is_canary, 2025-06-26T07:50:30.8943273Z ) 2025-06-26T07:50:30.8943451Z 2025-06-26T07:50:30.8943621Z except Exception as e: 2025-06-26T07:50:30.8944032Z log.error( 2025-06-26T07:50:30.8944631Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-06-26T07:50:30.8945431Z ) 2025-06-26T07:50:30.8945616Z 2025-06-26T07:50:30.8945920Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-06-26T07:50:30.8946503Z 2025-06-26T07:50:30.8946511Z 2025-06-26T07:50:30.8946676Z if __name__ == "__main__": 2025-06-26T07:50:30.8947077Z main() 2025-06-26T07:50:30.8947261Z 2025-06-26T07:50:30.9037259Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-06-26T07:50:30.9038062Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-06-26T07:50:30.9095942Z shell: /usr/bin/bash -e {0} 2025-06-26T07:50:30.9096378Z env: 2025-06-26T07:50:30.9096930Z GITHUB_TOKEN: *** 2025-06-26T07:50:30.9097309Z ISSUE_NUMBER: 5132 2025-06-26T07:50:30.9097692Z TRIGGERING_ACTOR: nautsimon 2025-06-26T07:50:30.9098129Z ISSUE_OWNER: nautsimon 2025-06-26T07:50:30.9098535Z CHECK_EXPERIMENTS: 2025-06-26T07:50:30.9098921Z OPT_OUT_EXPERIMENTS: 2025-06-26T07:50:30.9099306Z PR_NUMBER: 156936 2025-06-26T07:50:30.9099652Z ##[endgroup] 2025-06-26T07:50:31.2735356Z Defaulting to user installation because normal site-packages is not writeable 2025-06-26T07:50:31.6317227Z Collecting urllib3==1.26.18 2025-06-26T07:50:31.6640628Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-06-26T07:50:31.6877137Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.6 MB/s eta 0:00:00 2025-06-26T07:50:31.7087737Z Collecting PyGithub==2.3.0 2025-06-26T07:50:31.7119620Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-06-26T07:50:31.7753404Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-06-26T07:50:31.7778941Z 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-06-26T07:50:31.7822559Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-06-26T07:50:31.7838739Z 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-06-26T07:50:31.7852945Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-06-26T07:50:31.8099953Z Collecting Deprecated (from PyGithub==2.3.0) 2025-06-26T07:50:31.8124112Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-06-26T07:50:31.8348420Z 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-06-26T07:50:31.9382297Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-06-26T07:50:31.9407267Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-06-26T07:50:32.0417673Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-06-26T07:50:32.0442840Z 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-06-26T07:50:32.0608695Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-06-26T07:50:32.0631788Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-06-26T07:50:32.0902324Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-06-26T07:50:32.0964297Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 30.2 MB/s eta 0:00:00 2025-06-26T07:50:32.0997020Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-06-26T07:50:32.1055194Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 84.8 MB/s eta 0:00:00 2025-06-26T07:50:32.1080061Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-06-26T07:50:32.1168896Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 117.0 MB/s eta 0:00:00 2025-06-26T07:50:32.1192933Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-06-26T07:50:32.1237093Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-06-26T07:50:32.1304447Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 90.6 MB/s eta 0:00:00 2025-06-26T07:50:32.1330232Z 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-06-26T07:50:32.1369941Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 30.9 MB/s eta 0:00:00 2025-06-26T07:50:32.1392032Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-06-26T07:50:32.1435805Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 41.0 MB/s eta 0:00:00 2025-06-26T07:50:32.4253017Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-06-26T07:50:32.9539260Z 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-06-26T07:50:33.0332990Z ##[group]Run curr_branch="gh/nautsimon/7/head" 2025-06-26T07:50:33.0333428Z curr_branch="gh/nautsimon/7/head" 2025-06-26T07:50:33.0333736Z curr_ref_type="branch" 2025-06-26T07:50:33.0334027Z echo "Current branch is '$curr_branch'" 2025-06-26T07:50:33.0334362Z  2025-06-26T07:50:33.0334591Z python3 runner_determinator.py \ 2025-06-26T07:50:33.0335192Z  --github-token "$GITHUB_TOKEN" \ 2025-06-26T07:50:33.0335519Z  --github-issue "$ISSUE_NUMBER" \ 2025-06-26T07:50:33.0335818Z  --github-branch "$curr_branch" \ 2025-06-26T07:50:33.0336128Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-06-26T07:50:33.0336448Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-06-26T07:50:33.0336775Z  --github-ref-type "$curr_ref_type" \ 2025-06-26T07:50:33.0337118Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-06-26T07:50:33.0337550Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-06-26T07:50:33.0337926Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-06-26T07:50:33.0338260Z  --pr-number "${PR_NUMBER}" 2025-06-26T07:50:33.0397217Z shell: /usr/bin/bash -e {0} 2025-06-26T07:50:33.0397491Z env: 2025-06-26T07:50:33.0398183Z GITHUB_TOKEN: *** 2025-06-26T07:50:33.0398417Z ISSUE_NUMBER: 5132 2025-06-26T07:50:33.0398661Z TRIGGERING_ACTOR: nautsimon 2025-06-26T07:50:33.0398917Z ISSUE_OWNER: nautsimon 2025-06-26T07:50:33.0399179Z CHECK_EXPERIMENTS: 2025-06-26T07:50:33.0399417Z OPT_OUT_EXPERIMENTS: 2025-06-26T07:50:33.0399658Z PR_NUMBER: 156936 2025-06-26T07:50:33.0399883Z ##[endgroup] 2025-06-26T07:50:33.0478092Z Current branch is 'gh/nautsimon/7/head' 2025-06-26T07:50:34.8914083Z INFO : Setting output: label-type='' 2025-06-26T07:50:34.9237480Z Evaluate and set job outputs 2025-06-26T07:50:34.9244684Z Cleaning up orphan processes