2025-09-07T06:09:28.0797226Z Current runner version: '2.328.0' 2025-09-07T06:09:28.0819635Z ##[group]Runner Image Provisioner 2025-09-07T06:09:28.0820390Z Hosted Compute Agent 2025-09-07T06:09:28.0820885Z Version: 20250829.383 2025-09-07T06:09:28.0821723Z Commit: 27cb235aab5b0e52e153a26cd86b4742e89dac5d 2025-09-07T06:09:28.0822381Z Build Date: 2025-08-29T13:48:48Z 2025-09-07T06:09:28.0822968Z ##[endgroup] 2025-09-07T06:09:28.0823559Z ##[group]Operating System 2025-09-07T06:09:28.0824102Z Ubuntu 2025-09-07T06:09:28.0824553Z 24.04.3 2025-09-07T06:09:28.0825032Z LTS 2025-09-07T06:09:28.0825473Z ##[endgroup] 2025-09-07T06:09:28.0825912Z ##[group]Runner Image 2025-09-07T06:09:28.0826507Z Image: ubuntu-24.04 2025-09-07T06:09:28.0826965Z Version: 20250831.1.0 2025-09-07T06:09:28.0827983Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250831.1/images/ubuntu/Ubuntu2404-Readme.md 2025-09-07T06:09:28.0829491Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250831.1 2025-09-07T06:09:28.0830422Z ##[endgroup] 2025-09-07T06:09:28.0831797Z ##[group]GITHUB_TOKEN Permissions 2025-09-07T06:09:28.0833943Z Contents: read 2025-09-07T06:09:28.0834556Z Metadata: read 2025-09-07T06:09:28.0835037Z Packages: read 2025-09-07T06:09:28.0835522Z ##[endgroup] 2025-09-07T06:09:28.0837861Z Secret source: Actions 2025-09-07T06:09:28.0838758Z Prepare workflow directory 2025-09-07T06:09:28.1347850Z Prepare all required actions 2025-09-07T06:09:28.1403995Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (93fb23d6fae7c4e82c4239a1033e522088742634) 2025-09-07T06:09:28.1408756Z ##[group] Inputs 2025-09-07T06:09:28.1409358Z check_experiments: 2025-09-07T06:09:28.1410022Z opt_out_experiments: 2025-09-07T06:09:28.1410562Z triggering_actor: pytorchmergebot 2025-09-07T06:09:28.1411157Z issue_owner: 2025-09-07T06:09:28.1411879Z curr_branch: main 2025-09-07T06:09:28.1412501Z curr_ref_type: branch 2025-09-07T06:09:28.1413021Z issue_number: 5132 2025-09-07T06:09:28.1413654Z ##[endgroup] 2025-09-07T06:09:28.1414261Z Complete job name: get-label-type / runner-determinator 2025-09-07T06:09:28.1986847Z ##[group]Run cat < runner_determinator.py 2025-09-07T06:09:28.1989287Z cat < runner_determinator.py 2025-09-07T06:09:28.1990012Z # flake8: noqa: G004 2025-09-07T06:09:28.1990519Z  2025-09-07T06:09:28.1991239Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-09-07T06:09:28.1992713Z # must be kept in sync. You can do it easily by running the following command: 2025-09-07T06:09:28.1993682Z # python .github/scripts/update_runner_determinator.py 2025-09-07T06:09:28.1994375Z  2025-09-07T06:09:28.1994814Z """ 2025-09-07T06:09:28.1995513Z This runner determinator is used to determine which set of runners to run a 2025-09-07T06:09:28.1996466Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-09-07T06:09:28.1997638Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-09-07T06:09:28.1998575Z of which runners should be used to run which job. 2025-09-07T06:09:28.1999251Z  2025-09-07T06:09:28.1999907Z The configuration has two parts, the settings and a list of opted-in users, 2025-09-07T06:09:28.2000911Z separated by a line containing "---". If the line is not present, the 2025-09-07T06:09:28.2002063Z settings are considered to be empty with only the second part, the user 2025-09-07T06:09:28.2002847Z list, defined. 2025-09-07T06:09:28.2003375Z  2025-09-07T06:09:28.2003982Z The first part is a YAML block that defines the rollout settings. This can be 2025-09-07T06:09:28.2005065Z used to define any settings that are needed to determine which runners to use. 2025-09-07T06:09:28.2006023Z It's fields are defined by the RolloutSettings class below. 2025-09-07T06:09:28.2006976Z  2025-09-07T06:09:28.2007712Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-09-07T06:09:28.2008658Z The user list is also a comma separated list of additional features or 2025-09-07T06:09:28.2009550Z experiments which the user could be opted in to. 2025-09-07T06:09:28.2010229Z  2025-09-07T06:09:28.2010682Z The user list has the following rules: 2025-09-07T06:09:28.2011494Z  2025-09-07T06:09:28.2012214Z - Users are GitHub usernames, which must start with the @ prefix 2025-09-07T06:09:28.2013180Z - Each user is also a comma-separated list of features/experiments to enable 2025-09-07T06:09:28.2014110Z - A "#" prefix opts the user out of all experiments 2025-09-07T06:09:28.2014737Z  2025-09-07T06:09:28.2015190Z Example config: 2025-09-07T06:09:28.2015741Z  # A list of experiments that can be opted into. 2025-09-07T06:09:28.2016640Z  # This defines the behavior they'll induce when opted into. 2025-09-07T06:09:28.2017337Z  # Expected syntax is: 2025-09-07T06:09:28.2018141Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-09-07T06:09:28.2019218Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-09-07T06:09:28.2020016Z  2025-09-07T06:09:28.2020493Z  experiments: 2025-09-07T06:09:28.2021009Z  lf: 2025-09-07T06:09:28.2021633Z  rollout_percent: 25 2025-09-07T06:09:28.2022164Z  all_branches: false 2025-09-07T06:09:28.2022810Z  default: true 2025-09-07T06:09:28.2023344Z  --- 2025-09-07T06:09:28.2023759Z  2025-09-07T06:09:28.2024354Z  # Opt-ins: 2025-09-07T06:09:28.2025026Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-09-07T06:09:28.2026208Z  # and specifying experiments to enable in a comma-separated list. 2025-09-07T06:09:28.2027136Z  # To always opt out of an experiment, prefix it with a "-". 2025-09-07T06:09:28.2027864Z  # Experiments should be from the above list. 2025-09-07T06:09:28.2028532Z  2025-09-07T06:09:28.2029044Z  @User1,-lf,split_build 2025-09-07T06:09:28.2029611Z  @User2,lf 2025-09-07T06:09:28.2030085Z  @User3,split_build 2025-09-07T06:09:28.2030695Z """ 2025-09-07T06:09:28.2031120Z  2025-09-07T06:09:28.2031942Z import json 2025-09-07T06:09:28.2032534Z import logging 2025-09-07T06:09:28.2033072Z import os 2025-09-07T06:09:28.2033611Z import random 2025-09-07T06:09:28.2034146Z import re 2025-09-07T06:09:28.2034604Z import sys 2025-09-07T06:09:28.2035168Z from argparse import ArgumentParser 2025-09-07T06:09:28.2035861Z from collections.abc import Iterable 2025-09-07T06:09:28.2036500Z from functools import cache 2025-09-07T06:09:28.2037056Z from logging import LogRecord 2025-09-07T06:09:28.2037741Z from typing import Any, NamedTuple 2025-09-07T06:09:28.2038424Z from urllib.request import Request, urlopen 2025-09-07T06:09:28.2039007Z  2025-09-07T06:09:28.2039540Z import yaml 2025-09-07T06:09:28.2040019Z from github import Auth, Github 2025-09-07T06:09:28.2040620Z from github.Issue import Issue 2025-09-07T06:09:28.2041217Z  2025-09-07T06:09:28.2041877Z  2025-09-07T06:09:28.2042371Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-09-07T06:09:28.2043287Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-09-07T06:09:28.2044255Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-09-07T06:09:28.2045194Z  2025-09-07T06:09:28.2045799Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-09-07T06:09:28.2046447Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-09-07T06:09:28.2047077Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-09-07T06:09:28.2047854Z OPT_OUT_LABEL = "no-runner-experiments" 2025-09-07T06:09:28.2048434Z  2025-09-07T06:09:28.2048906Z SETTING_EXPERIMENTS = "experiments" 2025-09-07T06:09:28.2049518Z  2025-09-07T06:09:28.2049983Z LF_FLEET_EXPERIMENT = "lf" 2025-09-07T06:09:28.2050512Z CANARY_FLEET_SUFFIX = ".c" 2025-09-07T06:09:28.2051158Z  2025-09-07T06:09:28.2051799Z  2025-09-07T06:09:28.2052262Z class Experiment(NamedTuple): 2025-09-07T06:09:28.2053036Z  rollout_perc: float = ( 2025-09-07T06:09:28.2053788Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-09-07T06:09:28.2054554Z  ) 2025-09-07T06:09:28.2055108Z  all_branches: bool = ( 2025-09-07T06:09:28.2055893Z  False # If True, the experiment is also enabled on the exception branches 2025-09-07T06:09:28.2056618Z  ) 2025-09-07T06:09:28.2057141Z  default: bool = ( 2025-09-07T06:09:28.2057857Z  True # If True, the experiment is enabled by default for all queries 2025-09-07T06:09:28.2058559Z  ) 2025-09-07T06:09:28.2059089Z  2025-09-07T06:09:28.2059523Z  # Add more fields as needed 2025-09-07T06:09:28.2060095Z  2025-09-07T06:09:28.2060520Z  2025-09-07T06:09:28.2060984Z class Settings(NamedTuple): 2025-09-07T06:09:28.2061654Z  """ 2025-09-07T06:09:28.2062312Z  Settings for the experiments that can be opted into. 2025-09-07T06:09:28.2062984Z  """ 2025-09-07T06:09:28.2063402Z  2025-09-07T06:09:28.2063944Z  experiments: dict[str, Experiment] = {} 2025-09-07T06:09:28.2064526Z  2025-09-07T06:09:28.2065127Z  2025-09-07T06:09:28.2065662Z class ColorFormatter(logging.Formatter): 2025-09-07T06:09:28.2066446Z  """Color codes the log messages based on the log level""" 2025-09-07T06:09:28.2067129Z  2025-09-07T06:09:28.2067568Z  COLORS = { 2025-09-07T06:09:28.2068125Z  "WARNING": "\033[33m", # Yellow 2025-09-07T06:09:28.2068775Z  "ERROR": "\033[31m", # Red 2025-09-07T06:09:28.2069491Z  "CRITICAL": "\033[31m", # Red 2025-09-07T06:09:28.2070105Z  "INFO": "\033[0m", # Reset 2025-09-07T06:09:28.2070677Z  "DEBUG": "\033[0m", # Reset 2025-09-07T06:09:28.2071506Z  } 2025-09-07T06:09:28.2072041Z  2025-09-07T06:09:28.2072608Z  def format(self, record: LogRecord) -> str: 2025-09-07T06:09:28.2073491Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-09-07T06:09:28.2074408Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-09-07T06:09:28.2075087Z  return super().format(record) 2025-09-07T06:09:28.2075688Z  2025-09-07T06:09:28.2076141Z  2025-09-07T06:09:28.2076585Z handler = logging.StreamHandler() 2025-09-07T06:09:28.2077510Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-09-07T06:09:28.2078285Z  2025-09-07T06:09:28.2078837Z log = logging.getLogger(os.path.basename(__file__)) 2025-09-07T06:09:28.2079563Z log.addHandler(handler) 2025-09-07T06:09:28.2080105Z log.setLevel(logging.INFO) 2025-09-07T06:09:28.2080688Z  2025-09-07T06:09:28.2081114Z  2025-09-07T06:09:28.2081807Z def set_github_output(key: str, value: str) -> None: 2025-09-07T06:09:28.2082446Z  """ 2025-09-07T06:09:28.2083163Z  Defines outputs of the github action that invokes this script 2025-09-07T06:09:28.2084076Z  """ 2025-09-07T06:09:28.2084561Z  if not GITHUB_OUTPUT: 2025-09-07T06:09:28.2086094Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-09-07T06:09:28.2156258Z  log.warning( 2025-09-07T06:09:28.2157154Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-09-07T06:09:28.2158058Z  ) 2025-09-07T06:09:28.2158524Z  print(f"::set-output name={key}::{value}") 2025-09-07T06:09:28.2159064Z  return 2025-09-07T06:09:28.2159464Z  2025-09-07T06:09:28.2159852Z  with open(GITHUB_OUTPUT, "a") as f: 2025-09-07T06:09:28.2160434Z  log.info(f"Setting output: {key}='{value}'") 2025-09-07T06:09:28.2161006Z  f.write(f"{key}={value}\n") 2025-09-07T06:09:28.2161628Z  2025-09-07T06:09:28.2161960Z  2025-09-07T06:09:28.2162464Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-09-07T06:09:28.2163121Z  return frozenset( 2025-09-07T06:09:28.2163754Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-09-07T06:09:28.2164408Z  ) 2025-09-07T06:09:28.2164763Z  2025-09-07T06:09:28.2165085Z  2025-09-07T06:09:28.2165440Z def parse_args() -> Any: 2025-09-07T06:09:28.2166038Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-09-07T06:09:28.2166899Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-09-07T06:09:28.2167644Z  parser.add_argument( 2025-09-07T06:09:28.2168119Z  "--github-issue-repo", 2025-09-07T06:09:28.2168603Z  type=str, 2025-09-07T06:09:28.2169042Z  required=False, 2025-09-07T06:09:28.2169699Z  default="pytorch/test-infra", 2025-09-07T06:09:28.2170269Z  help="GitHub repo to get the issue", 2025-09-07T06:09:28.2170783Z  ) 2025-09-07T06:09:28.2171151Z  parser.add_argument( 2025-09-07T06:09:28.2171845Z  "--github-repo", 2025-09-07T06:09:28.2172299Z  type=str, 2025-09-07T06:09:28.2172731Z  required=True, 2025-09-07T06:09:28.2173230Z  help="GitHub repo where CI is running", 2025-09-07T06:09:28.2173749Z  ) 2025-09-07T06:09:28.2174129Z  parser.add_argument( 2025-09-07T06:09:28.2174759Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-09-07T06:09:28.2175410Z  ) 2025-09-07T06:09:28.2175791Z  parser.add_argument( 2025-09-07T06:09:28.2176443Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-09-07T06:09:28.2177107Z  ) 2025-09-07T06:09:28.2177512Z  parser.add_argument( 2025-09-07T06:09:28.2178173Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-09-07T06:09:28.2178835Z  ) 2025-09-07T06:09:28.2179216Z  parser.add_argument( 2025-09-07T06:09:28.2179887Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-09-07T06:09:28.2180608Z  ) 2025-09-07T06:09:28.2180981Z  parser.add_argument( 2025-09-07T06:09:28.2181576Z  "--github-ref-type", 2025-09-07T06:09:28.2182046Z  type=str, 2025-09-07T06:09:28.2182471Z  required=True, 2025-09-07T06:09:28.2182988Z  help="Current GitHub ref type, branch or tag", 2025-09-07T06:09:28.2183524Z  ) 2025-09-07T06:09:28.2183895Z  parser.add_argument( 2025-09-07T06:09:28.2184525Z  "--eligible-experiments", 2025-09-07T06:09:28.2185060Z  type=_str_comma_separated_to_set, 2025-09-07T06:09:28.2185581Z  required=False, 2025-09-07T06:09:28.2186033Z  default="", 2025-09-07T06:09:28.2186893Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-09-07T06:09:28.2187787Z  ) 2025-09-07T06:09:28.2188160Z  parser.add_argument( 2025-09-07T06:09:28.2188639Z  "--opt-out-experiments", 2025-09-07T06:09:28.2189164Z  type=_str_comma_separated_to_set, 2025-09-07T06:09:28.2189681Z  required=False, 2025-09-07T06:09:28.2190123Z  default="", 2025-09-07T06:09:28.2190545Z  help=( 2025-09-07T06:09:28.2191226Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-09-07T06:09:28.2192639Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-09-07T06:09:28.2193449Z  ), 2025-09-07T06:09:28.2193819Z  ) 2025-09-07T06:09:28.2194198Z  parser.add_argument( 2025-09-07T06:09:28.2194658Z  "--pr-number", 2025-09-07T06:09:28.2195102Z  type=str, 2025-09-07T06:09:28.2195533Z  required=False, 2025-09-07T06:09:28.2195977Z  default="", 2025-09-07T06:09:28.2196489Z  help="the optional PR number where this is run", 2025-09-07T06:09:28.2197032Z  ) 2025-09-07T06:09:28.2197379Z  2025-09-07T06:09:28.2197747Z  return parser.parse_args() 2025-09-07T06:09:28.2198222Z  2025-09-07T06:09:28.2198558Z  2025-09-07T06:09:28.2199151Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-09-07T06:09:28.2200047Z  auth = Auth.Token(github_token) 2025-09-07T06:09:28.2200568Z  return Github(auth=auth) 2025-09-07T06:09:28.2201027Z  2025-09-07T06:09:28.2201942Z  2025-09-07T06:09:28.2202771Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-09-07T06:09:28.2203563Z  repo = gh.get_repo(repo) 2025-09-07T06:09:28.2204093Z  return repo.get_issue(number=issue_num) 2025-09-07T06:09:28.2204601Z  2025-09-07T06:09:28.2204935Z  2025-09-07T06:09:28.2205303Z def get_potential_pr_author( 2025-09-07T06:09:28.2205960Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-09-07T06:09:28.2206623Z ) -> str: 2025-09-07T06:09:28.2207163Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-09-07T06:09:28.2207954Z  # Fetch the actual username from the original PR. The PR number is 2025-09-07T06:09:28.2208717Z  # embedded in the tag name: ciflow// 2025-09-07T06:09:28.2209277Z  2025-09-07T06:09:28.2209662Z  gh = get_gh_client(github_token) 2025-09-07T06:09:28.2210148Z  2025-09-07T06:09:28.2210609Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-09-07T06:09:28.2211233Z  split_tag = ref_name.split("/") 2025-09-07T06:09:28.2212075Z  if ( 2025-09-07T06:09:28.2212482Z  len(split_tag) == 3 2025-09-07T06:09:28.2212986Z  and split_tag[0] == "ciflow" 2025-09-07T06:09:28.2213520Z  and split_tag[2].isnumeric() 2025-09-07T06:09:28.2214013Z  ): 2025-09-07T06:09:28.2214429Z  pr_number = split_tag[2] 2025-09-07T06:09:28.2214912Z  try: 2025-09-07T06:09:28.2215377Z  repository = gh.get_repo(repo) 2025-09-07T06:09:28.2216180Z  pull = repository.get_pull(number=int(pr_number)) 2025-09-07T06:09:28.2216783Z  except Exception as e: 2025-09-07T06:09:28.2217325Z  raise Exception( # noqa: TRY002 2025-09-07T06:09:28.2217998Z  f"issue with pull request {pr_number} from repo {repository}" 2025-09-07T06:09:28.2218655Z  ) from e 2025-09-07T06:09:28.2219222Z  return pull.user.login # type: ignore[no-any-return] 2025-09-07T06:09:28.2219930Z  # In all other cases, return the original input username 2025-09-07T06:09:28.2220521Z  return username 2025-09-07T06:09:28.2220936Z  2025-09-07T06:09:28.2221262Z  2025-09-07T06:09:28.2221920Z def is_exception_branch(branch: str) -> bool: 2025-09-07T06:09:28.2222462Z  """ 2025-09-07T06:09:28.2223129Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-09-07T06:09:28.2223894Z  """ 2025-09-07T06:09:28.2224454Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-09-07T06:09:28.2225097Z  2025-09-07T06:09:28.2225424Z  2025-09-07T06:09:28.2225796Z def load_yaml(yaml_text: str) -> Any: 2025-09-07T06:09:28.2226293Z  try: 2025-09-07T06:09:28.2226707Z  data = yaml.safe_load(yaml_text) 2025-09-07T06:09:28.2227225Z  return data 2025-09-07T06:09:28.2227670Z  except yaml.YAMLError: 2025-09-07T06:09:28.2228189Z  log.exception("Error loading YAML") 2025-09-07T06:09:28.2228710Z  raise 2025-09-07T06:09:28.2229125Z  2025-09-07T06:09:28.2229459Z  2025-09-07T06:09:28.2230062Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-09-07T06:09:28.2230789Z  """ 2025-09-07T06:09:28.2232012Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-09-07T06:09:28.2232774Z  2025-09-07T06:09:28.2233304Z  If the issue body contains "---" then the text above that is the settings 2025-09-07T06:09:28.2234053Z  and the text below is the list of opted in users. 2025-09-07T06:09:28.2234598Z  2025-09-07T06:09:28.2235149Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-09-07T06:09:28.2235843Z  """ 2025-09-07T06:09:28.2236302Z  rollout_state_parts = rollout_state.split("---") 2025-09-07T06:09:28.2236906Z  if len(rollout_state_parts) >= 2: 2025-09-07T06:09:28.2237523Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-09-07T06:09:28.2238097Z  else: 2025-09-07T06:09:28.2238490Z  return "", rollout_state 2025-09-07T06:09:28.2238952Z  2025-09-07T06:09:28.2239280Z  2025-09-07T06:09:28.2239668Z class UserOptins(dict[str, list[str]]): 2025-09-07T06:09:28.2240180Z  """ 2025-09-07T06:09:28.2240705Z  Dictionary of users with a list of features they have opted into 2025-09-07T06:09:28.2241446Z  """ 2025-09-07T06:09:28.2241798Z  2025-09-07T06:09:28.2242114Z  2025-09-07T06:09:28.2242631Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-09-07T06:09:28.2243271Z  """ 2025-09-07T06:09:28.2243984Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-09-07T06:09:28.2244788Z  2025-09-07T06:09:28.2245568Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-09-07T06:09:28.2246533Z  - Example line: "@User1,lf,split_build" 2025-09-07T06:09:28.2247347Z  - A "#" prefix indicates the user is opted out of all experiments 2025-09-07T06:09:28.2247954Z  2025-09-07T06:09:28.2248277Z  2025-09-07T06:09:28.2248591Z  """ 2025-09-07T06:09:28.2248963Z  optins = UserOptins() 2025-09-07T06:09:28.2249469Z  for user in user_optin_text.split("\n"): 2025-09-07T06:09:28.2250019Z  user = user.strip("\r\n\t -") 2025-09-07T06:09:28.2250565Z  if not user or not user.startswith("@"): 2025-09-07T06:09:28.2251110Z  # Not a valid user. Skip 2025-09-07T06:09:28.2251815Z  continue 2025-09-07T06:09:28.2252217Z  2025-09-07T06:09:28.2252549Z  if user: 2025-09-07T06:09:28.2253014Z  usr_name = user.split(",")[0].strip("@") 2025-09-07T06:09:28.2253701Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-09-07T06:09:28.2254318Z  2025-09-07T06:09:28.2254661Z  return optins 2025-09-07T06:09:28.2255065Z  2025-09-07T06:09:28.2255390Z  2025-09-07T06:09:28.2255881Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-09-07T06:09:28.2256473Z  """ 2025-09-07T06:09:28.2256883Z  Check if the experiment name is valid. 2025-09-07T06:09:28.2257397Z  A valid name: 2025-09-07T06:09:28.2258061Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-09-07T06:09:28.2258975Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-09-07T06:09:28.2259661Z  - Cannot contain spaces 2025-09-07T06:09:28.2260119Z  """ 2025-09-07T06:09:28.2260469Z  2025-09-07T06:09:28.2260908Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-09-07T06:09:28.2261861Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-09-07T06:09:28.2262580Z  2025-09-07T06:09:28.2262915Z  if valid: 2025-09-07T06:09:28.2263327Z  return True 2025-09-07T06:09:28.2263732Z  2025-09-07T06:09:28.2264230Z  log.error( 2025-09-07T06:09:28.2265747Z  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-09-07T06:09:28.2267193Z  ) 2025-09-07T06:09:28.2267557Z  return False 2025-09-07T06:09:28.2267946Z  2025-09-07T06:09:28.2268272Z  2025-09-07T06:09:28.2268772Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-09-07T06:09:28.2269391Z  """ 2025-09-07T06:09:28.2269977Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-09-07T06:09:28.2270673Z  """ 2025-09-07T06:09:28.2271026Z  try: 2025-09-07T06:09:28.2271563Z  if settings_text: 2025-09-07T06:09:28.2272439Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-09-07T06:09:28.2273205Z  # for easy reading 2025-09-07T06:09:28.2274002Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-09-07T06:09:28.2274868Z  # the backtick character in shell commands. 2025-09-07T06:09:28.2275460Z  backtick = chr(96) # backtick character 2025-09-07T06:09:28.2276129Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-09-07T06:09:28.2276785Z  settings = load_yaml(settings_text) 2025-09-07T06:09:28.2277288Z  2025-09-07T06:09:28.2278012Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-09-07T06:09:28.2278730Z  experiments = {} 2025-09-07T06:09:28.2279184Z  2025-09-07T06:09:28.2279727Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-09-07T06:09:28.2280473Z  if not is_valid_experiment_name(exp_name): 2025-09-07T06:09:28.2281653Z  # 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-09-07T06:09:28.2282652Z  continue 2025-09-07T06:09:28.2283096Z  2025-09-07T06:09:28.2283454Z  valid_settings = {} 2025-09-07T06:09:28.2283985Z  for setting in exp_settings: 2025-09-07T06:09:28.2284547Z  if setting not in Experiment._fields: 2025-09-07T06:09:28.2285113Z  log.warning( 2025-09-07T06:09:28.2285816Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-09-07T06:09:28.2286500Z  ) 2025-09-07T06:09:28.2286943Z  else: 2025-09-07T06:09:28.2287474Z  valid_settings[setting] = exp_settings[setting] 2025-09-07T06:09:28.2288022Z  2025-09-07T06:09:28.2288473Z  experiments[exp_name] = Experiment(**valid_settings) 2025-09-07T06:09:28.2289095Z  return Settings(experiments) 2025-09-07T06:09:28.2289574Z  2025-09-07T06:09:28.2289933Z  except Exception: 2025-09-07T06:09:28.2290440Z  log.exception("Failed to parse settings") 2025-09-07T06:09:28.2290954Z  2025-09-07T06:09:28.2291449Z  return Settings() 2025-09-07T06:09:28.2291921Z  2025-09-07T06:09:28.2292247Z  2025-09-07T06:09:28.2292809Z def parse_settings(rollout_state: str) -> Settings: 2025-09-07T06:09:28.2293368Z  """ 2025-09-07T06:09:28.2293808Z  Parse settings, if any, from the rollout state. 2025-09-07T06:09:28.2294350Z  2025-09-07T06:09:28.2294876Z  If the issue body contains "---" then the text above that is the settings 2025-09-07T06:09:28.2295619Z  and the text below is the list of opted in users. 2025-09-07T06:09:28.2296162Z  2025-09-07T06:09:28.2296740Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-09-07T06:09:28.2297448Z  """ 2025-09-07T06:09:28.2298007Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:09:28.2298755Z  return parse_settings_from_text(settings_text) 2025-09-07T06:09:28.2299288Z  2025-09-07T06:09:28.2299617Z  2025-09-07T06:09:28.2300051Z def parse_users(rollout_state: str) -> UserOptins: 2025-09-07T06:09:28.2300593Z  """ 2025-09-07T06:09:28.2300995Z  Parse users from the rollout state. 2025-09-07T06:09:28.2301598Z  2025-09-07T06:09:28.2301925Z  """ 2025-09-07T06:09:28.2302464Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:09:28.2303194Z  return parse_user_opt_in_from_text(users_text) 2025-09-07T06:09:28.2303722Z  2025-09-07T06:09:28.2304042Z  2025-09-07T06:09:28.2304637Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:09:28.2305356Z  """ 2025-09-07T06:09:28.2305784Z  Check if a user is opted into an experiment 2025-09-07T06:09:28.2306293Z  """ 2025-09-07T06:09:28.2306758Z  return experiment_name in user_optins.get(user, []) 2025-09-07T06:09:28.2307441Z  2025-09-07T06:09:28.2307760Z  2025-09-07T06:09:28.2308366Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:09:28.2309088Z  """ 2025-09-07T06:09:28.2309562Z  Check if a user explicitly opted out of an experiment 2025-09-07T06:09:28.2310117Z  """ 2025-09-07T06:09:28.2310640Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-09-07T06:09:28.2311535Z  experiment_optout = "-" + experiment_name 2025-09-07T06:09:28.2312237Z  if experiment_optout not in user_optins.get(user, []): 2025-09-07T06:09:28.2312823Z  return False 2025-09-07T06:09:28.2313232Z  2025-09-07T06:09:28.2313689Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-09-07T06:09:28.2314266Z  log.warning( 2025-09-07T06:09:28.2315086Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-09-07T06:09:28.2315926Z  ) 2025-09-07T06:09:28.2316283Z  2025-09-07T06:09:28.2316624Z  return True 2025-09-07T06:09:28.2317015Z  2025-09-07T06:09:28.2317346Z  2025-09-07T06:09:28.2317687Z def get_runner_prefix( 2025-09-07T06:09:28.2318146Z  rollout_state: str, 2025-09-07T06:09:28.2318630Z  workflow_requestors: Iterable[str], 2025-09-07T06:09:28.2319137Z  branch: str, 2025-09-07T06:09:28.2319677Z  eligible_experiments: frozenset[str] = frozenset(), 2025-09-07T06:09:28.2320341Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-09-07T06:09:28.2320912Z  is_canary: bool = False, 2025-09-07T06:09:28.2321464Z ) -> str: 2025-09-07T06:09:28.2321906Z  settings = parse_settings(rollout_state) 2025-09-07T06:09:28.2322485Z  user_optins = parse_users(rollout_state) 2025-09-07T06:09:28.2322999Z  2025-09-07T06:09:28.2323476Z  fleet_prefix = "" 2025-09-07T06:09:28.2323934Z  prefixes = [] 2025-09-07T06:09:28.2324609Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-09-07T06:09:28.2325523Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-09-07T06:09:28.2326213Z  log.info( 2025-09-07T06:09:28.2326894Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-09-07T06:09:28.2327612Z  ) 2025-09-07T06:09:28.2328003Z  continue 2025-09-07T06:09:28.2328412Z  2025-09-07T06:09:28.2328769Z  if opt_out_experiments: 2025-09-07T06:09:28.2329344Z  if experiment_name in opt_out_experiments: 2025-09-07T06:09:28.2329975Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-09-07T06:09:28.2330545Z  log.info( 2025-09-07T06:09:28.2331655Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-09-07T06:09:28.2332590Z  ) 2025-09-07T06:09:28.2333004Z  continue 2025-09-07T06:09:28.2333433Z  2025-09-07T06:09:28.2333786Z  if eligible_experiments: 2025-09-07T06:09:28.2334359Z  if experiment_name not in eligible_experiments: 2025-09-07T06:09:28.2334970Z  exp_list = ", ".join(eligible_experiments) 2025-09-07T06:09:28.2335506Z  log.info( 2025-09-07T06:09:28.2336274Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-09-07T06:09:28.2337059Z  ) 2025-09-07T06:09:28.2337608Z  continue 2025-09-07T06:09:28.2338103Z  elif not experiment_settings.default: 2025-09-07T06:09:28.2338623Z  log.info( 2025-09-07T06:09:28.2339297Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-09-07T06:09:28.2339985Z  ) 2025-09-07T06:09:28.2340378Z  continue 2025-09-07T06:09:28.2340781Z  2025-09-07T06:09:28.2341234Z  # Is any workflow_requestor opted out to this experiment? 2025-09-07T06:09:28.2341937Z  opted_out_users = [ 2025-09-07T06:09:28.2342403Z  requestor 2025-09-07T06:09:28.2342881Z  for requestor in workflow_requestors 2025-09-07T06:09:28.2343549Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-09-07T06:09:28.2344160Z  ] 2025-09-07T06:09:28.2344526Z  2025-09-07T06:09:28.2344882Z  if opted_out_users: 2025-09-07T06:09:28.2345345Z  log.info( 2025-09-07T06:09:28.2345974Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-09-07T06:09:28.2346638Z  ) 2025-09-07T06:09:28.2347038Z  continue 2025-09-07T06:09:28.2347451Z  2025-09-07T06:09:28.2347894Z  # Is any workflow_requestor opted in to this experiment? 2025-09-07T06:09:28.2348490Z  opted_in_users = [ 2025-09-07T06:09:28.2348947Z  requestor 2025-09-07T06:09:28.2349429Z  for requestor in workflow_requestors 2025-09-07T06:09:28.2350082Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-09-07T06:09:28.2350694Z  ] 2025-09-07T06:09:28.2351054Z  2025-09-07T06:09:28.2351636Z  enabled = False 2025-09-07T06:09:28.2352131Z  if opted_in_users: 2025-09-07T06:09:28.2352717Z  log.info( 2025-09-07T06:09:28.2353349Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-09-07T06:09:28.2353997Z  ) 2025-09-07T06:09:28.2354390Z  enabled = True 2025-09-07T06:09:28.2354815Z  2025-09-07T06:09:28.2355206Z  elif experiment_settings.rollout_perc: 2025-09-07T06:09:28.2356007Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-09-07T06:09:28.2356903Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-09-07T06:09:28.2357525Z  log.info( 2025-09-07T06:09:28.2358374Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-09-07T06:09:28.2359252Z  ) 2025-09-07T06:09:28.2359678Z  enabled = True 2025-09-07T06:09:28.2360128Z  2025-09-07T06:09:28.2360465Z  if enabled: 2025-09-07T06:09:28.2360913Z  label = experiment_name 2025-09-07T06:09:28.2361667Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-09-07T06:09:28.2362508Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-09-07T06:09:28.2363343Z  # - If it's enabled, then we always list it's prefix first 2025-09-07T06:09:28.2364084Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-09-07T06:09:28.2364712Z  if is_canary: 2025-09-07T06:09:28.2365218Z  label += CANARY_FLEET_SUFFIX 2025-09-07T06:09:28.2365751Z  fleet_prefix = label 2025-09-07T06:09:28.2366407Z  else: 2025-09-07T06:09:28.2366864Z  prefixes.append(label) 2025-09-07T06:09:28.2367352Z  2025-09-07T06:09:28.2367701Z  if len(prefixes) > 1: 2025-09-07T06:09:28.2368152Z  log.error( 2025-09-07T06:09:28.2369165Z  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-09-07T06:09:28.2370206Z  ) 2025-09-07T06:09:28.2370604Z  prefixes = prefixes[:1] 2025-09-07T06:09:28.2371086Z  2025-09-07T06:09:28.2371653Z  # Fleet always comes first 2025-09-07T06:09:28.2372157Z  if fleet_prefix: 2025-09-07T06:09:28.2372625Z  prefixes.insert(0, fleet_prefix) 2025-09-07T06:09:28.2373120Z  2025-09-07T06:09:28.2373558Z  return ".".join(prefixes) + "." if prefixes else "" 2025-09-07T06:09:28.2374115Z  2025-09-07T06:09:28.2374437Z  2025-09-07T06:09:28.2375058Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-09-07T06:09:28.2375799Z  """ 2025-09-07T06:09:28.2376382Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-09-07T06:09:28.2377141Z  2025-09-07T06:09:28.2377817Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-09-07T06:09:28.2378489Z  """ 2025-09-07T06:09:28.2378878Z  gh = get_gh_client(github_token) 2025-09-07T06:09:28.2379418Z  issue = get_issue(gh, repo, issue_num) 2025-09-07T06:09:28.2380044Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-09-07T06:09:28.2380608Z  2025-09-07T06:09:28.2380922Z  2025-09-07T06:09:28.2381599Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-09-07T06:09:28.2382467Z  for _ in range(num_retries): 2025-09-07T06:09:28.2382944Z  try: 2025-09-07T06:09:28.2383380Z  req = Request(url=url, headers=headers) 2025-09-07T06:09:28.2384025Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-09-07T06:09:28.2384645Z  return json.loads(content) 2025-09-07T06:09:28.2385162Z  except Exception as e: 2025-09-07T06:09:28.2385706Z  log.warning(f"Could not download {url}: {e}") 2025-09-07T06:09:28.2386276Z  2025-09-07T06:09:28.2386830Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-09-07T06:09:28.2387520Z  return {} 2025-09-07T06:09:28.2388005Z  2025-09-07T06:09:28.2388524Z  2025-09-07T06:09:28.2388866Z @cache 2025-09-07T06:09:28.2389478Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-09-07T06:09:28.2390218Z  """ 2025-09-07T06:09:28.2390605Z  Dynamically get PR information 2025-09-07T06:09:28.2391099Z  """ 2025-09-07T06:09:28.2391715Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-09-07T06:09:28.2392325Z  headers = { 2025-09-07T06:09:28.2392804Z  "Accept": "application/vnd.github.v3+json", 2025-09-07T06:09:28.2393393Z  "Authorization": f"token {github_token}", 2025-09-07T06:09:28.2393902Z  } 2025-09-07T06:09:28.2394333Z  json_response: dict[str, Any] = download_json( 2025-09-07T06:09:28.2394924Z  url=f"{github_api}/issues/{pr_number}", 2025-09-07T06:09:28.2395443Z  headers=headers, 2025-09-07T06:09:28.2395881Z  ) 2025-09-07T06:09:28.2396221Z  2025-09-07T06:09:28.2396560Z  if not json_response: 2025-09-07T06:09:28.2397298Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-09-07T06:09:28.2397909Z  return {} 2025-09-07T06:09:28.2398309Z  2025-09-07T06:09:28.2398646Z  return json_response 2025-09-07T06:09:28.2399075Z  2025-09-07T06:09:28.2399394Z  2025-09-07T06:09:28.2399954Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-09-07T06:09:28.2400641Z  """ 2025-09-07T06:09:28.2401166Z  Dynamically get the latest list of labels from the pull request 2025-09-07T06:09:28.2402077Z  """ 2025-09-07T06:09:28.2402571Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-09-07T06:09:28.2403161Z  return { 2025-09-07T06:09:28.2403740Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-09-07T06:09:28.2404404Z  } 2025-09-07T06:09:28.2404747Z  2025-09-07T06:09:28.2405070Z  2025-09-07T06:09:28.2405410Z def main() -> None: 2025-09-07T06:09:28.2405834Z  args = parse_args() 2025-09-07T06:09:28.2406256Z  2025-09-07T06:09:28.2406652Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-09-07T06:09:28.2407165Z  2025-09-07T06:09:28.2407526Z  # Check if the PR is opt-out 2025-09-07T06:09:28.2408017Z  if args.pr_number: 2025-09-07T06:09:28.2408679Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-09-07T06:09:28.2409405Z  if OPT_OUT_LABEL in labels: 2025-09-07T06:09:28.2409894Z  log.info( 2025-09-07T06:09:28.2410587Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-09-07T06:09:28.2411475Z  ) 2025-09-07T06:09:28.2412073Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:09:28.2412734Z  sys.exit() 2025-09-07T06:09:28.2413284Z  2025-09-07T06:09:28.2413610Z  try: 2025-09-07T06:09:28.2414056Z  rollout_state = get_rollout_state_from_issue( 2025-09-07T06:09:28.2414745Z  args.github_token, args.github_issue_repo, args.github_issue 2025-09-07T06:09:28.2415361Z  ) 2025-09-07T06:09:28.2415712Z  2025-09-07T06:09:28.2416096Z  username = get_potential_pr_author( 2025-09-07T06:09:28.2416616Z  args.github_token, 2025-09-07T06:09:28.2417103Z  args.github_repo, 2025-09-07T06:09:28.2417585Z  args.github_actor, 2025-09-07T06:09:28.2418075Z  args.github_ref_type, 2025-09-07T06:09:28.2418574Z  args.github_branch, 2025-09-07T06:09:28.2419034Z  ) 2025-09-07T06:09:28.2419395Z  2025-09-07T06:09:28.2419864Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-09-07T06:09:28.2420440Z  2025-09-07T06:09:28.2420835Z  runner_label_prefix = get_runner_prefix( 2025-09-07T06:09:28.2421496Z  rollout_state, 2025-09-07T06:09:28.2422003Z  (args.github_issue_owner, username), 2025-09-07T06:09:28.2422524Z  args.github_branch, 2025-09-07T06:09:28.2423035Z  args.eligible_experiments, 2025-09-07T06:09:28.2423561Z  args.opt_out_experiments, 2025-09-07T06:09:28.2424057Z  is_canary, 2025-09-07T06:09:28.2424481Z  ) 2025-09-07T06:09:28.2424849Z  2025-09-07T06:09:28.2425203Z  except Exception as e: 2025-09-07T06:09:28.2425665Z  log.error( 2025-09-07T06:09:28.2426345Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-09-07T06:09:28.2427187Z  ) 2025-09-07T06:09:28.2427556Z  2025-09-07T06:09:28.2428050Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:09:28.2428677Z  2025-09-07T06:09:28.2429023Z  2025-09-07T06:09:28.2429468Z if __name__ == "__main__": 2025-09-07T06:09:28.2429921Z  main() 2025-09-07T06:09:28.2430282Z  2025-09-07T06:09:28.2430606Z EOF 2025-09-07T06:09:28.2430935Z  2025-09-07T06:09:28.2431386Z cat runner_determinator.py 2025-09-07T06:09:28.3951832Z shell: /usr/bin/bash -e {0} 2025-09-07T06:09:28.3953057Z env: 2025-09-07T06:09:28.3954005Z GITHUB_TOKEN: *** 2025-09-07T06:09:28.3954742Z ISSUE_NUMBER: 5132 2025-09-07T06:09:28.3955470Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T06:09:28.3956316Z ISSUE_OWNER: 2025-09-07T06:09:28.3956997Z CHECK_EXPERIMENTS: 2025-09-07T06:09:28.3957747Z OPT_OUT_EXPERIMENTS: 2025-09-07T06:09:28.3958490Z PR_NUMBER: 2025-09-07T06:09:28.3959107Z ##[endgroup] 2025-09-07T06:09:28.4195406Z # flake8: noqa: G004 2025-09-07T06:09:28.4195724Z 2025-09-07T06:09:28.4196134Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-09-07T06:09:28.4197024Z # must be kept in sync. You can do it easily by running the following command: 2025-09-07T06:09:28.4197784Z # python .github/scripts/update_runner_determinator.py 2025-09-07T06:09:28.4198195Z 2025-09-07T06:09:28.4198347Z """ 2025-09-07T06:09:28.4198877Z This runner determinator is used to determine which set of runners to run a 2025-09-07T06:09:28.4199684Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-09-07T06:09:28.4200518Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-09-07T06:09:28.4201271Z of which runners should be used to run which job. 2025-09-07T06:09:28.4201966Z 2025-09-07T06:09:28.4202339Z The configuration has two parts, the settings and a list of opted-in users, 2025-09-07T06:09:28.4203359Z separated by a line containing "---". If the line is not present, the 2025-09-07T06:09:28.4204179Z settings are considered to be empty with only the second part, the user 2025-09-07T06:09:28.4204809Z list, defined. 2025-09-07T06:09:28.4205021Z 2025-09-07T06:09:28.4205360Z The first part is a YAML block that defines the rollout settings. This can be 2025-09-07T06:09:28.4206183Z used to define any settings that are needed to determine which runners to use. 2025-09-07T06:09:28.4206950Z It's fields are defined by the RolloutSettings class below. 2025-09-07T06:09:28.4207358Z 2025-09-07T06:09:28.4207708Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-09-07T06:09:28.4208512Z The user list is also a comma separated list of additional features or 2025-09-07T06:09:28.4209188Z experiments which the user could be opted in to. 2025-09-07T06:09:28.4209566Z 2025-09-07T06:09:28.4209751Z The user list has the following rules: 2025-09-07T06:09:28.4210079Z 2025-09-07T06:09:28.4210375Z - Users are GitHub usernames, which must start with the @ prefix 2025-09-07T06:09:28.4211159Z - Each user is also a comma-separated list of features/experiments to enable 2025-09-07T06:09:28.4212145Z - A "#" prefix opts the user out of all experiments 2025-09-07T06:09:28.4212512Z 2025-09-07T06:09:28.4212674Z Example config: 2025-09-07T06:09:28.4213084Z # A list of experiments that can be opted into. 2025-09-07T06:09:28.4213710Z # This defines the behavior they'll induce when opted into. 2025-09-07T06:09:28.4214279Z # Expected syntax is: 2025-09-07T06:09:28.4214874Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-09-07T06:09:28.4215771Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-09-07T06:09:28.4216332Z 2025-09-07T06:09:28.4216493Z experiments: 2025-09-07T06:09:28.4216855Z lf: 2025-09-07T06:09:28.4217191Z rollout_percent: 25 2025-09-07T06:09:28.4217771Z all_branches: false 2025-09-07T06:09:28.4218184Z default: true 2025-09-07T06:09:28.4218563Z --- 2025-09-07T06:09:28.4218750Z 2025-09-07T06:09:28.4218901Z # Opt-ins: 2025-09-07T06:09:28.4219455Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-09-07T06:09:28.4220262Z # and specifying experiments to enable in a comma-separated list. 2025-09-07T06:09:28.4220974Z # To always opt out of an experiment, prefix it with a "-". 2025-09-07T06:09:28.4221785Z # Experiments should be from the above list. 2025-09-07T06:09:28.4222134Z 2025-09-07T06:09:28.4222297Z @User1,-lf,split_build 2025-09-07T06:09:28.4222701Z @User2,lf 2025-09-07T06:09:28.4223051Z @User3,split_build 2025-09-07T06:09:28.4223426Z """ 2025-09-07T06:09:28.4223606Z 2025-09-07T06:09:28.4223756Z import json 2025-09-07T06:09:28.4224092Z import logging 2025-09-07T06:09:28.4224441Z import os 2025-09-07T06:09:28.4224776Z import random 2025-09-07T06:09:28.4225132Z import re 2025-09-07T06:09:28.4225461Z import sys 2025-09-07T06:09:28.4225821Z from argparse import ArgumentParser 2025-09-07T06:09:28.4226301Z from collections.abc import Iterable 2025-09-07T06:09:28.4226780Z from functools import cache 2025-09-07T06:09:28.4227209Z from logging import LogRecord 2025-09-07T06:09:28.4227651Z from typing import Any, NamedTuple 2025-09-07T06:09:28.4228143Z from urllib.request import Request, urlopen 2025-09-07T06:09:28.4228487Z 2025-09-07T06:09:28.4228638Z import yaml 2025-09-07T06:09:28.4228989Z from github import Auth, Github 2025-09-07T06:09:28.4229448Z from github.Issue import Issue 2025-09-07T06:09:28.4229725Z 2025-09-07T06:09:28.4229731Z 2025-09-07T06:09:28.4229939Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-09-07T06:09:28.4230562Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-09-07T06:09:28.4231563Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-09-07T06:09:28.4232092Z 2025-09-07T06:09:28.4232313Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-09-07T06:09:28.4232972Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-09-07T06:09:28.4233447Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-09-07T06:09:28.4233956Z OPT_OUT_LABEL = "no-runner-experiments" 2025-09-07T06:09:28.4234280Z 2025-09-07T06:09:28.4234469Z SETTING_EXPERIMENTS = "experiments" 2025-09-07T06:09:28.4234773Z 2025-09-07T06:09:28.4234950Z LF_FLEET_EXPERIMENT = "lf" 2025-09-07T06:09:28.4235376Z CANARY_FLEET_SUFFIX = ".c" 2025-09-07T06:09:28.4235632Z 2025-09-07T06:09:28.4235638Z 2025-09-07T06:09:28.4235811Z class Experiment(NamedTuple): 2025-09-07T06:09:28.4236261Z rollout_perc: float = ( 2025-09-07T06:09:28.4236837Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-09-07T06:09:28.4237456Z ) 2025-09-07T06:09:28.4237833Z all_branches: bool = ( 2025-09-07T06:09:28.4238411Z False # If True, the experiment is also enabled on the exception branches 2025-09-07T06:09:28.4239040Z ) 2025-09-07T06:09:28.4239376Z default: bool = ( 2025-09-07T06:09:28.4239903Z True # If True, the experiment is enabled by default for all queries 2025-09-07T06:09:28.4240498Z ) 2025-09-07T06:09:28.4240677Z 2025-09-07T06:09:28.4240845Z # Add more fields as needed 2025-09-07T06:09:28.4241117Z 2025-09-07T06:09:28.4241124Z 2025-09-07T06:09:28.4241468Z class Settings(NamedTuple): 2025-09-07T06:09:28.4241942Z """ 2025-09-07T06:09:28.4242366Z Settings for the experiments that can be opted into. 2025-09-07T06:09:28.4242892Z """ 2025-09-07T06:09:28.4243075Z 2025-09-07T06:09:28.4243277Z experiments: dict[str, Experiment] = {} 2025-09-07T06:09:28.4243607Z 2025-09-07T06:09:28.4243615Z 2025-09-07T06:09:28.4243808Z class ColorFormatter(logging.Formatter): 2025-09-07T06:09:28.4244386Z """Color codes the log messages based on the log level""" 2025-09-07T06:09:28.4244784Z 2025-09-07T06:09:28.4244938Z COLORS = { 2025-09-07T06:09:28.4245304Z "WARNING": "\033[33m", # Yellow 2025-09-07T06:09:28.4245920Z "ERROR": "\033[31m", # Red 2025-09-07T06:09:28.4246381Z "CRITICAL": "\033[31m", # Red 2025-09-07T06:09:28.4246840Z "INFO": "\033[0m", # Reset 2025-09-07T06:09:28.4247282Z "DEBUG": "\033[0m", # Reset 2025-09-07T06:09:28.4247706Z } 2025-09-07T06:09:28.4247882Z 2025-09-07T06:09:28.4248081Z def format(self, record: LogRecord) -> str: 2025-09-07T06:09:28.4248782Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-09-07T06:09:28.4249502Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-09-07T06:09:28.4250033Z return super().format(record) 2025-09-07T06:09:28.4250338Z 2025-09-07T06:09:28.4250345Z 2025-09-07T06:09:28.4250529Z handler = logging.StreamHandler() 2025-09-07T06:09:28.4251175Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-09-07T06:09:28.4251979Z 2025-09-07T06:09:28.4252210Z log = logging.getLogger(os.path.basename(__file__)) 2025-09-07T06:09:28.4252753Z log.addHandler(handler) 2025-09-07T06:09:28.4253171Z log.setLevel(logging.INFO) 2025-09-07T06:09:28.4253432Z 2025-09-07T06:09:28.4253438Z 2025-09-07T06:09:28.4253670Z def set_github_output(key: str, value: str) -> None: 2025-09-07T06:09:28.4254184Z """ 2025-09-07T06:09:28.4254651Z Defines outputs of the github action that invokes this script 2025-09-07T06:09:28.4255224Z """ 2025-09-07T06:09:28.4255556Z if not GITHUB_OUTPUT: 2025-09-07T06:09:28.4256534Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-09-07T06:09:28.4257555Z log.warning( 2025-09-07T06:09:28.4258331Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-09-07T06:09:28.4259176Z ) 2025-09-07T06:09:28.4268931Z print(f"::set-output name={key}::{value}") 2025-09-07T06:09:28.4269498Z return 2025-09-07T06:09:28.4269727Z 2025-09-07T06:09:28.4270088Z with open(GITHUB_OUTPUT, "a") as f: 2025-09-07T06:09:28.4270692Z log.info(f"Setting output: {key}='{value}'") 2025-09-07T06:09:28.4271222Z f.write(f"{key}={value}\n") 2025-09-07T06:09:28.4271767Z 2025-09-07T06:09:28.4271774Z 2025-09-07T06:09:28.4272067Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-09-07T06:09:28.4272653Z return frozenset( 2025-09-07T06:09:28.4273221Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-09-07T06:09:28.4273842Z ) 2025-09-07T06:09:28.4274024Z 2025-09-07T06:09:28.4274030Z 2025-09-07T06:09:28.4274198Z def parse_args() -> Any: 2025-09-07T06:09:28.4274698Z parser = ArgumentParser("Get dynamic rollout settings") 2025-09-07T06:09:28.4275490Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-09-07T06:09:28.4276195Z parser.add_argument( 2025-09-07T06:09:28.4276604Z "--github-issue-repo", 2025-09-07T06:09:28.4277036Z type=str, 2025-09-07T06:09:28.4277397Z required=False, 2025-09-07T06:09:28.4277804Z default="pytorch/test-infra", 2025-09-07T06:09:28.4278297Z help="GitHub repo to get the issue", 2025-09-07T06:09:28.4278760Z ) 2025-09-07T06:09:28.4279095Z parser.add_argument( 2025-09-07T06:09:28.4279507Z "--github-repo", 2025-09-07T06:09:28.4279890Z type=str, 2025-09-07T06:09:28.4280249Z required=True, 2025-09-07T06:09:28.4280660Z help="GitHub repo where CI is running", 2025-09-07T06:09:28.4281139Z ) 2025-09-07T06:09:28.4281752Z parser.add_argument( 2025-09-07T06:09:28.4282500Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-09-07T06:09:28.4283112Z ) 2025-09-07T06:09:28.4283441Z parser.add_argument( 2025-09-07T06:09:28.4284013Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-09-07T06:09:28.4284628Z ) 2025-09-07T06:09:28.4285129Z parser.add_argument( 2025-09-07T06:09:28.4285720Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-09-07T06:09:28.4286358Z ) 2025-09-07T06:09:28.4286702Z parser.add_argument( 2025-09-07T06:09:28.4287288Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-09-07T06:09:28.4287942Z ) 2025-09-07T06:09:28.4288264Z parser.add_argument( 2025-09-07T06:09:28.4288669Z "--github-ref-type", 2025-09-07T06:09:28.4289072Z type=str, 2025-09-07T06:09:28.4289430Z required=True, 2025-09-07T06:09:28.4289856Z help="Current GitHub ref type, branch or tag", 2025-09-07T06:09:28.4290350Z ) 2025-09-07T06:09:28.4290674Z parser.add_argument( 2025-09-07T06:09:28.4291083Z "--eligible-experiments", 2025-09-07T06:09:28.4291796Z type=_str_comma_separated_to_set, 2025-09-07T06:09:28.4292276Z required=False, 2025-09-07T06:09:28.4292654Z default="", 2025-09-07T06:09:28.4293432Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-09-07T06:09:28.4294282Z ) 2025-09-07T06:09:28.4294610Z parser.add_argument( 2025-09-07T06:09:28.4295019Z "--opt-out-experiments", 2025-09-07T06:09:28.4295471Z type=_str_comma_separated_to_set, 2025-09-07T06:09:28.4295946Z required=False, 2025-09-07T06:09:28.4296318Z default="", 2025-09-07T06:09:28.4296669Z help=( 2025-09-07T06:09:28.4297287Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-09-07T06:09:28.4298334Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-09-07T06:09:28.4299092Z ), 2025-09-07T06:09:28.4299413Z ) 2025-09-07T06:09:28.4299744Z parser.add_argument( 2025-09-07T06:09:28.4300129Z "--pr-number", 2025-09-07T06:09:28.4300506Z type=str, 2025-09-07T06:09:28.4300867Z required=False, 2025-09-07T06:09:28.4301240Z default="", 2025-09-07T06:09:28.4301968Z help="the optional PR number where this is run", 2025-09-07T06:09:28.4302492Z ) 2025-09-07T06:09:28.4302669Z 2025-09-07T06:09:28.4302847Z return parser.parse_args() 2025-09-07T06:09:28.4303128Z 2025-09-07T06:09:28.4303135Z 2025-09-07T06:09:28.4303517Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-09-07T06:09:28.4304213Z auth = Auth.Token(github_token) 2025-09-07T06:09:28.4304669Z return Github(auth=auth) 2025-09-07T06:09:28.4304944Z 2025-09-07T06:09:28.4304952Z 2025-09-07T06:09:28.4305366Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-09-07T06:09:28.4353916Z repo = gh.get_repo(repo) 2025-09-07T06:09:28.4354483Z return repo.get_issue(number=issue_num) 2025-09-07T06:09:28.4354869Z 2025-09-07T06:09:28.4354876Z 2025-09-07T06:09:28.4355063Z def get_potential_pr_author( 2025-09-07T06:09:28.4355724Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-09-07T06:09:28.4356371Z ) -> str: 2025-09-07T06:09:28.4356850Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-09-07T06:09:28.4357589Z # Fetch the actual username from the original PR. The PR number is 2025-09-07T06:09:28.4358269Z # embedded in the tag name: ciflow// 2025-09-07T06:09:28.4358657Z 2025-09-07T06:09:28.4358834Z gh = get_gh_client(github_token) 2025-09-07T06:09:28.4359145Z 2025-09-07T06:09:28.4359398Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-09-07T06:09:28.4359968Z split_tag = ref_name.split("/") 2025-09-07T06:09:28.4360431Z if ( 2025-09-07T06:09:28.4360783Z len(split_tag) == 3 2025-09-07T06:09:28.4361234Z and split_tag[0] == "ciflow" 2025-09-07T06:09:28.4361952Z and split_tag[2].isnumeric() 2025-09-07T06:09:28.4362416Z ): 2025-09-07T06:09:28.4362958Z pr_number = split_tag[2] 2025-09-07T06:09:28.4363403Z try: 2025-09-07T06:09:28.4363834Z repository = gh.get_repo(repo) 2025-09-07T06:09:28.4364395Z pull = repository.get_pull(number=int(pr_number)) 2025-09-07T06:09:28.4364948Z except Exception as e: 2025-09-07T06:09:28.4365420Z raise Exception( # noqa: TRY002 2025-09-07T06:09:28.4366037Z f"issue with pull request {pr_number} from repo {repository}" 2025-09-07T06:09:28.4366617Z ) from e 2025-09-07T06:09:28.4367117Z return pull.user.login # type: ignore[no-any-return] 2025-09-07T06:09:28.4367755Z # In all other cases, return the original input username 2025-09-07T06:09:28.4368306Z return username 2025-09-07T06:09:28.4368531Z 2025-09-07T06:09:28.4368537Z 2025-09-07T06:09:28.4368759Z def is_exception_branch(branch: str) -> bool: 2025-09-07T06:09:28.4369245Z """ 2025-09-07T06:09:28.4369853Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-09-07T06:09:28.4370609Z """ 2025-09-07T06:09:28.4371119Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-09-07T06:09:28.4371886Z 2025-09-07T06:09:28.4371894Z 2025-09-07T06:09:28.4372089Z def load_yaml(yaml_text: str) -> Any: 2025-09-07T06:09:28.4372541Z try: 2025-09-07T06:09:28.4372898Z data = yaml.safe_load(yaml_text) 2025-09-07T06:09:28.4373358Z return data 2025-09-07T06:09:28.4373738Z except yaml.YAMLError: 2025-09-07T06:09:28.4374178Z log.exception("Error loading YAML") 2025-09-07T06:09:28.4374653Z raise 2025-09-07T06:09:28.4374854Z 2025-09-07T06:09:28.4374861Z 2025-09-07T06:09:28.4375243Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-09-07T06:09:28.4375925Z """ 2025-09-07T06:09:28.4376494Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-09-07T06:09:28.4377046Z 2025-09-07T06:09:28.4377502Z If the issue body contains "---" then the text above that is the settings 2025-09-07T06:09:28.4378212Z and the text below is the list of opted in users. 2025-09-07T06:09:28.4378583Z 2025-09-07T06:09:28.4378930Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-09-07T06:09:28.4379573Z """ 2025-09-07T06:09:28.4379976Z rollout_state_parts = rollout_state.split("---") 2025-09-07T06:09:28.4380528Z if len(rollout_state_parts) >= 2: 2025-09-07T06:09:28.4381081Z return rollout_state_parts[0], rollout_state_parts[1] 2025-09-07T06:09:28.4381821Z else: 2025-09-07T06:09:28.4382179Z return "", rollout_state 2025-09-07T06:09:28.4382460Z 2025-09-07T06:09:28.4382467Z 2025-09-07T06:09:28.4382649Z class UserOptins(dict[str, list[str]]): 2025-09-07T06:09:28.4383114Z """ 2025-09-07T06:09:28.4383588Z Dictionary of users with a list of features they have opted into 2025-09-07T06:09:28.4384177Z """ 2025-09-07T06:09:28.4384361Z 2025-09-07T06:09:28.4384367Z 2025-09-07T06:09:28.4384681Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-09-07T06:09:28.4385271Z """ 2025-09-07T06:09:28.4385922Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-09-07T06:09:28.4386542Z 2025-09-07T06:09:28.4387106Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-09-07T06:09:28.4388016Z - Example line: "@User1,lf,split_build" 2025-09-07T06:09:28.4388636Z - A "#" prefix indicates the user is opted out of all experiments 2025-09-07T06:09:28.4389074Z 2025-09-07T06:09:28.4389081Z 2025-09-07T06:09:28.4389225Z """ 2025-09-07T06:09:28.4389563Z optins = UserOptins() 2025-09-07T06:09:28.4390005Z for user in user_optin_text.split("\n"): 2025-09-07T06:09:28.4390515Z user = user.strip("\r\n\t -") 2025-09-07T06:09:28.4391205Z if not user or not user.startswith("@"): 2025-09-07T06:09:28.4392032Z # Not a valid user. Skip 2025-09-07T06:09:28.4392479Z continue 2025-09-07T06:09:28.4392705Z 2025-09-07T06:09:28.4392853Z if user: 2025-09-07T06:09:28.4393248Z usr_name = user.split(",")[0].strip("@") 2025-09-07T06:09:28.4393888Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-09-07T06:09:28.4394338Z 2025-09-07T06:09:28.4394497Z return optins 2025-09-07T06:09:28.4394713Z 2025-09-07T06:09:28.4394720Z 2025-09-07T06:09:28.4394982Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-09-07T06:09:28.4395532Z """ 2025-09-07T06:09:28.4395884Z Check if the experiment name is valid. 2025-09-07T06:09:28.4396355Z A valid name: 2025-09-07T06:09:28.4396929Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-09-07T06:09:28.4397795Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-09-07T06:09:28.4398452Z - Cannot contain spaces 2025-09-07T06:09:28.4398863Z """ 2025-09-07T06:09:28.4399043Z 2025-09-07T06:09:28.4399288Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-09-07T06:09:28.4399918Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-09-07T06:09:28.4400329Z 2025-09-07T06:09:28.4400478Z if valid: 2025-09-07T06:09:28.4400816Z return True 2025-09-07T06:09:28.4401037Z 2025-09-07T06:09:28.4401183Z log.error( 2025-09-07T06:09:28.4403044Z 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-09-07T06:09:28.4404520Z ) 2025-09-07T06:09:28.4404843Z return False 2025-09-07T06:09:28.4405060Z 2025-09-07T06:09:28.4405067Z 2025-09-07T06:09:28.4405354Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-09-07T06:09:28.4405917Z """ 2025-09-07T06:09:28.4406609Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-09-07T06:09:28.4407268Z """ 2025-09-07T06:09:28.4407586Z try: 2025-09-07T06:09:28.4407922Z if settings_text: 2025-09-07T06:09:28.4408589Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-09-07T06:09:28.4409306Z # for easy reading 2025-09-07T06:09:28.4410026Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-09-07T06:09:28.4410837Z # the backtick character in shell commands. 2025-09-07T06:09:28.4411598Z backtick = chr(96) # backtick character 2025-09-07T06:09:28.4412226Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-09-07T06:09:28.4412823Z settings = load_yaml(settings_text) 2025-09-07T06:09:28.4413167Z 2025-09-07T06:09:28.4413545Z # For now we just load experiments. We can expand this if/when we add more settings 2025-09-07T06:09:28.4414232Z experiments = {} 2025-09-07T06:09:28.4414496Z 2025-09-07T06:09:28.4414844Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-09-07T06:09:28.4415536Z if not is_valid_experiment_name(exp_name): 2025-09-07T06:09:28.4416540Z # 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-09-07T06:09:28.4417497Z continue 2025-09-07T06:09:28.4417754Z 2025-09-07T06:09:28.4417919Z valid_settings = {} 2025-09-07T06:09:28.4418390Z for setting in exp_settings: 2025-09-07T06:09:28.4418914Z if setting not in Experiment._fields: 2025-09-07T06:09:28.4419409Z log.warning( 2025-09-07T06:09:28.4420050Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-09-07T06:09:28.4420843Z ) 2025-09-07T06:09:28.4421226Z else: 2025-09-07T06:09:28.4421821Z valid_settings[setting] = exp_settings[setting] 2025-09-07T06:09:28.4422212Z 2025-09-07T06:09:28.4422465Z experiments[exp_name] = Experiment(**valid_settings) 2025-09-07T06:09:28.4423044Z return Settings(experiments) 2025-09-07T06:09:28.4423360Z 2025-09-07T06:09:28.4423517Z except Exception: 2025-09-07T06:09:28.4423952Z log.exception("Failed to parse settings") 2025-09-07T06:09:28.4424299Z 2025-09-07T06:09:28.4424456Z return Settings() 2025-09-07T06:09:28.4424691Z 2025-09-07T06:09:28.4424697Z 2025-09-07T06:09:28.4424927Z def parse_settings(rollout_state: str) -> Settings: 2025-09-07T06:09:28.4425435Z """ 2025-09-07T06:09:28.4425822Z Parse settings, if any, from the rollout state. 2025-09-07T06:09:28.4426184Z 2025-09-07T06:09:28.4426514Z If the issue body contains "---" then the text above that is the settings 2025-09-07T06:09:28.4427208Z and the text below is the list of opted in users. 2025-09-07T06:09:28.4427578Z 2025-09-07T06:09:28.4427950Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-09-07T06:09:28.4428605Z """ 2025-09-07T06:09:28.4429110Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:09:28.4429788Z return parse_settings_from_text(settings_text) 2025-09-07T06:09:28.4430157Z 2025-09-07T06:09:28.4430165Z 2025-09-07T06:09:28.4430387Z def parse_users(rollout_state: str) -> UserOptins: 2025-09-07T06:09:28.4430902Z """ 2025-09-07T06:09:28.4431251Z Parse users from the rollout state. 2025-09-07T06:09:28.4431909Z 2025-09-07T06:09:28.4432060Z """ 2025-09-07T06:09:28.4432548Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:09:28.4433223Z return parse_user_opt_in_from_text(users_text) 2025-09-07T06:09:28.4433598Z 2025-09-07T06:09:28.4433605Z 2025-09-07T06:09:28.4434126Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:09:28.4434813Z """ 2025-09-07T06:09:28.4435196Z Check if a user is opted into an experiment 2025-09-07T06:09:28.4435680Z """ 2025-09-07T06:09:28.4436093Z return experiment_name in user_optins.get(user, []) 2025-09-07T06:09:28.4436476Z 2025-09-07T06:09:28.4436481Z 2025-09-07T06:09:28.4436866Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:09:28.4437545Z """ 2025-09-07T06:09:28.4437991Z Check if a user explicitly opted out of an experiment 2025-09-07T06:09:28.4438511Z """ 2025-09-07T06:09:28.4438966Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-09-07T06:09:28.4439583Z experiment_optout = "-" + experiment_name 2025-09-07T06:09:28.4440159Z if experiment_optout not in user_optins.get(user, []): 2025-09-07T06:09:28.4440699Z return False 2025-09-07T06:09:28.4440930Z 2025-09-07T06:09:28.4441174Z if is_user_opted_in(user, user_optins, experiment_name): 2025-09-07T06:09:28.4441847Z log.warning( 2025-09-07T06:09:28.4442582Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-09-07T06:09:28.4443379Z ) 2025-09-07T06:09:28.4443559Z 2025-09-07T06:09:28.4443709Z return True 2025-09-07T06:09:28.4443918Z 2025-09-07T06:09:28.4443930Z 2025-09-07T06:09:28.4444090Z def get_runner_prefix( 2025-09-07T06:09:28.4444473Z rollout_state: str, 2025-09-07T06:09:28.4444889Z workflow_requestors: Iterable[str], 2025-09-07T06:09:28.4445346Z branch: str, 2025-09-07T06:09:28.4445780Z eligible_experiments: frozenset[str] = frozenset(), 2025-09-07T06:09:28.4446376Z opt_out_experiments: frozenset[str] = frozenset(), 2025-09-07T06:09:28.4446899Z is_canary: bool = False, 2025-09-07T06:09:28.4447314Z ) -> str: 2025-09-07T06:09:28.4447817Z settings = parse_settings(rollout_state) 2025-09-07T06:09:28.4448346Z user_optins = parse_users(rollout_state) 2025-09-07T06:09:28.4448678Z 2025-09-07T06:09:28.4448837Z fleet_prefix = "" 2025-09-07T06:09:28.4449221Z prefixes = [] 2025-09-07T06:09:28.4449785Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-09-07T06:09:28.4450642Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-09-07T06:09:28.4451444Z log.info( 2025-09-07T06:09:28.4452133Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-09-07T06:09:28.4452819Z ) 2025-09-07T06:09:28.4453149Z continue 2025-09-07T06:09:28.4453374Z 2025-09-07T06:09:28.4453543Z if opt_out_experiments: 2025-09-07T06:09:28.4454011Z if experiment_name in opt_out_experiments: 2025-09-07T06:09:28.4454587Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-09-07T06:09:28.4455110Z log.info( 2025-09-07T06:09:28.4455945Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-09-07T06:09:28.4456822Z ) 2025-09-07T06:09:28.4457173Z continue 2025-09-07T06:09:28.4457411Z 2025-09-07T06:09:28.4457586Z if eligible_experiments: 2025-09-07T06:09:28.4458076Z if experiment_name not in eligible_experiments: 2025-09-07T06:09:28.4458651Z exp_list = ", ".join(eligible_experiments) 2025-09-07T06:09:28.4459144Z log.info( 2025-09-07T06:09:28.4459850Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-09-07T06:09:28.4460609Z ) 2025-09-07T06:09:28.4460962Z continue 2025-09-07T06:09:28.4461491Z elif not experiment_settings.default: 2025-09-07T06:09:28.4461981Z log.info( 2025-09-07T06:09:28.4462697Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-09-07T06:09:28.4463370Z ) 2025-09-07T06:09:28.4463711Z continue 2025-09-07T06:09:28.4463933Z 2025-09-07T06:09:28.4464186Z # Is any workflow_requestor opted out to this experiment? 2025-09-07T06:09:28.4464749Z opted_out_users = [ 2025-09-07T06:09:28.4465162Z requestor 2025-09-07T06:09:28.4465566Z for requestor in workflow_requestors 2025-09-07T06:09:28.4466177Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-09-07T06:09:28.4466738Z ] 2025-09-07T06:09:28.4466930Z 2025-09-07T06:09:28.4467094Z if opted_out_users: 2025-09-07T06:09:28.4467495Z log.info( 2025-09-07T06:09:28.4468051Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-09-07T06:09:28.4468681Z ) 2025-09-07T06:09:28.4469016Z continue 2025-09-07T06:09:28.4469236Z 2025-09-07T06:09:28.4469483Z # Is any workflow_requestor opted in to this experiment? 2025-09-07T06:09:28.4470030Z opted_in_users = [ 2025-09-07T06:09:28.4470464Z requestor 2025-09-07T06:09:28.4470868Z for requestor in workflow_requestors 2025-09-07T06:09:28.4471748Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-09-07T06:09:28.4472321Z ] 2025-09-07T06:09:28.4472506Z 2025-09-07T06:09:28.4472661Z enabled = False 2025-09-07T06:09:28.4473051Z if opted_in_users: 2025-09-07T06:09:28.4473440Z log.info( 2025-09-07T06:09:28.4473987Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-09-07T06:09:28.4474594Z ) 2025-09-07T06:09:28.4474939Z enabled = True 2025-09-07T06:09:28.4475187Z 2025-09-07T06:09:28.4475383Z elif experiment_settings.rollout_perc: 2025-09-07T06:09:28.4476138Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-09-07T06:09:28.4477135Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-09-07T06:09:28.4477720Z log.info( 2025-09-07T06:09:28.4478510Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-09-07T06:09:28.4479335Z ) 2025-09-07T06:09:28.4479694Z enabled = True 2025-09-07T06:09:28.4479958Z 2025-09-07T06:09:28.4480101Z if enabled: 2025-09-07T06:09:28.4480475Z label = experiment_name 2025-09-07T06:09:28.4480968Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-09-07T06:09:28.4481841Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-09-07T06:09:28.4482638Z # - If it's enabled, then we always list it's prefix first 2025-09-07T06:09:28.4483330Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-09-07T06:09:28.4483924Z if is_canary: 2025-09-07T06:09:28.4484360Z label += CANARY_FLEET_SUFFIX 2025-09-07T06:09:28.4484858Z fleet_prefix = label 2025-09-07T06:09:28.4485296Z else: 2025-09-07T06:09:28.4485683Z prefixes.append(label) 2025-09-07T06:09:28.4485992Z 2025-09-07T06:09:28.4486161Z if len(prefixes) > 1: 2025-09-07T06:09:28.4486552Z log.error( 2025-09-07T06:09:28.4487482Z 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-09-07T06:09:28.4488482Z ) 2025-09-07T06:09:28.4488833Z prefixes = prefixes[:1] 2025-09-07T06:09:28.4489108Z 2025-09-07T06:09:28.4489275Z # Fleet always comes first 2025-09-07T06:09:28.4489703Z if fleet_prefix: 2025-09-07T06:09:28.4490110Z prefixes.insert(0, fleet_prefix) 2025-09-07T06:09:28.4490435Z 2025-09-07T06:09:28.4490782Z return ".".join(prefixes) + "." if prefixes else "" 2025-09-07T06:09:28.4491156Z 2025-09-07T06:09:28.4491163Z 2025-09-07T06:09:28.4491677Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-09-07T06:09:28.4492369Z """ 2025-09-07T06:09:28.4492894Z Gets the first comment of the issue, which contains the desired rollout state. 2025-09-07T06:09:28.4493399Z 2025-09-07T06:09:28.4493759Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-09-07T06:09:28.4494397Z """ 2025-09-07T06:09:28.4494746Z gh = get_gh_client(github_token) 2025-09-07T06:09:28.4495229Z issue = get_issue(gh, repo, issue_num) 2025-09-07T06:09:28.4495806Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-09-07T06:09:28.4496205Z 2025-09-07T06:09:28.4496211Z 2025-09-07T06:09:28.4496573Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-09-07T06:09:28.4497269Z for _ in range(num_retries): 2025-09-07T06:09:28.4497694Z try: 2025-09-07T06:09:28.4498076Z req = Request(url=url, headers=headers) 2025-09-07T06:09:28.4498671Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-09-07T06:09:28.4499246Z return json.loads(content) 2025-09-07T06:09:28.4499720Z except Exception as e: 2025-09-07T06:09:28.4500197Z log.warning(f"Could not download {url}: {e}") 2025-09-07T06:09:28.4500563Z 2025-09-07T06:09:28.4500903Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-09-07T06:09:28.4501632Z return {} 2025-09-07T06:09:28.4501838Z 2025-09-07T06:09:28.4501844Z 2025-09-07T06:09:28.4501987Z @cache 2025-09-07T06:09:28.4502541Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-09-07T06:09:28.4503211Z """ 2025-09-07T06:09:28.4503559Z Dynamically get PR information 2025-09-07T06:09:28.4504110Z """ 2025-09-07T06:09:28.4504563Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-09-07T06:09:28.4505115Z headers = { 2025-09-07T06:09:28.4505522Z "Accept": "application/vnd.github.v3+json", 2025-09-07T06:09:28.4506054Z "Authorization": f"token {github_token}", 2025-09-07T06:09:28.4506536Z } 2025-09-07T06:09:28.4506921Z json_response: dict[str, Any] = download_json( 2025-09-07T06:09:28.4507457Z url=f"{github_api}/issues/{pr_number}", 2025-09-07T06:09:28.4507951Z headers=headers, 2025-09-07T06:09:28.4508325Z ) 2025-09-07T06:09:28.4508497Z 2025-09-07T06:09:28.4508666Z if not json_response: 2025-09-07T06:09:28.4509169Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-09-07T06:09:28.4509719Z return {} 2025-09-07T06:09:28.4509929Z 2025-09-07T06:09:28.4510087Z return json_response 2025-09-07T06:09:28.4510339Z 2025-09-07T06:09:28.4510346Z 2025-09-07T06:09:28.4510710Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-09-07T06:09:28.4511613Z """ 2025-09-07T06:09:28.4512181Z Dynamically get the latest list of labels from the pull request 2025-09-07T06:09:28.4512822Z """ 2025-09-07T06:09:28.4513297Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-09-07T06:09:28.4513897Z return { 2025-09-07T06:09:28.4514463Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-09-07T06:09:28.4515146Z } 2025-09-07T06:09:28.4515345Z 2025-09-07T06:09:28.4515352Z 2025-09-07T06:09:28.4515541Z def main() -> None: 2025-09-07T06:09:28.4515967Z args = parse_args() 2025-09-07T06:09:28.4516230Z 2025-09-07T06:09:28.4516457Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-09-07T06:09:28.4516800Z 2025-09-07T06:09:28.4516972Z # Check if the PR is opt-out 2025-09-07T06:09:28.4517415Z if args.pr_number: 2025-09-07T06:09:28.4517996Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-09-07T06:09:28.4518811Z if OPT_OUT_LABEL in labels: 2025-09-07T06:09:28.4519252Z log.info( 2025-09-07T06:09:28.4519875Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-09-07T06:09:28.4520564Z ) 2025-09-07T06:09:28.4521044Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:09:28.4521885Z sys.exit() 2025-09-07T06:09:28.4522123Z 2025-09-07T06:09:28.4522267Z try: 2025-09-07T06:09:28.4522663Z rollout_state = get_rollout_state_from_issue( 2025-09-07T06:09:28.4523298Z args.github_token, args.github_issue_repo, args.github_issue 2025-09-07T06:09:28.4523874Z ) 2025-09-07T06:09:28.4524057Z 2025-09-07T06:09:28.4524249Z username = get_potential_pr_author( 2025-09-07T06:09:28.4524728Z args.github_token, 2025-09-07T06:09:28.4525164Z args.github_repo, 2025-09-07T06:09:28.4525583Z args.github_actor, 2025-09-07T06:09:28.4526019Z args.github_ref_type, 2025-09-07T06:09:28.4526461Z args.github_branch, 2025-09-07T06:09:28.4526869Z ) 2025-09-07T06:09:28.4527048Z 2025-09-07T06:09:28.4527302Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-09-07T06:09:28.4527711Z 2025-09-07T06:09:28.4527905Z runner_label_prefix = get_runner_prefix( 2025-09-07T06:09:28.4528400Z rollout_state, 2025-09-07T06:09:28.4528827Z (args.github_issue_owner, username), 2025-09-07T06:09:28.4529324Z args.github_branch, 2025-09-07T06:09:28.4529763Z args.eligible_experiments, 2025-09-07T06:09:28.4530242Z args.opt_out_experiments, 2025-09-07T06:09:28.4530682Z is_canary, 2025-09-07T06:09:28.4531047Z ) 2025-09-07T06:09:28.4531232Z 2025-09-07T06:09:28.4531593Z except Exception as e: 2025-09-07T06:09:28.4532016Z log.error( 2025-09-07T06:09:28.4532623Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-09-07T06:09:28.4533451Z ) 2025-09-07T06:09:28.4533630Z 2025-09-07T06:09:28.4533936Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:09:28.4534379Z 2025-09-07T06:09:28.4534386Z 2025-09-07T06:09:28.4534544Z if __name__ == "__main__": 2025-09-07T06:09:28.4534936Z main() 2025-09-07T06:09:28.4535119Z 2025-09-07T06:09:28.4625305Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-09-07T06:09:28.4626102Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-09-07T06:09:28.4655650Z shell: /usr/bin/bash -e {0} 2025-09-07T06:09:28.4656084Z env: 2025-09-07T06:09:28.4656630Z GITHUB_TOKEN: *** 2025-09-07T06:09:28.4657009Z ISSUE_NUMBER: 5132 2025-09-07T06:09:28.4657409Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T06:09:28.4657852Z ISSUE_OWNER: 2025-09-07T06:09:28.4658199Z CHECK_EXPERIMENTS: 2025-09-07T06:09:28.4658573Z OPT_OUT_EXPERIMENTS: 2025-09-07T06:09:28.4658967Z PR_NUMBER: 2025-09-07T06:09:28.4659299Z ##[endgroup] 2025-09-07T06:09:31.0885804Z Defaulting to user installation because normal site-packages is not writeable 2025-09-07T06:09:32.3833641Z Collecting urllib3==1.26.18 2025-09-07T06:09:32.4628849Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-09-07T06:09:32.4933437Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 2.0 MB/s eta 0:00:00 2025-09-07T06:09:32.5189255Z Collecting PyGithub==2.3.0 2025-09-07T06:09:32.5377811Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-09-07T06:09:32.5790534Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-09-07T06:09:32.5980429Z 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-09-07T06:09:32.6024084Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-09-07T06:09:32.6036396Z 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-09-07T06:09:32.6056092Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-09-07T06:09:32.6309891Z Collecting Deprecated (from PyGithub==2.3.0) 2025-09-07T06:09:32.6497892Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-09-07T06:09:32.6721791Z 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-09-07T06:09:32.7811057Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-09-07T06:09:32.7999734Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-09-07T06:09:32.9220244Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-09-07T06:09:32.9409919Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.4 kB) 2025-09-07T06:09:32.9580866Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-09-07T06:09:32.9767713Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-09-07T06:09:33.0147234Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-09-07T06:09:33.0382725Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 6.2 MB/s eta 0:00:00 2025-09-07T06:09:33.0569766Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-09-07T06:09:33.0799645Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 16.2 MB/s eta 0:00:00 2025-09-07T06:09:33.0990177Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-09-07T06:09:33.1226597Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 38.3 MB/s eta 0:00:00 2025-09-07T06:09:33.1413427Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-09-07T06:09:33.1621235Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-09-07T06:09:33.1707379Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 75.3 MB/s eta 0:00:00 2025-09-07T06:09:33.1899719Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-09-07T06:09:33.1946469Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 26.8 MB/s eta 0:00:00 2025-09-07T06:09:33.2134583Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-09-07T06:09:33.2177254Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 40.4 MB/s eta 0:00:00 2025-09-07T06:09:33.5622670Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-09-07T06:09:34.0908521Z 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.3 2025-09-07T06:09:34.1688737Z ##[group]Run curr_branch="main" 2025-09-07T06:09:34.1689048Z curr_branch="main" 2025-09-07T06:09:34.1689294Z curr_ref_type="branch" 2025-09-07T06:09:34.1689547Z echo "Current branch is '$curr_branch'" 2025-09-07T06:09:34.1689796Z  2025-09-07T06:09:34.1689992Z python3 runner_determinator.py \ 2025-09-07T06:09:34.1690269Z  --github-token "$GITHUB_TOKEN" \ 2025-09-07T06:09:34.1690543Z  --github-issue "$ISSUE_NUMBER" \ 2025-09-07T06:09:34.1690799Z  --github-branch "$curr_branch" \ 2025-09-07T06:09:34.1691060Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-09-07T06:09:34.1691613Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-09-07T06:09:34.1691914Z  --github-ref-type "$curr_ref_type" \ 2025-09-07T06:09:34.1692186Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-09-07T06:09:34.1692486Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-09-07T06:09:34.1692856Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-09-07T06:09:34.1693154Z  --pr-number "${PR_NUMBER}" 2025-09-07T06:09:34.1723555Z shell: /usr/bin/bash -e {0} 2025-09-07T06:09:34.1723799Z env: 2025-09-07T06:09:34.1724373Z GITHUB_TOKEN: *** 2025-09-07T06:09:34.1724583Z ISSUE_NUMBER: 5132 2025-09-07T06:09:34.1724806Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T06:09:34.1725045Z ISSUE_OWNER: 2025-09-07T06:09:34.1725224Z CHECK_EXPERIMENTS: 2025-09-07T06:09:34.1725422Z OPT_OUT_EXPERIMENTS: 2025-09-07T06:09:34.1725611Z PR_NUMBER: 2025-09-07T06:09:34.1725807Z ##[endgroup] 2025-09-07T06:09:34.1773087Z Current branch is 'main' 2025-09-07T06:09:35.6900068Z INFO : Based on rollout percentage of 60%, enabling experiment lf. 2025-09-07T06:09:35.6901210Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-09-07T06:09:35.6902389Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-09-07T06:09:35.6903364Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-09-07T06:09:35.6903862Z INFO : Setting output: label-type='lf.' 2025-09-07T06:09:35.7208683Z Evaluate and set job outputs 2025-09-07T06:09:35.7215306Z Set output 'label-type' 2025-09-07T06:09:35.7217508Z Cleaning up orphan processes