2025-12-04T08:48:47.4718391Z Current runner version: '2.329.0' 2025-12-04T08:48:47.4744876Z ##[group]Runner Image Provisioner 2025-12-04T08:48:47.4745662Z Hosted Compute Agent 2025-12-04T08:48:47.4746484Z Version: 20251124.448 2025-12-04T08:48:47.4747509Z Commit: fda5086b43ec66ade217e5fcd18146c879571177 2025-12-04T08:48:47.4748197Z Build Date: 2025-11-24T21:16:26Z 2025-12-04T08:48:47.4748790Z ##[endgroup] 2025-12-04T08:48:47.4749424Z ##[group]Operating System 2025-12-04T08:48:47.4750012Z Ubuntu 2025-12-04T08:48:47.4750475Z 24.04.3 2025-12-04T08:48:47.4751021Z LTS 2025-12-04T08:48:47.4751464Z ##[endgroup] 2025-12-04T08:48:47.4751966Z ##[group]Runner Image 2025-12-04T08:48:47.4752622Z Image: ubuntu-24.04 2025-12-04T08:48:47.4753105Z Version: 20251126.144.1 2025-12-04T08:48:47.4754197Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20251126.144/images/ubuntu/Ubuntu2404-Readme.md 2025-12-04T08:48:47.4755797Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20251126.144 2025-12-04T08:48:47.4757018Z ##[endgroup] 2025-12-04T08:48:47.4758137Z ##[group]GITHUB_TOKEN Permissions 2025-12-04T08:48:47.4760676Z Contents: read 2025-12-04T08:48:47.4761339Z Metadata: read 2025-12-04T08:48:47.4761853Z ##[endgroup] 2025-12-04T08:48:47.4764059Z Secret source: Actions 2025-12-04T08:48:47.4765054Z Prepare workflow directory 2025-12-04T08:48:47.5435517Z Prepare all required actions 2025-12-04T08:48:47.5515195Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (ffd9b0fb4355e97af82fc42cf185c3ffa0fc0a32) 2025-12-04T08:48:47.5522715Z ##[group] Inputs 2025-12-04T08:48:47.5523588Z check_experiments: 2025-12-04T08:48:47.5524443Z opt_out_experiments: 2025-12-04T08:48:47.5525337Z triggering_actor: huydhn 2025-12-04T08:48:47.5526519Z issue_owner: 2025-12-04T08:48:47.5527345Z curr_branch: main 2025-12-04T08:48:47.5528239Z curr_ref_type: branch 2025-12-04T08:48:47.5529315Z issue_number: 5132 2025-12-04T08:48:47.5530153Z ##[endgroup] 2025-12-04T08:48:47.5531315Z Complete job name: before-test / get-label-type / runner-determinator 2025-12-04T08:48:48.1148689Z ##[group]Run cat < runner_determinator.py 2025-12-04T08:48:48.1151133Z cat < runner_determinator.py 2025-12-04T08:48:48.1151937Z # flake8: noqa: G004 2025-12-04T08:48:48.1152555Z  2025-12-04T08:48:48.1153402Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T08:48:48.1154591Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T08:48:48.1155610Z # python .github/scripts/update_runner_determinator.py 2025-12-04T08:48:48.1156582Z  2025-12-04T08:48:48.1157025Z """ 2025-12-04T08:48:48.1157890Z This runner determinator is used to determine which set of runners to run a 2025-12-04T08:48:48.1158986Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T08:48:48.1160281Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T08:48:48.1161314Z of which runners should be used to run which job. 2025-12-04T08:48:48.1162058Z  2025-12-04T08:48:48.1162887Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T08:48:48.1163983Z separated by a line containing "---". If the line is not present, the 2025-12-04T08:48:48.1165078Z settings are considered to be empty with only the second part, the user 2025-12-04T08:48:48.1166046Z list, defined. 2025-12-04T08:48:48.1166711Z  2025-12-04T08:48:48.1167473Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T08:48:48.1168640Z used to define any settings that are needed to determine which runners to use. 2025-12-04T08:48:48.1169715Z It's fields are defined by the RolloutSettings class below. 2025-12-04T08:48:48.1170463Z  2025-12-04T08:48:48.1171559Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T08:48:48.1172703Z The user list is also a comma separated list of additional features or 2025-12-04T08:48:48.1173632Z experiments which the user could be opted in to. 2025-12-04T08:48:48.1174429Z  2025-12-04T08:48:48.1174965Z The user list has the following rules: 2025-12-04T08:48:48.1175664Z  2025-12-04T08:48:48.1176726Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T08:48:48.1177900Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T08:48:48.1178908Z - A "#" prefix opts the user out of all experiments 2025-12-04T08:48:48.1179583Z  2025-12-04T08:48:48.1180184Z Example config: 2025-12-04T08:48:48.1180826Z  # A list of experiments that can be opted into. 2025-12-04T08:48:48.1181744Z  # This defines the behavior they'll induce when opted into. 2025-12-04T08:48:48.1182637Z  # Expected syntax is: 2025-12-04T08:48:48.1183472Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T08:48:48.1184635Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T08:48:48.1185604Z  2025-12-04T08:48:48.1186110Z  experiments: 2025-12-04T08:48:48.1187073Z  lf: 2025-12-04T08:48:48.1187729Z  rollout_percent: 25 2025-12-04T08:48:48.1188398Z  all_branches: false 2025-12-04T08:48:48.1189012Z  default: true 2025-12-04T08:48:48.1189665Z  --- 2025-12-04T08:48:48.1190147Z  2025-12-04T08:48:48.1190675Z  # Opt-ins: 2025-12-04T08:48:48.1191534Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T08:48:48.1192850Z  # and specifying experiments to enable in a comma-separated list. 2025-12-04T08:48:48.1193891Z  # To always opt out of an experiment, prefix it with a "-". 2025-12-04T08:48:48.1194791Z  # Experiments should be from the above list. 2025-12-04T08:48:48.1195530Z  2025-12-04T08:48:48.1196055Z  @User1,-lf,split_build 2025-12-04T08:48:48.1197037Z  @User2,lf 2025-12-04T08:48:48.1197658Z  @User3,split_build 2025-12-04T08:48:48.1198232Z """ 2025-12-04T08:48:48.1275464Z  2025-12-04T08:48:48.1276009Z import json 2025-12-04T08:48:48.1276776Z import logging 2025-12-04T08:48:48.1277330Z import os 2025-12-04T08:48:48.1277795Z import random 2025-12-04T08:48:48.1278270Z import re 2025-12-04T08:48:48.1278711Z import sys 2025-12-04T08:48:48.1279226Z from argparse import ArgumentParser 2025-12-04T08:48:48.1279929Z from collections.abc import Iterable 2025-12-04T08:48:48.1280579Z from functools import cache 2025-12-04T08:48:48.1281152Z from logging import LogRecord 2025-12-04T08:48:48.1281763Z from typing import Any, NamedTuple 2025-12-04T08:48:48.1282416Z from urllib.request import Request, urlopen 2025-12-04T08:48:48.1283026Z  2025-12-04T08:48:48.1283435Z import yaml 2025-12-04T08:48:48.1283936Z from github import Auth, Github 2025-12-04T08:48:48.1284531Z from github.Issue import Issue 2025-12-04T08:48:48.1285080Z  2025-12-04T08:48:48.1285469Z  2025-12-04T08:48:48.1285972Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T08:48:48.1286900Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T08:48:48.1287919Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T08:48:48.1288721Z  2025-12-04T08:48:48.1289468Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T08:48:48.1290162Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T08:48:48.1290790Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T08:48:48.1291482Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T08:48:48.1292072Z  2025-12-04T08:48:48.1292529Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T08:48:48.1293091Z  2025-12-04T08:48:48.1293518Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T08:48:48.1294091Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T08:48:48.1294624Z  2025-12-04T08:48:48.1295018Z  2025-12-04T08:48:48.1295453Z class Experiment(NamedTuple): 2025-12-04T08:48:48.1296030Z  rollout_perc: float = ( 2025-12-04T08:48:48.1296917Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T08:48:48.1297700Z  ) 2025-12-04T08:48:48.1298168Z  all_branches: bool = ( 2025-12-04T08:48:48.1298942Z  False # If True, the experiment is also enabled on the exception branches 2025-12-04T08:48:48.1299707Z  ) 2025-12-04T08:48:48.1300154Z  default: bool = ( 2025-12-04T08:48:48.1300858Z  True # If True, the experiment is enabled by default for all queries 2025-12-04T08:48:48.1301580Z  ) 2025-12-04T08:48:48.1302002Z  2025-12-04T08:48:48.1302432Z  # Add more fields as needed 2025-12-04T08:48:48.1302985Z  2025-12-04T08:48:48.1303372Z  2025-12-04T08:48:48.1303807Z class Settings(NamedTuple): 2025-12-04T08:48:48.1304345Z  """ 2025-12-04T08:48:48.1304906Z  Settings for the experiments that can be opted into. 2025-12-04T08:48:48.1305565Z  """ 2025-12-04T08:48:48.1305985Z  2025-12-04T08:48:48.1306767Z  experiments: dict[str, Experiment] = {} 2025-12-04T08:48:48.1307430Z  2025-12-04T08:48:48.1307978Z  2025-12-04T08:48:48.1308468Z class ColorFormatter(logging.Formatter): 2025-12-04T08:48:48.1309217Z  """Color codes the log messages based on the log level""" 2025-12-04T08:48:48.1309878Z  2025-12-04T08:48:48.1310275Z  COLORS = { 2025-12-04T08:48:48.1310776Z  "WARNING": "\033[33m", # Yellow 2025-12-04T08:48:48.1311384Z  "ERROR": "\033[31m", # Red 2025-12-04T08:48:48.1311981Z  "CRITICAL": "\033[31m", # Red 2025-12-04T08:48:48.1312563Z  "INFO": "\033[0m", # Reset 2025-12-04T08:48:48.1313150Z  "DEBUG": "\033[0m", # Reset 2025-12-04T08:48:48.1313694Z  } 2025-12-04T08:48:48.1314111Z  2025-12-04T08:48:48.1314592Z  def format(self, record: LogRecord) -> str: 2025-12-04T08:48:48.1315435Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T08:48:48.1316447Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T08:48:48.1317119Z  return super().format(record) 2025-12-04T08:48:48.1317690Z  2025-12-04T08:48:48.1318079Z  2025-12-04T08:48:48.1318519Z handler = logging.StreamHandler() 2025-12-04T08:48:48.1319359Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T08:48:48.1320150Z  2025-12-04T08:48:48.1320678Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T08:48:48.1321353Z log.addHandler(handler) 2025-12-04T08:48:48.1321895Z log.setLevel(logging.INFO) 2025-12-04T08:48:48.1322417Z  2025-12-04T08:48:48.1322809Z  2025-12-04T08:48:48.1323341Z def set_github_output(key: str, value: str) -> None: 2025-12-04T08:48:48.1323994Z  """ 2025-12-04T08:48:48.1324600Z  Defines outputs of the github action that invokes this script 2025-12-04T08:48:48.1325436Z  """ 2025-12-04T08:48:48.1325880Z  if not GITHUB_OUTPUT: 2025-12-04T08:48:48.1327165Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T08:48:48.1328386Z  log.warning( 2025-12-04T08:48:48.1329357Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T08:48:48.1330363Z  ) 2025-12-04T08:48:48.1330900Z  print(f"::set-output name={key}::{value}") 2025-12-04T08:48:48.1331526Z  return 2025-12-04T08:48:48.1331991Z  2025-12-04T08:48:48.1332455Z  with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T08:48:48.1333120Z  log.info(f"Setting output: {key}='{value}'") 2025-12-04T08:48:48.1333771Z  f.write(f"{key}={value}\n") 2025-12-04T08:48:48.1334326Z  2025-12-04T08:48:48.1334718Z  2025-12-04T08:48:48.1335293Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T08:48:48.1336020Z  return frozenset( 2025-12-04T08:48:48.1336871Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T08:48:48.1337663Z  ) 2025-12-04T08:48:48.1338085Z  2025-12-04T08:48:48.1338481Z  2025-12-04T08:48:48.1338900Z def parse_args() -> Any: 2025-12-04T08:48:48.1339585Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T08:48:48.1340545Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T08:48:48.1341380Z  parser.add_argument( 2025-12-04T08:48:48.1341946Z  "--github-issue-repo", 2025-12-04T08:48:48.1342511Z  type=str, 2025-12-04T08:48:48.1343019Z  required=False, 2025-12-04T08:48:48.1343705Z  default="pytorch/test-infra", 2025-12-04T08:48:48.1344354Z  help="GitHub repo to get the issue", 2025-12-04T08:48:48.1344940Z  ) 2025-12-04T08:48:48.1345386Z  parser.add_argument( 2025-12-04T08:48:48.1345928Z  "--github-repo", 2025-12-04T08:48:48.1346754Z  type=str, 2025-12-04T08:48:48.1347274Z  required=True, 2025-12-04T08:48:48.1347864Z  help="GitHub repo where CI is running", 2025-12-04T08:48:48.1348469Z  ) 2025-12-04T08:48:48.1348923Z  parser.add_argument( 2025-12-04T08:48:48.1349647Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T08:48:48.1350383Z  ) 2025-12-04T08:48:48.1350831Z  parser.add_argument( 2025-12-04T08:48:48.1351578Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T08:48:48.1352347Z  ) 2025-12-04T08:48:48.1352795Z  parser.add_argument( 2025-12-04T08:48:48.1353555Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T08:48:48.1354313Z  ) 2025-12-04T08:48:48.1354758Z  parser.add_argument( 2025-12-04T08:48:48.1355532Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T08:48:48.1356601Z  ) 2025-12-04T08:48:48.1357115Z  parser.add_argument( 2025-12-04T08:48:48.1357680Z  "--github-ref-type", 2025-12-04T08:48:48.1358238Z  type=str, 2025-12-04T08:48:48.1358732Z  required=True, 2025-12-04T08:48:48.1359357Z  help="Current GitHub ref type, branch or tag", 2025-12-04T08:48:48.1359976Z  ) 2025-12-04T08:48:48.1360412Z  parser.add_argument( 2025-12-04T08:48:48.1361191Z  "--eligible-experiments", 2025-12-04T08:48:48.1361811Z  type=_str_comma_separated_to_set, 2025-12-04T08:48:48.1362417Z  required=False, 2025-12-04T08:48:48.1362937Z  default="", 2025-12-04T08:48:48.1363905Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T08:48:48.1364913Z  ) 2025-12-04T08:48:48.1365346Z  parser.add_argument( 2025-12-04T08:48:48.1365903Z  "--opt-out-experiments", 2025-12-04T08:48:48.1366637Z  type=_str_comma_separated_to_set, 2025-12-04T08:48:48.1367241Z  required=False, 2025-12-04T08:48:48.1367768Z  default="", 2025-12-04T08:48:48.1368255Z  help=( 2025-12-04T08:48:48.1369032Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T08:48:48.1370249Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T08:48:48.1371149Z  ), 2025-12-04T08:48:48.1371579Z  ) 2025-12-04T08:48:48.1372026Z  parser.add_argument( 2025-12-04T08:48:48.1372560Z  "--pr-number", 2025-12-04T08:48:48.1373076Z  type=str, 2025-12-04T08:48:48.1373583Z  required=False, 2025-12-04T08:48:48.1374109Z  default="", 2025-12-04T08:48:48.1374696Z  help="the optional PR number where this is run", 2025-12-04T08:48:48.1375314Z  ) 2025-12-04T08:48:48.1375724Z  2025-12-04T08:48:48.1376151Z  return parser.parse_args() 2025-12-04T08:48:48.1376792Z  2025-12-04T08:48:48.1377210Z  2025-12-04T08:48:48.1377896Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T08:48:48.1378882Z  auth = Auth.Token(github_token) 2025-12-04T08:48:48.1379515Z  return Github(auth=auth) 2025-12-04T08:48:48.1380043Z  2025-12-04T08:48:48.1380433Z  2025-12-04T08:48:48.1381168Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T08:48:48.1382049Z  repo = gh.get_repo(repo) 2025-12-04T08:48:48.1382660Z  return repo.get_issue(number=issue_num) 2025-12-04T08:48:48.1383259Z  2025-12-04T08:48:48.1383648Z  2025-12-04T08:48:48.1384076Z def get_potential_pr_author( 2025-12-04T08:48:48.1384838Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T08:48:48.1385589Z ) -> str: 2025-12-04T08:48:48.1386390Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T08:48:48.1387483Z  # Fetch the actual username from the original PR. The PR number is 2025-12-04T08:48:48.1388363Z  # embedded in the tag name: ciflow// 2025-12-04T08:48:48.1389011Z  2025-12-04T08:48:48.1389462Z  gh = get_gh_client(github_token) 2025-12-04T08:48:48.1390017Z  2025-12-04T08:48:48.1390561Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T08:48:48.1391273Z  split_tag = ref_name.split("/") 2025-12-04T08:48:48.1391854Z  if ( 2025-12-04T08:48:48.1392335Z  len(split_tag) == 3 2025-12-04T08:48:48.1392927Z  and split_tag[0] == "ciflow" 2025-12-04T08:48:48.1393545Z  and split_tag[2].isnumeric() 2025-12-04T08:48:48.1394111Z  ): 2025-12-04T08:48:48.1394592Z  pr_number = split_tag[2] 2025-12-04T08:48:48.1395156Z  try: 2025-12-04T08:48:48.1395694Z  repository = gh.get_repo(repo) 2025-12-04T08:48:48.1396784Z  pull = repository.get_pull(number=int(pr_number)) 2025-12-04T08:48:48.1397510Z  except Exception as e: 2025-12-04T08:48:48.1398143Z  raise Exception( # noqa: TRY002 2025-12-04T08:48:48.1398919Z  f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T08:48:48.1399671Z  ) from e 2025-12-04T08:48:48.1400337Z  return pull.user.login # type: ignore[no-any-return] 2025-12-04T08:48:48.1401140Z  # In all other cases, return the original input username 2025-12-04T08:48:48.1401814Z  return username 2025-12-04T08:48:48.1402297Z  2025-12-04T08:48:48.1402691Z  2025-12-04T08:48:48.1403183Z def is_exception_branch(branch: str) -> bool: 2025-12-04T08:48:48.1403788Z  """ 2025-12-04T08:48:48.1404540Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T08:48:48.1405401Z  """ 2025-12-04T08:48:48.1406048Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T08:48:48.1406889Z  2025-12-04T08:48:48.1407283Z  2025-12-04T08:48:48.1407737Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T08:48:48.1408311Z  try: 2025-12-04T08:48:48.1408786Z  data = yaml.safe_load(yaml_text) 2025-12-04T08:48:48.1409378Z  return data 2025-12-04T08:48:48.1409893Z  except yaml.YAMLError: 2025-12-04T08:48:48.1410487Z  log.exception("Error loading YAML") 2025-12-04T08:48:48.1411080Z  raise 2025-12-04T08:48:48.1411529Z  2025-12-04T08:48:48.1411919Z  2025-12-04T08:48:48.1412602Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T08:48:48.1413426Z  """ 2025-12-04T08:48:48.1414280Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T08:48:48.1415116Z  2025-12-04T08:48:48.1415733Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T08:48:48.1416709Z  and the text below is the list of opted in users. 2025-12-04T08:48:48.1417341Z  2025-12-04T08:48:48.1417986Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T08:48:48.1418756Z  """ 2025-12-04T08:48:48.1419293Z  rollout_state_parts = rollout_state.split("---") 2025-12-04T08:48:48.1419968Z  if len(rollout_state_parts) >= 2: 2025-12-04T08:48:48.1420680Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T08:48:48.1421343Z  else: 2025-12-04T08:48:48.1421812Z  return "", rollout_state 2025-12-04T08:48:48.1422341Z  2025-12-04T08:48:48.1422820Z  2025-12-04T08:48:48.1423439Z class UserOptins(dict[str, list[str]]): 2025-12-04T08:48:48.1424030Z  """ 2025-12-04T08:48:48.1424636Z  Dictionary of users with a list of features they have opted into 2025-12-04T08:48:48.1425349Z  """ 2025-12-04T08:48:48.1425756Z  2025-12-04T08:48:48.1426132Z  2025-12-04T08:48:48.1427022Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T08:48:48.1427763Z  """ 2025-12-04T08:48:48.1428582Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-12-04T08:48:48.1429482Z  2025-12-04T08:48:48.1430367Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T08:48:48.1431455Z  - Example line: "@User1,lf,split_build" 2025-12-04T08:48:48.1432385Z  - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T08:48:48.1433089Z  2025-12-04T08:48:48.1433466Z  2025-12-04T08:48:48.1433859Z  """ 2025-12-04T08:48:48.1434302Z  optins = UserOptins() 2025-12-04T08:48:48.1434898Z  for user in user_optin_text.split("\n"): 2025-12-04T08:48:48.1435538Z  user = user.strip("\r\n\t -") 2025-12-04T08:48:48.1436178Z  if not user or not user.startswith("@"): 2025-12-04T08:48:48.1437437Z  # Not a valid user. Skip 2025-12-04T08:48:48.1438006Z  continue 2025-12-04T08:48:48.1438486Z  2025-12-04T08:48:48.1438885Z  if user: 2025-12-04T08:48:48.1439438Z  usr_name = user.split(",")[0].strip("@") 2025-12-04T08:48:48.1440239Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T08:48:48.1440999Z  2025-12-04T08:48:48.1441424Z  return optins 2025-12-04T08:48:48.1441900Z  2025-12-04T08:48:48.1442289Z  2025-12-04T08:48:48.1442855Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T08:48:48.1443540Z  """ 2025-12-04T08:48:48.1444025Z  Check if the experiment name is valid. 2025-12-04T08:48:48.1444614Z  A valid name: 2025-12-04T08:48:48.1445370Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T08:48:48.1446529Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T08:48:48.1447323Z  - Cannot contain spaces 2025-12-04T08:48:48.1447856Z  """ 2025-12-04T08:48:48.1448264Z  2025-12-04T08:48:48.1448794Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T08:48:48.1449600Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T08:48:48.1450398Z  2025-12-04T08:48:48.1450808Z  if valid: 2025-12-04T08:48:48.1451281Z  return True 2025-12-04T08:48:48.1451752Z  2025-12-04T08:48:48.1452154Z  log.error( 2025-12-04T08:48:48.1453714Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-12-04T08:48:48.1455331Z  ) 2025-12-04T08:48:48.1455758Z  return False 2025-12-04T08:48:48.1456326Z  2025-12-04T08:48:48.1456714Z  2025-12-04T08:48:48.1457296Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T08:48:48.1458016Z  """ 2025-12-04T08:48:48.1458702Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T08:48:48.1459489Z  """ 2025-12-04T08:48:48.1459914Z  try: 2025-12-04T08:48:48.1460364Z  if settings_text: 2025-12-04T08:48:48.1461205Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T08:48:48.1462071Z  # for easy reading 2025-12-04T08:48:48.1462985Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T08:48:48.1463964Z  # the backtick character in shell commands. 2025-12-04T08:48:48.1464658Z  backtick = chr(96) # backtick character 2025-12-04T08:48:48.1465425Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T08:48:48.1466168Z  settings = load_yaml(settings_text) 2025-12-04T08:48:48.1466847Z  2025-12-04T08:48:48.1467524Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T08:48:48.1468473Z  experiments = {} 2025-12-04T08:48:48.1468998Z  2025-12-04T08:48:48.1469633Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T08:48:48.1470486Z  if not is_valid_experiment_name(exp_name): 2025-12-04T08:48:48.1471689Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-12-04T08:48:48.1472824Z  continue 2025-12-04T08:48:48.1473339Z  2025-12-04T08:48:48.1473777Z  valid_settings = {} 2025-12-04T08:48:48.1474389Z  for setting in exp_settings: 2025-12-04T08:48:48.1475042Z  if setting not in Experiment._fields: 2025-12-04T08:48:48.1475686Z  log.warning( 2025-12-04T08:48:48.1476611Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T08:48:48.1477439Z  ) 2025-12-04T08:48:48.1477961Z  else: 2025-12-04T08:48:48.1478578Z  valid_settings[setting] = exp_settings[setting] 2025-12-04T08:48:48.1479217Z  2025-12-04T08:48:48.1479759Z  experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T08:48:48.1480473Z  return Settings(experiments) 2025-12-04T08:48:48.1481038Z  2025-12-04T08:48:48.1481454Z  except Exception: 2025-12-04T08:48:48.1482045Z  log.exception("Failed to parse settings") 2025-12-04T08:48:48.1482644Z  2025-12-04T08:48:48.1483052Z  return Settings() 2025-12-04T08:48:48.1483536Z  2025-12-04T08:48:48.1483927Z  2025-12-04T08:48:48.1485091Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T08:48:48.1485751Z  """ 2025-12-04T08:48:48.1486371Z  Parse settings, if any, from the rollout state. 2025-12-04T08:48:48.1486997Z  2025-12-04T08:48:48.1487611Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T08:48:48.1488460Z  and the text below is the list of opted in users. 2025-12-04T08:48:48.1489079Z  2025-12-04T08:48:48.1489759Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T08:48:48.1490547Z  """ 2025-12-04T08:48:48.1491195Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:48:48.1492048Z  return parse_settings_from_text(settings_text) 2025-12-04T08:48:48.1492652Z  2025-12-04T08:48:48.1493037Z  2025-12-04T08:48:48.1493563Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T08:48:48.1494194Z  """ 2025-12-04T08:48:48.1494672Z  Parse users from the rollout state. 2025-12-04T08:48:48.1495236Z  2025-12-04T08:48:48.1495628Z  """ 2025-12-04T08:48:48.1496342Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:48:48.1497182Z  return parse_user_opt_in_from_text(users_text) 2025-12-04T08:48:48.1497791Z  2025-12-04T08:48:48.1498178Z  2025-12-04T08:48:48.1498873Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:48:48.1499683Z  """ 2025-12-04T08:48:48.1500193Z  Check if a user is opted into an experiment 2025-12-04T08:48:48.1500791Z  """ 2025-12-04T08:48:48.1501350Z  return experiment_name in user_optins.get(user, []) 2025-12-04T08:48:48.1501989Z  2025-12-04T08:48:48.1502563Z  2025-12-04T08:48:48.1503268Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:48:48.1504095Z  """ 2025-12-04T08:48:48.1504653Z  Check if a user explicitly opted out of an experiment 2025-12-04T08:48:48.1505301Z  """ 2025-12-04T08:48:48.1505913Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T08:48:48.1506813Z  experiment_optout = "-" + experiment_name 2025-12-04T08:48:48.1507554Z  if experiment_optout not in user_optins.get(user, []): 2025-12-04T08:48:48.1508225Z  return False 2025-12-04T08:48:48.1508709Z  2025-12-04T08:48:48.1509246Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T08:48:48.1509918Z  log.warning( 2025-12-04T08:48:48.1510840Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T08:48:48.1511783Z  ) 2025-12-04T08:48:48.1512208Z  2025-12-04T08:48:48.1512603Z  return True 2025-12-04T08:48:48.1513063Z  2025-12-04T08:48:48.1513452Z  2025-12-04T08:48:48.1513861Z def get_runner_prefix( 2025-12-04T08:48:48.1514392Z  rollout_state: str, 2025-12-04T08:48:48.1514951Z  workflow_requestors: Iterable[str], 2025-12-04T08:48:48.1515544Z  branch: str, 2025-12-04T08:48:48.1516140Z  eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T08:48:48.1517020Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T08:48:48.1517686Z  is_canary: bool = False, 2025-12-04T08:48:48.1518217Z ) -> str: 2025-12-04T08:48:48.1518744Z  settings = parse_settings(rollout_state) 2025-12-04T08:48:48.1519417Z  user_optins = parse_users(rollout_state) 2025-12-04T08:48:48.1520008Z  2025-12-04T08:48:48.1520540Z  fleet_prefix = "" 2025-12-04T08:48:48.1521061Z  prefixes = [] 2025-12-04T08:48:48.1521809Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T08:48:48.1522859Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T08:48:48.1523654Z  log.info( 2025-12-04T08:48:48.1524444Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T08:48:48.1525279Z  ) 2025-12-04T08:48:48.1525790Z  continue 2025-12-04T08:48:48.1526369Z  2025-12-04T08:48:48.1526803Z  if opt_out_experiments: 2025-12-04T08:48:48.1527435Z  if experiment_name in opt_out_experiments: 2025-12-04T08:48:48.1528186Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T08:48:48.1528860Z  log.info( 2025-12-04T08:48:48.1529900Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T08:48:48.1530953Z  ) 2025-12-04T08:48:48.1531440Z  continue 2025-12-04T08:48:48.1531949Z  2025-12-04T08:48:48.1532409Z  if eligible_experiments: 2025-12-04T08:48:48.1533074Z  if experiment_name not in eligible_experiments: 2025-12-04T08:48:48.1533791Z  exp_list = ", ".join(eligible_experiments) 2025-12-04T08:48:48.1534413Z  log.info( 2025-12-04T08:48:48.1535303Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T08:48:48.1536297Z  ) 2025-12-04T08:48:48.1536784Z  continue 2025-12-04T08:48:48.1537497Z  elif not experiment_settings.default: 2025-12-04T08:48:48.1538095Z  log.info( 2025-12-04T08:48:48.1538859Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T08:48:48.1539662Z  ) 2025-12-04T08:48:48.1540121Z  continue 2025-12-04T08:48:48.1540590Z  2025-12-04T08:48:48.1541125Z  # Is any workflow_requestor opted out to this experiment? 2025-12-04T08:48:48.1541809Z  opted_out_users = [ 2025-12-04T08:48:48.1542344Z  requestor 2025-12-04T08:48:48.1542902Z  for requestor in workflow_requestors 2025-12-04T08:48:48.1543673Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T08:48:48.1544372Z  ] 2025-12-04T08:48:48.1544795Z  2025-12-04T08:48:48.1545223Z  if opted_out_users: 2025-12-04T08:48:48.1545787Z  log.info( 2025-12-04T08:48:48.1546627Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T08:48:48.1547394Z  ) 2025-12-04T08:48:48.1547866Z  continue 2025-12-04T08:48:48.1548345Z  2025-12-04T08:48:48.1548878Z  # Is any workflow_requestor opted in to this experiment? 2025-12-04T08:48:48.1549567Z  opted_in_users = [ 2025-12-04T08:48:48.1550116Z  requestor 2025-12-04T08:48:48.1550682Z  for requestor in workflow_requestors 2025-12-04T08:48:48.1551444Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T08:48:48.1552137Z  ] 2025-12-04T08:48:48.1552561Z  2025-12-04T08:48:48.1552978Z  enabled = False 2025-12-04T08:48:48.1553509Z  if opted_in_users: 2025-12-04T08:48:48.1554171Z  log.info( 2025-12-04T08:48:48.1554905Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T08:48:48.1555650Z  ) 2025-12-04T08:48:48.1556130Z  enabled = True 2025-12-04T08:48:48.1556821Z  2025-12-04T08:48:48.1557299Z  elif experiment_settings.rollout_perc: 2025-12-04T08:48:48.1558241Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T08:48:48.1559275Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T08:48:48.1560001Z  log.info( 2025-12-04T08:48:48.1560975Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T08:48:48.1561968Z  ) 2025-12-04T08:48:48.1562476Z  enabled = True 2025-12-04T08:48:48.1563017Z  2025-12-04T08:48:48.1563426Z  if enabled: 2025-12-04T08:48:48.1563953Z  label = experiment_name 2025-12-04T08:48:48.1564600Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T08:48:48.1565528Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T08:48:48.1566604Z  # - If it's enabled, then we always list it's prefix first 2025-12-04T08:48:48.1567482Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T08:48:48.1568231Z  if is_canary: 2025-12-04T08:48:48.1568818Z  label += CANARY_FLEET_SUFFIX 2025-12-04T08:48:48.1569444Z  fleet_prefix = label 2025-12-04T08:48:48.1570011Z  else: 2025-12-04T08:48:48.1570680Z  prefixes.append(label) 2025-12-04T08:48:48.1571253Z  2025-12-04T08:48:48.1571663Z  if len(prefixes) > 1: 2025-12-04T08:48:48.1572198Z  log.error( 2025-12-04T08:48:48.1573356Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-12-04T08:48:48.1574538Z  ) 2025-12-04T08:48:48.1575008Z  prefixes = prefixes[:1] 2025-12-04T08:48:48.1575544Z  2025-12-04T08:48:48.1575975Z  # Fleet always comes first 2025-12-04T08:48:48.1576649Z  if fleet_prefix: 2025-12-04T08:48:48.1577226Z  prefixes.insert(0, fleet_prefix) 2025-12-04T08:48:48.1577804Z  2025-12-04T08:48:48.1578310Z  return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T08:48:48.1578955Z  2025-12-04T08:48:48.1579345Z  2025-12-04T08:48:48.1580069Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T08:48:48.1580900Z  """ 2025-12-04T08:48:48.1581575Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T08:48:48.1582350Z  2025-12-04T08:48:48.1582988Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T08:48:48.1583754Z  """ 2025-12-04T08:48:48.1584229Z  gh = get_gh_client(github_token) 2025-12-04T08:48:48.1584864Z  issue = get_issue(gh, repo, issue_num) 2025-12-04T08:48:48.1585591Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T08:48:48.1586350Z  2025-12-04T08:48:48.1586747Z  2025-12-04T08:48:48.1587498Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T08:48:48.1588470Z  for _ in range(num_retries): 2025-12-04T08:48:48.1589038Z  try: 2025-12-04T08:48:48.1589552Z  req = Request(url=url, headers=headers) 2025-12-04T08:48:48.1590301Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T08:48:48.1591033Z  return json.loads(content) 2025-12-04T08:48:48.1591635Z  except Exception as e: 2025-12-04T08:48:48.1592276Z  log.warning(f"Could not download {url}: {e}") 2025-12-04T08:48:48.1592897Z  2025-12-04T08:48:48.1593544Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T08:48:48.1594396Z  return {} 2025-12-04T08:48:48.1594848Z  2025-12-04T08:48:48.1595237Z  2025-12-04T08:48:48.1595621Z @cache 2025-12-04T08:48:48.1596437Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T08:48:48.1597292Z  """ 2025-12-04T08:48:48.1597763Z  Dynamically get PR information 2025-12-04T08:48:48.1598330Z  """ 2025-12-04T08:48:48.1598918Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T08:48:48.1599619Z  headers = { 2025-12-04T08:48:48.1600173Z  "Accept": "application/vnd.github.v3+json", 2025-12-04T08:48:48.1600866Z  "Authorization": f"token {github_token}", 2025-12-04T08:48:48.1601467Z  } 2025-12-04T08:48:48.1601977Z  json_response: dict[str, Any] = download_json( 2025-12-04T08:48:48.1602666Z  url=f"{github_api}/issues/{pr_number}", 2025-12-04T08:48:48.1603276Z  headers=headers, 2025-12-04T08:48:48.1603782Z  ) 2025-12-04T08:48:48.1604191Z  2025-12-04T08:48:48.1604618Z  if not json_response: 2025-12-04T08:48:48.1605298Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T08:48:48.1606163Z  return {} 2025-12-04T08:48:48.1606740Z  2025-12-04T08:48:48.1607158Z  return json_response 2025-12-04T08:48:48.1607667Z  2025-12-04T08:48:48.1608050Z  2025-12-04T08:48:48.1608712Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T08:48:48.1609506Z  """ 2025-12-04T08:48:48.1610132Z  Dynamically get the latest list of labels from the pull request 2025-12-04T08:48:48.1610853Z  """ 2025-12-04T08:48:48.1611421Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T08:48:48.1612105Z  return { 2025-12-04T08:48:48.1612791Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T08:48:48.1613548Z  } 2025-12-04T08:48:48.1613953Z  2025-12-04T08:48:48.1614350Z  2025-12-04T08:48:48.1614758Z def main() -> None: 2025-12-04T08:48:48.1615271Z  args = parse_args() 2025-12-04T08:48:48.1615777Z  2025-12-04T08:48:48.1616351Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T08:48:48.1616960Z  2025-12-04T08:48:48.1617388Z  # Check if the PR is opt-out 2025-12-04T08:48:48.1617967Z  if args.pr_number: 2025-12-04T08:48:48.1618740Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T08:48:48.1619571Z  if OPT_OUT_LABEL in labels: 2025-12-04T08:48:48.1620135Z  log.info( 2025-12-04T08:48:48.1620945Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T08:48:48.1621777Z  ) 2025-12-04T08:48:48.1622432Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:48:48.1623182Z  sys.exit() 2025-12-04T08:48:48.1623792Z  2025-12-04T08:48:48.1624205Z  try: 2025-12-04T08:48:48.1624737Z  rollout_state = get_rollout_state_from_issue( 2025-12-04T08:48:48.1625548Z  args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T08:48:48.1626352Z  ) 2025-12-04T08:48:48.1626786Z  2025-12-04T08:48:48.1627247Z  username = get_potential_pr_author( 2025-12-04T08:48:48.1627853Z  args.github_token, 2025-12-04T08:48:48.1628418Z  args.github_repo, 2025-12-04T08:48:48.1628985Z  args.github_actor, 2025-12-04T08:48:48.1629567Z  args.github_ref_type, 2025-12-04T08:48:48.1630145Z  args.github_branch, 2025-12-04T08:48:48.1630681Z  ) 2025-12-04T08:48:48.1631109Z  2025-12-04T08:48:48.1631661Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T08:48:48.1632335Z  2025-12-04T08:48:48.1632800Z  runner_label_prefix = get_runner_prefix( 2025-12-04T08:48:48.1633413Z  rollout_state, 2025-12-04T08:48:48.1633990Z  (args.github_issue_owner, username), 2025-12-04T08:48:48.1634602Z  args.github_branch, 2025-12-04T08:48:48.1635192Z  args.eligible_experiments, 2025-12-04T08:48:48.1635800Z  args.opt_out_experiments, 2025-12-04T08:48:48.1636464Z  is_canary, 2025-12-04T08:48:48.1636957Z  ) 2025-12-04T08:48:48.1637379Z  2025-12-04T08:48:48.1637796Z  except Exception as e: 2025-12-04T08:48:48.1638334Z  log.error( 2025-12-04T08:48:48.1639124Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T08:48:48.1639939Z  ) 2025-12-04T08:48:48.1640506Z  2025-12-04T08:48:48.1641113Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:48:48.1641833Z  2025-12-04T08:48:48.1642214Z  2025-12-04T08:48:48.1642634Z if __name__ == "__main__": 2025-12-04T08:48:48.1643152Z  main() 2025-12-04T08:48:48.1643584Z  2025-12-04T08:48:48.1643967Z EOF 2025-12-04T08:48:48.1644361Z  2025-12-04T08:48:48.1644789Z cat runner_determinator.py 2025-12-04T08:48:48.2013781Z shell: /usr/bin/bash -e {0} 2025-12-04T08:48:48.2014699Z env: 2025-12-04T08:48:48.2015489Z GITHUB_TOKEN: *** 2025-12-04T08:48:48.2015977Z ISSUE_NUMBER: 5132 2025-12-04T08:48:48.2016709Z TRIGGERING_ACTOR: huydhn 2025-12-04T08:48:48.2017233Z ISSUE_OWNER: 2025-12-04T08:48:48.2017692Z CHECK_EXPERIMENTS: 2025-12-04T08:48:48.2018178Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:48:48.2018675Z PR_NUMBER: 2025-12-04T08:48:48.2019128Z ##[endgroup] 2025-12-04T08:48:48.2232213Z # flake8: noqa: G004 2025-12-04T08:48:48.2232567Z 2025-12-04T08:48:48.2233031Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T08:48:48.2234015Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T08:48:48.2234861Z # python .github/scripts/update_runner_determinator.py 2025-12-04T08:48:48.2235323Z 2025-12-04T08:48:48.2235490Z """ 2025-12-04T08:48:48.2236101Z This runner determinator is used to determine which set of runners to run a 2025-12-04T08:48:48.2237332Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T08:48:48.2238298Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T08:48:48.2239134Z of which runners should be used to run which job. 2025-12-04T08:48:48.2239553Z 2025-12-04T08:48:48.2239949Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T08:48:48.2241081Z separated by a line containing "---". If the line is not present, the 2025-12-04T08:48:48.2242012Z settings are considered to be empty with only the second part, the user 2025-12-04T08:48:48.2242734Z list, defined. 2025-12-04T08:48:48.2242972Z 2025-12-04T08:48:48.2243351Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T08:48:48.2244318Z used to define any settings that are needed to determine which runners to use. 2025-12-04T08:48:48.2245173Z It's fields are defined by the RolloutSettings class below. 2025-12-04T08:48:48.2245634Z 2025-12-04T08:48:48.2246019Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T08:48:48.2247247Z The user list is also a comma separated list of additional features or 2025-12-04T08:48:48.2248029Z experiments which the user could be opted in to. 2025-12-04T08:48:48.2248454Z 2025-12-04T08:48:48.2248668Z The user list has the following rules: 2025-12-04T08:48:48.2249045Z 2025-12-04T08:48:48.2249392Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T08:48:48.2250283Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T08:48:48.2251063Z - A "#" prefix opts the user out of all experiments 2025-12-04T08:48:48.2251486Z 2025-12-04T08:48:48.2251668Z Example config: 2025-12-04T08:48:48.2252168Z # A list of experiments that can be opted into. 2025-12-04T08:48:48.2252859Z # This defines the behavior they'll induce when opted into. 2025-12-04T08:48:48.2253510Z # Expected syntax is: 2025-12-04T08:48:48.2254170Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T08:48:48.2255185Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T08:48:48.2255834Z 2025-12-04T08:48:48.2256021Z experiments: 2025-12-04T08:48:48.2256550Z lf: 2025-12-04T08:48:48.2256958Z rollout_percent: 25 2025-12-04T08:48:48.2257459Z all_branches: false 2025-12-04T08:48:48.2258146Z default: true 2025-12-04T08:48:48.2258576Z --- 2025-12-04T08:48:48.2258801Z 2025-12-04T08:48:48.2258975Z # Opt-ins: 2025-12-04T08:48:48.2259587Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T08:48:48.2260533Z # and specifying experiments to enable in a comma-separated list. 2025-12-04T08:48:48.2261347Z # To always opt out of an experiment, prefix it with a "-". 2025-12-04T08:48:48.2262040Z # Experiments should be from the above list. 2025-12-04T08:48:48.2262439Z 2025-12-04T08:48:48.2262637Z @User1,-lf,split_build 2025-12-04T08:48:48.2263098Z @User2,lf 2025-12-04T08:48:48.2263510Z @User3,split_build 2025-12-04T08:48:48.2263943Z """ 2025-12-04T08:48:48.2264157Z 2025-12-04T08:48:48.2264329Z import json 2025-12-04T08:48:48.2264717Z import logging 2025-12-04T08:48:48.2265125Z import os 2025-12-04T08:48:48.2265508Z import random 2025-12-04T08:48:48.2265916Z import re 2025-12-04T08:48:48.2266516Z import sys 2025-12-04T08:48:48.2266970Z from argparse import ArgumentParser 2025-12-04T08:48:48.2267528Z from collections.abc import Iterable 2025-12-04T08:48:48.2268073Z from functools import cache 2025-12-04T08:48:48.2268578Z from logging import LogRecord 2025-12-04T08:48:48.2269095Z from typing import Any, NamedTuple 2025-12-04T08:48:48.2269688Z from urllib.request import Request, urlopen 2025-12-04T08:48:48.2270072Z 2025-12-04T08:48:48.2270248Z import yaml 2025-12-04T08:48:48.2270669Z from github import Auth, Github 2025-12-04T08:48:48.2271180Z from github.Issue import Issue 2025-12-04T08:48:48.2271514Z 2025-12-04T08:48:48.2271521Z 2025-12-04T08:48:48.2271749Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T08:48:48.2272473Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T08:48:48.2273381Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T08:48:48.2273963Z 2025-12-04T08:48:48.2274208Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T08:48:48.2274953Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T08:48:48.2275517Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T08:48:48.2276102Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T08:48:48.2276595Z 2025-12-04T08:48:48.2276806Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T08:48:48.2277157Z 2025-12-04T08:48:48.2277361Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T08:48:48.2277845Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T08:48:48.2278149Z 2025-12-04T08:48:48.2278156Z 2025-12-04T08:48:48.2278360Z class Experiment(NamedTuple): 2025-12-04T08:48:48.2278869Z rollout_perc: float = ( 2025-12-04T08:48:48.2279533Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T08:48:48.2280235Z ) 2025-12-04T08:48:48.2280628Z all_branches: bool = ( 2025-12-04T08:48:48.2281286Z False # If True, the experiment is also enabled on the exception branches 2025-12-04T08:48:48.2281979Z ) 2025-12-04T08:48:48.2282372Z default: bool = ( 2025-12-04T08:48:48.2282973Z True # If True, the experiment is enabled by default for all queries 2025-12-04T08:48:48.2283642Z ) 2025-12-04T08:48:48.2283849Z 2025-12-04T08:48:48.2284048Z # Add more fields as needed 2025-12-04T08:48:48.2284374Z 2025-12-04T08:48:48.2284380Z 2025-12-04T08:48:48.2284577Z class Settings(NamedTuple): 2025-12-04T08:48:48.2285043Z """ 2025-12-04T08:48:48.2285514Z Settings for the experiments that can be opted into. 2025-12-04T08:48:48.2286119Z """ 2025-12-04T08:48:48.2286432Z 2025-12-04T08:48:48.2286658Z experiments: dict[str, Experiment] = {} 2025-12-04T08:48:48.2287050Z 2025-12-04T08:48:48.2287056Z 2025-12-04T08:48:48.2287280Z class ColorFormatter(logging.Formatter): 2025-12-04T08:48:48.2287935Z """Color codes the log messages based on the log level""" 2025-12-04T08:48:48.2288390Z 2025-12-04T08:48:48.2288562Z COLORS = { 2025-12-04T08:48:48.2288991Z "WARNING": "\033[33m", # Yellow 2025-12-04T08:48:48.2289665Z "ERROR": "\033[31m", # Red 2025-12-04T08:48:48.2290233Z "CRITICAL": "\033[31m", # Red 2025-12-04T08:48:48.2290776Z "INFO": "\033[0m", # Reset 2025-12-04T08:48:48.2291288Z "DEBUG": "\033[0m", # Reset 2025-12-04T08:48:48.2291781Z } 2025-12-04T08:48:48.2291992Z 2025-12-04T08:48:48.2292222Z def format(self, record: LogRecord) -> str: 2025-12-04T08:48:48.2293002Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T08:48:48.2293811Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T08:48:48.2294423Z return super().format(record) 2025-12-04T08:48:48.2294772Z 2025-12-04T08:48:48.2294779Z 2025-12-04T08:48:48.2294983Z handler = logging.StreamHandler() 2025-12-04T08:48:48.2295716Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T08:48:48.2296385Z 2025-12-04T08:48:48.2296642Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T08:48:48.2297254Z log.addHandler(handler) 2025-12-04T08:48:48.2297731Z log.setLevel(logging.INFO) 2025-12-04T08:48:48.2298039Z 2025-12-04T08:48:48.2298046Z 2025-12-04T08:48:48.2298301Z def set_github_output(key: str, value: str) -> None: 2025-12-04T08:48:48.2298892Z """ 2025-12-04T08:48:48.2299419Z Defines outputs of the github action that invokes this script 2025-12-04T08:48:48.2300066Z """ 2025-12-04T08:48:48.2300458Z if not GITHUB_OUTPUT: 2025-12-04T08:48:48.2301563Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T08:48:48.2302706Z log.warning( 2025-12-04T08:48:48.2303597Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T08:48:48.2304558Z ) 2025-12-04T08:48:48.2314328Z print(f"::set-output name={key}::{value}") 2025-12-04T08:48:48.2314978Z return 2025-12-04T08:48:48.2315229Z 2025-12-04T08:48:48.2315462Z with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T08:48:48.2316459Z log.info(f"Setting output: {key}='{value}'") 2025-12-04T08:48:48.2317120Z f.write(f"{key}={value}\n") 2025-12-04T08:48:48.2317481Z 2025-12-04T08:48:48.2317489Z 2025-12-04T08:48:48.2317810Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T08:48:48.2318478Z return frozenset( 2025-12-04T08:48:48.2319113Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T08:48:48.2319823Z ) 2025-12-04T08:48:48.2320032Z 2025-12-04T08:48:48.2320039Z 2025-12-04T08:48:48.2320233Z def parse_args() -> Any: 2025-12-04T08:48:48.2320822Z parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T08:48:48.2321736Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T08:48:48.2322535Z parser.add_argument( 2025-12-04T08:48:48.2323024Z "--github-issue-repo", 2025-12-04T08:48:48.2323509Z type=str, 2025-12-04T08:48:48.2323949Z required=False, 2025-12-04T08:48:48.2324418Z default="pytorch/test-infra", 2025-12-04T08:48:48.2324986Z help="GitHub repo to get the issue", 2025-12-04T08:48:48.2325513Z ) 2025-12-04T08:48:48.2325909Z parser.add_argument( 2025-12-04T08:48:48.2326554Z "--github-repo", 2025-12-04T08:48:48.2327025Z type=str, 2025-12-04T08:48:48.2327443Z required=True, 2025-12-04T08:48:48.2327946Z help="GitHub repo where CI is running", 2025-12-04T08:48:48.2328501Z ) 2025-12-04T08:48:48.2328888Z parser.add_argument( 2025-12-04T08:48:48.2329511Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T08:48:48.2330193Z ) 2025-12-04T08:48:48.2330589Z parser.add_argument( 2025-12-04T08:48:48.2331236Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T08:48:48.2331935Z ) 2025-12-04T08:48:48.2332325Z parser.add_argument( 2025-12-04T08:48:48.2333148Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T08:48:48.2333865Z ) 2025-12-04T08:48:48.2334257Z parser.add_argument( 2025-12-04T08:48:48.2334940Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T08:48:48.2335681Z ) 2025-12-04T08:48:48.2336077Z parser.add_argument( 2025-12-04T08:48:48.2336659Z "--github-ref-type", 2025-12-04T08:48:48.2337143Z type=str, 2025-12-04T08:48:48.2337558Z required=True, 2025-12-04T08:48:48.2338069Z help="Current GitHub ref type, branch or tag", 2025-12-04T08:48:48.2338636Z ) 2025-12-04T08:48:48.2339029Z parser.add_argument( 2025-12-04T08:48:48.2339508Z "--eligible-experiments", 2025-12-04T08:48:48.2340051Z type=_str_comma_separated_to_set, 2025-12-04T08:48:48.2340591Z required=False, 2025-12-04T08:48:48.2341020Z default="", 2025-12-04T08:48:48.2341897Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T08:48:48.2391945Z ) 2025-12-04T08:48:48.2392402Z parser.add_argument( 2025-12-04T08:48:48.2392907Z "--opt-out-experiments", 2025-12-04T08:48:48.2393444Z type=_str_comma_separated_to_set, 2025-12-04T08:48:48.2393988Z required=False, 2025-12-04T08:48:48.2394429Z default="", 2025-12-04T08:48:48.2394828Z help=( 2025-12-04T08:48:48.2395539Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T08:48:48.2396845Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T08:48:48.2397704Z ), 2025-12-04T08:48:48.2398067Z ) 2025-12-04T08:48:48.2398451Z parser.add_argument( 2025-12-04T08:48:48.2398902Z "--pr-number", 2025-12-04T08:48:48.2399332Z type=str, 2025-12-04T08:48:48.2399742Z required=False, 2025-12-04T08:48:48.2400198Z default="", 2025-12-04T08:48:48.2400893Z help="the optional PR number where this is run", 2025-12-04T08:48:48.2401482Z ) 2025-12-04T08:48:48.2401688Z 2025-12-04T08:48:48.2401892Z return parser.parse_args() 2025-12-04T08:48:48.2402213Z 2025-12-04T08:48:48.2402220Z 2025-12-04T08:48:48.2402633Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T08:48:48.2403406Z auth = Auth.Token(github_token) 2025-12-04T08:48:48.2403932Z return Github(auth=auth) 2025-12-04T08:48:48.2404235Z 2025-12-04T08:48:48.2404242Z 2025-12-04T08:48:48.2404703Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T08:48:48.2405513Z repo = gh.get_repo(repo) 2025-12-04T08:48:48.2406036Z return repo.get_issue(number=issue_num) 2025-12-04T08:48:48.2406560Z 2025-12-04T08:48:48.2406567Z 2025-12-04T08:48:48.2406772Z def get_potential_pr_author( 2025-12-04T08:48:48.2407443Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T08:48:48.2408154Z ) -> str: 2025-12-04T08:48:48.2408696Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T08:48:48.2409513Z # Fetch the actual username from the original PR. The PR number is 2025-12-04T08:48:48.2410279Z # embedded in the tag name: ciflow// 2025-12-04T08:48:48.2410704Z 2025-12-04T08:48:48.2410897Z gh = get_gh_client(github_token) 2025-12-04T08:48:48.2411245Z 2025-12-04T08:48:48.2411523Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T08:48:48.2412159Z split_tag = ref_name.split("/") 2025-12-04T08:48:48.2412681Z if ( 2025-12-04T08:48:48.2413092Z len(split_tag) == 3 2025-12-04T08:48:48.2413582Z and split_tag[0] == "ciflow" 2025-12-04T08:48:48.2414125Z and split_tag[2].isnumeric() 2025-12-04T08:48:48.2414633Z ): 2025-12-04T08:48:48.2415035Z pr_number = split_tag[2] 2025-12-04T08:48:48.2415670Z try: 2025-12-04T08:48:48.2416122Z repository = gh.get_repo(repo) 2025-12-04T08:48:48.2416877Z pull = repository.get_pull(number=int(pr_number)) 2025-12-04T08:48:48.2417512Z except Exception as e: 2025-12-04T08:48:48.2418054Z raise Exception( # noqa: TRY002 2025-12-04T08:48:48.2418750Z f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T08:48:48.2419407Z ) from e 2025-12-04T08:48:48.2419953Z return pull.user.login # type: ignore[no-any-return] 2025-12-04T08:48:48.2420675Z # In all other cases, return the original input username 2025-12-04T08:48:48.2421274Z return username 2025-12-04T08:48:48.2421534Z 2025-12-04T08:48:48.2421541Z 2025-12-04T08:48:48.2421775Z def is_exception_branch(branch: str) -> bool: 2025-12-04T08:48:48.2422318Z """ 2025-12-04T08:48:48.2422973Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T08:48:48.2423778Z """ 2025-12-04T08:48:48.2424360Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T08:48:48.2424888Z 2025-12-04T08:48:48.2424902Z 2025-12-04T08:48:48.2425111Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T08:48:48.2425615Z try: 2025-12-04T08:48:48.2426010Z data = yaml.safe_load(yaml_text) 2025-12-04T08:48:48.2426625Z return data 2025-12-04T08:48:48.2427055Z except yaml.YAMLError: 2025-12-04T08:48:48.2427554Z log.exception("Error loading YAML") 2025-12-04T08:48:48.2428075Z raise 2025-12-04T08:48:48.2428295Z 2025-12-04T08:48:48.2428301Z 2025-12-04T08:48:48.2428735Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T08:48:48.2429490Z """ 2025-12-04T08:48:48.2430148Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T08:48:48.2430755Z 2025-12-04T08:48:48.2431237Z If the issue body contains "---" then the text above that is the settings 2025-12-04T08:48:48.2432032Z and the text below is the list of opted in users. 2025-12-04T08:48:48.2432447Z 2025-12-04T08:48:48.2432836Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T08:48:48.2433549Z """ 2025-12-04T08:48:48.2434010Z rollout_state_parts = rollout_state.split("---") 2025-12-04T08:48:48.2434645Z if len(rollout_state_parts) >= 2: 2025-12-04T08:48:48.2435267Z return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T08:48:48.2435876Z else: 2025-12-04T08:48:48.2436373Z return "", rollout_state 2025-12-04T08:48:48.2436704Z 2025-12-04T08:48:48.2436712Z 2025-12-04T08:48:48.2436932Z class UserOptins(dict[str, list[str]]): 2025-12-04T08:48:48.2437458Z """ 2025-12-04T08:48:48.2437997Z Dictionary of users with a list of features they have opted into 2025-12-04T08:48:48.2438654Z """ 2025-12-04T08:48:48.2438860Z 2025-12-04T08:48:48.2438873Z 2025-12-04T08:48:48.2439220Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T08:48:48.2439887Z """ 2025-12-04T08:48:48.2440614Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-12-04T08:48:48.2441301Z 2025-12-04T08:48:48.2441935Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T08:48:48.2442943Z - Example line: "@User1,lf,split_build" 2025-12-04T08:48:48.2443649Z - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T08:48:48.2444141Z 2025-12-04T08:48:48.2444147Z 2025-12-04T08:48:48.2444313Z """ 2025-12-04T08:48:48.2444708Z optins = UserOptins() 2025-12-04T08:48:48.2445210Z for user in user_optin_text.split("\n"): 2025-12-04T08:48:48.2445782Z user = user.strip("\r\n\t -") 2025-12-04T08:48:48.2446843Z if not user or not user.startswith("@"): 2025-12-04T08:48:48.2447606Z # Not a valid user. Skip 2025-12-04T08:48:48.2448113Z continue 2025-12-04T08:48:48.2448376Z 2025-12-04T08:48:48.2448547Z if user: 2025-12-04T08:48:48.2449003Z usr_name = user.split(",")[0].strip("@") 2025-12-04T08:48:48.2449726Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T08:48:48.2450233Z 2025-12-04T08:48:48.2450411Z return optins 2025-12-04T08:48:48.2450653Z 2025-12-04T08:48:48.2450660Z 2025-12-04T08:48:48.2450964Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T08:48:48.2451580Z """ 2025-12-04T08:48:48.2451993Z Check if the experiment name is valid. 2025-12-04T08:48:48.2452530Z A valid name: 2025-12-04T08:48:48.2453189Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T08:48:48.2454153Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T08:48:48.2454907Z - Cannot contain spaces 2025-12-04T08:48:48.2455380Z """ 2025-12-04T08:48:48.2455590Z 2025-12-04T08:48:48.2455858Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T08:48:48.2456720Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T08:48:48.2457179Z 2025-12-04T08:48:48.2457344Z if valid: 2025-12-04T08:48:48.2457738Z return True 2025-12-04T08:48:48.2457989Z 2025-12-04T08:48:48.2458162Z log.error( 2025-12-04T08:48:48.2459632Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-12-04T08:48:48.2461247Z ) 2025-12-04T08:48:48.2461625Z return False 2025-12-04T08:48:48.2461872Z 2025-12-04T08:48:48.2461879Z 2025-12-04T08:48:48.2462184Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T08:48:48.2462813Z """ 2025-12-04T08:48:48.2463551Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T08:48:48.2464312Z """ 2025-12-04T08:48:48.2464679Z try: 2025-12-04T08:48:48.2465069Z if settings_text: 2025-12-04T08:48:48.2465798Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T08:48:48.2466719Z # for easy reading 2025-12-04T08:48:48.2467543Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T08:48:48.2468465Z # the backtick character in shell commands. 2025-12-04T08:48:48.2469090Z backtick = chr(96) # backtick character 2025-12-04T08:48:48.2469780Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T08:48:48.2470481Z settings = load_yaml(settings_text) 2025-12-04T08:48:48.2470869Z 2025-12-04T08:48:48.2471284Z # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T08:48:48.2472086Z experiments = {} 2025-12-04T08:48:48.2472400Z 2025-12-04T08:48:48.2472795Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T08:48:48.2473590Z if not is_valid_experiment_name(exp_name): 2025-12-04T08:48:48.2474718Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-12-04T08:48:48.2475774Z continue 2025-12-04T08:48:48.2476077Z 2025-12-04T08:48:48.2476361Z valid_settings = {} 2025-12-04T08:48:48.2476909Z for setting in exp_settings: 2025-12-04T08:48:48.2477502Z if setting not in Experiment._fields: 2025-12-04T08:48:48.2478065Z log.warning( 2025-12-04T08:48:48.2478787Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T08:48:48.2479688Z ) 2025-12-04T08:48:48.2480135Z else: 2025-12-04T08:48:48.2480674Z valid_settings[setting] = exp_settings[setting] 2025-12-04T08:48:48.2481112Z 2025-12-04T08:48:48.2481398Z experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T08:48:48.2482057Z return Settings(experiments) 2025-12-04T08:48:48.2482421Z 2025-12-04T08:48:48.2482606Z except Exception: 2025-12-04T08:48:48.2483097Z log.exception("Failed to parse settings") 2025-12-04T08:48:48.2483491Z 2025-12-04T08:48:48.2483673Z return Settings() 2025-12-04T08:48:48.2483935Z 2025-12-04T08:48:48.2483942Z 2025-12-04T08:48:48.2484198Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T08:48:48.2484785Z """ 2025-12-04T08:48:48.2485247Z Parse settings, if any, from the rollout state. 2025-12-04T08:48:48.2485668Z 2025-12-04T08:48:48.2486025Z If the issue body contains "---" then the text above that is the settings 2025-12-04T08:48:48.2486921Z and the text below is the list of opted in users. 2025-12-04T08:48:48.2487333Z 2025-12-04T08:48:48.2487745Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T08:48:48.2488505Z """ 2025-12-04T08:48:48.2489073Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:48:48.2489859Z return parse_settings_from_text(settings_text) 2025-12-04T08:48:48.2490307Z 2025-12-04T08:48:48.2490313Z 2025-12-04T08:48:48.2490569Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T08:48:48.2491153Z """ 2025-12-04T08:48:48.2491559Z Parse users from the rollout state. 2025-12-04T08:48:48.2491920Z 2025-12-04T08:48:48.2492082Z """ 2025-12-04T08:48:48.2492620Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:48:48.2493373Z return parse_user_opt_in_from_text(users_text) 2025-12-04T08:48:48.2493792Z 2025-12-04T08:48:48.2493803Z 2025-12-04T08:48:48.2494351Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:48:48.2495125Z """ 2025-12-04T08:48:48.2495556Z Check if a user is opted into an experiment 2025-12-04T08:48:48.2496110Z """ 2025-12-04T08:48:48.2496675Z return experiment_name in user_optins.get(user, []) 2025-12-04T08:48:48.2497108Z 2025-12-04T08:48:48.2497115Z 2025-12-04T08:48:48.2497557Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:48:48.2498314Z """ 2025-12-04T08:48:48.2498787Z Check if a user explicitly opted out of an experiment 2025-12-04T08:48:48.2499388Z """ 2025-12-04T08:48:48.2499917Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T08:48:48.2500610Z experiment_optout = "-" + experiment_name 2025-12-04T08:48:48.2501265Z if experiment_optout not in user_optins.get(user, []): 2025-12-04T08:48:48.2501884Z return False 2025-12-04T08:48:48.2502152Z 2025-12-04T08:48:48.2502439Z if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T08:48:48.2503057Z log.warning( 2025-12-04T08:48:48.2503872Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T08:48:48.2504767Z ) 2025-12-04T08:48:48.2504979Z 2025-12-04T08:48:48.2505147Z return True 2025-12-04T08:48:48.2505392Z 2025-12-04T08:48:48.2505399Z 2025-12-04T08:48:48.2505585Z def get_runner_prefix( 2025-12-04T08:48:48.2506043Z rollout_state: str, 2025-12-04T08:48:48.2506624Z workflow_requestors: Iterable[str], 2025-12-04T08:48:48.2507160Z branch: str, 2025-12-04T08:48:48.2507898Z eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T08:48:48.2509080Z opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T08:48:48.2510207Z is_canary: bool = False, 2025-12-04T08:48:48.2511135Z ) -> str: 2025-12-04T08:48:48.2511934Z settings = parse_settings(rollout_state) 2025-12-04T08:48:48.2513067Z user_optins = parse_users(rollout_state) 2025-12-04T08:48:48.2513460Z 2025-12-04T08:48:48.2513643Z fleet_prefix = "" 2025-12-04T08:48:48.2514071Z prefixes = [] 2025-12-04T08:48:48.2514721Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T08:48:48.2515688Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T08:48:48.2516572Z log.info( 2025-12-04T08:48:48.2517268Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T08:48:48.2518045Z ) 2025-12-04T08:48:48.2518434Z continue 2025-12-04T08:48:48.2518691Z 2025-12-04T08:48:48.2518883Z if opt_out_experiments: 2025-12-04T08:48:48.2519425Z if experiment_name in opt_out_experiments: 2025-12-04T08:48:48.2520089Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T08:48:48.2520703Z log.info( 2025-12-04T08:48:48.2521642Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T08:48:48.2522625Z ) 2025-12-04T08:48:48.2523023Z continue 2025-12-04T08:48:48.2523290Z 2025-12-04T08:48:48.2523481Z if eligible_experiments: 2025-12-04T08:48:48.2524070Z if experiment_name not in eligible_experiments: 2025-12-04T08:48:48.2524711Z exp_list = ", ".join(eligible_experiments) 2025-12-04T08:48:48.2525280Z log.info( 2025-12-04T08:48:48.2526067Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T08:48:48.2527018Z ) 2025-12-04T08:48:48.2527434Z continue 2025-12-04T08:48:48.2527908Z elif not experiment_settings.default: 2025-12-04T08:48:48.2528442Z log.info( 2025-12-04T08:48:48.2529242Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T08:48:48.2530017Z ) 2025-12-04T08:48:48.2530397Z continue 2025-12-04T08:48:48.2530654Z 2025-12-04T08:48:48.2530933Z # Is any workflow_requestor opted out to this experiment? 2025-12-04T08:48:48.2531541Z opted_out_users = [ 2025-12-04T08:48:48.2531997Z requestor 2025-12-04T08:48:48.2532460Z for requestor in workflow_requestors 2025-12-04T08:48:48.2533140Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T08:48:48.2533776Z ] 2025-12-04T08:48:48.2533983Z 2025-12-04T08:48:48.2534159Z if opted_out_users: 2025-12-04T08:48:48.2534611Z log.info( 2025-12-04T08:48:48.2535232Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T08:48:48.2535933Z ) 2025-12-04T08:48:48.2536426Z continue 2025-12-04T08:48:48.2536699Z 2025-12-04T08:48:48.2536984Z # Is any workflow_requestor opted in to this experiment? 2025-12-04T08:48:48.2537636Z opted_in_users = [ 2025-12-04T08:48:48.2538089Z requestor 2025-12-04T08:48:48.2538552Z for requestor in workflow_requestors 2025-12-04T08:48:48.2539230Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T08:48:48.2539870Z ] 2025-12-04T08:48:48.2540080Z 2025-12-04T08:48:48.2540261Z enabled = False 2025-12-04T08:48:48.2540702Z if opted_in_users: 2025-12-04T08:48:48.2541148Z log.info( 2025-12-04T08:48:48.2541757Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T08:48:48.2542453Z ) 2025-12-04T08:48:48.2542848Z enabled = True 2025-12-04T08:48:48.2543134Z 2025-12-04T08:48:48.2543358Z elif experiment_settings.rollout_perc: 2025-12-04T08:48:48.2544202Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T08:48:48.2545278Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T08:48:48.2545936Z log.info( 2025-12-04T08:48:48.2546921Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T08:48:48.2547852Z ) 2025-12-04T08:48:48.2548262Z enabled = True 2025-12-04T08:48:48.2548565Z 2025-12-04T08:48:48.2548738Z if enabled: 2025-12-04T08:48:48.2549178Z label = experiment_name 2025-12-04T08:48:48.2549741Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T08:48:48.2550585Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T08:48:48.2551478Z # - If it's enabled, then we always list it's prefix first 2025-12-04T08:48:48.2552248Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T08:48:48.2552939Z if is_canary: 2025-12-04T08:48:48.2553450Z label += CANARY_FLEET_SUFFIX 2025-12-04T08:48:48.2554011Z fleet_prefix = label 2025-12-04T08:48:48.2554516Z else: 2025-12-04T08:48:48.2554954Z prefixes.append(label) 2025-12-04T08:48:48.2555310Z 2025-12-04T08:48:48.2555496Z if len(prefixes) > 1: 2025-12-04T08:48:48.2555950Z log.error( 2025-12-04T08:48:48.2557093Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-12-04T08:48:48.2558217Z ) 2025-12-04T08:48:48.2558605Z prefixes = prefixes[:1] 2025-12-04T08:48:48.2558923Z 2025-12-04T08:48:48.2559121Z # Fleet always comes first 2025-12-04T08:48:48.2559604Z if fleet_prefix: 2025-12-04T08:48:48.2560066Z prefixes.insert(0, fleet_prefix) 2025-12-04T08:48:48.2560434Z 2025-12-04T08:48:48.2560815Z return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T08:48:48.2561255Z 2025-12-04T08:48:48.2561263Z 2025-12-04T08:48:48.2561717Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T08:48:48.2562519Z """ 2025-12-04T08:48:48.2563114Z Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T08:48:48.2563690Z 2025-12-04T08:48:48.2564085Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T08:48:48.2564797Z """ 2025-12-04T08:48:48.2565198Z gh = get_gh_client(github_token) 2025-12-04T08:48:48.2565744Z issue = get_issue(gh, repo, issue_num) 2025-12-04T08:48:48.2566501Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T08:48:48.2566966Z 2025-12-04T08:48:48.2566974Z 2025-12-04T08:48:48.2567381Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T08:48:48.2568158Z for _ in range(num_retries): 2025-12-04T08:48:48.2568644Z try: 2025-12-04T08:48:48.2569060Z req = Request(url=url, headers=headers) 2025-12-04T08:48:48.2569738Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T08:48:48.2570389Z return json.loads(content) 2025-12-04T08:48:48.2570934Z except Exception as e: 2025-12-04T08:48:48.2571478Z log.warning(f"Could not download {url}: {e}") 2025-12-04T08:48:48.2571895Z 2025-12-04T08:48:48.2572283Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T08:48:48.2573006Z return {} 2025-12-04T08:48:48.2573232Z 2025-12-04T08:48:48.2573238Z 2025-12-04T08:48:48.2573396Z @cache 2025-12-04T08:48:48.2574024Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T08:48:48.2574789Z """ 2025-12-04T08:48:48.2575194Z Dynamically get PR information 2025-12-04T08:48:48.2575692Z """ 2025-12-04T08:48:48.2576426Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T08:48:48.2577071Z headers = { 2025-12-04T08:48:48.2577533Z "Accept": "application/vnd.github.v3+json", 2025-12-04T08:48:48.2578153Z "Authorization": f"token {github_token}", 2025-12-04T08:48:48.2578699Z } 2025-12-04T08:48:48.2579142Z json_response: dict[str, Any] = download_json( 2025-12-04T08:48:48.2579747Z url=f"{github_api}/issues/{pr_number}", 2025-12-04T08:48:48.2580298Z headers=headers, 2025-12-04T08:48:48.2580738Z ) 2025-12-04T08:48:48.2580950Z 2025-12-04T08:48:48.2581137Z if not json_response: 2025-12-04T08:48:48.2581728Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T08:48:48.2582353Z return {} 2025-12-04T08:48:48.2582604Z 2025-12-04T08:48:48.2582802Z return json_response 2025-12-04T08:48:48.2583089Z 2025-12-04T08:48:48.2583096Z 2025-12-04T08:48:48.2583508Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T08:48:48.2584261Z """ 2025-12-04T08:48:48.2584798Z Dynamically get the latest list of labels from the pull request 2025-12-04T08:48:48.2585480Z """ 2025-12-04T08:48:48.2585976Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T08:48:48.2586705Z return { 2025-12-04T08:48:48.2587314Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T08:48:48.2588028Z } 2025-12-04T08:48:48.2588241Z 2025-12-04T08:48:48.2588247Z 2025-12-04T08:48:48.2588421Z def main() -> None: 2025-12-04T08:48:48.2588846Z args = parse_args() 2025-12-04T08:48:48.2589121Z 2025-12-04T08:48:48.2589344Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T08:48:48.2589739Z 2025-12-04T08:48:48.2589940Z # Check if the PR is opt-out 2025-12-04T08:48:48.2590486Z if args.pr_number: 2025-12-04T08:48:48.2591164Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T08:48:48.2591941Z if OPT_OUT_LABEL in labels: 2025-12-04T08:48:48.2592581Z log.info( 2025-12-04T08:48:48.2593310Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T08:48:48.2594096Z ) 2025-12-04T08:48:48.2594653Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:48:48.2595337Z sys.exit() 2025-12-04T08:48:48.2595599Z 2025-12-04T08:48:48.2595769Z try: 2025-12-04T08:48:48.2596350Z rollout_state = get_rollout_state_from_issue( 2025-12-04T08:48:48.2597109Z args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T08:48:48.2597760Z ) 2025-12-04T08:48:48.2597979Z 2025-12-04T08:48:48.2598187Z username = get_potential_pr_author( 2025-12-04T08:48:48.2598760Z args.github_token, 2025-12-04T08:48:48.2599252Z args.github_repo, 2025-12-04T08:48:48.2599746Z args.github_actor, 2025-12-04T08:48:48.2600256Z args.github_ref_type, 2025-12-04T08:48:48.2600768Z args.github_branch, 2025-12-04T08:48:48.2601245Z ) 2025-12-04T08:48:48.2601459Z 2025-12-04T08:48:48.2601749Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T08:48:48.2602208Z 2025-12-04T08:48:48.2602432Z runner_label_prefix = get_runner_prefix( 2025-12-04T08:48:48.2603012Z rollout_state, 2025-12-04T08:48:48.2603515Z (args.github_issue_owner, username), 2025-12-04T08:48:48.2604073Z args.github_branch, 2025-12-04T08:48:48.2604592Z args.eligible_experiments, 2025-12-04T08:48:48.2605141Z args.opt_out_experiments, 2025-12-04T08:48:48.2605657Z is_canary, 2025-12-04T08:48:48.2606064Z ) 2025-12-04T08:48:48.2606371Z 2025-12-04T08:48:48.2606568Z except Exception as e: 2025-12-04T08:48:48.2607036Z log.error( 2025-12-04T08:48:48.2607721Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T08:48:48.2608652Z ) 2025-12-04T08:48:48.2608869Z 2025-12-04T08:48:48.2609204Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:48:48.2609712Z 2025-12-04T08:48:48.2609719Z 2025-12-04T08:48:48.2609912Z if __name__ == "__main__": 2025-12-04T08:48:48.2610364Z main() 2025-12-04T08:48:48.2610577Z 2025-12-04T08:48:48.2703384Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T08:48:48.2704306Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T08:48:48.2737607Z shell: /usr/bin/bash -e {0} 2025-12-04T08:48:48.2738117Z env: 2025-12-04T08:48:48.2738751Z GITHUB_TOKEN: *** 2025-12-04T08:48:48.2739178Z ISSUE_NUMBER: 5132 2025-12-04T08:48:48.2739619Z TRIGGERING_ACTOR: huydhn 2025-12-04T08:48:48.2740097Z ISSUE_OWNER: 2025-12-04T08:48:48.2740508Z CHECK_EXPERIMENTS: 2025-12-04T08:48:48.2740946Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:48:48.2741379Z PR_NUMBER: 2025-12-04T08:48:48.2741771Z ##[endgroup] 2025-12-04T08:48:49.0403687Z Defaulting to user installation because normal site-packages is not writeable 2025-12-04T08:48:49.6006680Z Collecting urllib3==1.26.18 2025-12-04T08:48:49.6858851Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-12-04T08:48:49.7198127Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 2.0 MB/s eta 0:00:00 2025-12-04T08:48:49.7432748Z Collecting PyGithub==2.3.0 2025-12-04T08:48:49.7631916Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-12-04T08:48:49.8100431Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-12-04T08:48:49.8323060Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.8 kB) 2025-12-04T08:48:49.8369134Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-12-04T08:48:49.8387451Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-12-04T08:48:49.8403992Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-12-04T08:48:49.8665626Z Collecting Deprecated (from PyGithub==2.3.0) 2025-12-04T08:48:49.8873467Z Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB) 2025-12-04T08:48:49.9106123Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-12-04T08:48:50.0321736Z Collecting cffi>=2.0.0 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T08:48:50.0527482Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-12-04T08:48:50.2107531Z Collecting wrapt<3,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-12-04T08:48:50.2313976Z Downloading wrapt-2.0.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (9.0 kB) 2025-12-04T08:48:50.2513393Z Collecting pycparser (from cffi>=2.0.0->pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T08:48:50.2726735Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-12-04T08:48:50.3143942Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-12-04T08:48:50.3391880Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 6.0 MB/s eta 0:00:00 2025-12-04T08:48:50.3593627Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-12-04T08:48:50.4046106Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 7.9 MB/s eta 0:00:00 2025-12-04T08:48:50.4239403Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-12-04T08:48:50.5106683Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 16.4 MB/s eta 0:00:00 2025-12-04T08:48:50.5303094Z Downloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB) 2025-12-04T08:48:50.5523262Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-12-04T08:48:50.5758659Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 9.7 MB/s eta 0:00:00 2025-12-04T08:48:50.5954232Z Downloading wrapt-2.0.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (121 kB) 2025-12-04T08:48:50.6089436Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.5/121.5 kB 9.8 MB/s eta 0:00:00 2025-12-04T08:48:50.6286844Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-12-04T08:48:50.6555156Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 4.3 MB/s eta 0:00:00 2025-12-04T08:48:50.9545204Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-12-04T08:48:51.4987050Z Successfully installed Deprecated-1.3.1 PyGithub-2.3.0 cffi-2.0.0 pycparser-2.23 pynacl-1.6.1 urllib3-1.26.18 wrapt-2.0.1 2025-12-04T08:48:51.5801395Z ##[group]Run curr_branch="main" 2025-12-04T08:48:51.5801704Z curr_branch="main" 2025-12-04T08:48:51.5801924Z curr_ref_type="branch" 2025-12-04T08:48:51.5802189Z echo "Current branch is '$curr_branch'" 2025-12-04T08:48:51.5802476Z  2025-12-04T08:48:51.5802677Z python3 runner_determinator.py \ 2025-12-04T08:48:51.5802966Z  --github-token "$GITHUB_TOKEN" \ 2025-12-04T08:48:51.5803245Z  --github-issue "$ISSUE_NUMBER" \ 2025-12-04T08:48:51.5803510Z  --github-branch "$curr_branch" \ 2025-12-04T08:48:51.5803771Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-12-04T08:48:51.5804057Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-12-04T08:48:51.5804332Z  --github-ref-type "$curr_ref_type" \ 2025-12-04T08:48:51.5804608Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-12-04T08:48:51.5804911Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-12-04T08:48:51.5805290Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-12-04T08:48:51.5805583Z  --pr-number "${PR_NUMBER}" 2025-12-04T08:48:51.5839395Z shell: /usr/bin/bash -e {0} 2025-12-04T08:48:51.5839625Z env: 2025-12-04T08:48:51.5840177Z GITHUB_TOKEN: *** 2025-12-04T08:48:51.5840382Z ISSUE_NUMBER: 5132 2025-12-04T08:48:51.5840580Z TRIGGERING_ACTOR: huydhn 2025-12-04T08:48:51.5840773Z ISSUE_OWNER: 2025-12-04T08:48:51.5840948Z CHECK_EXPERIMENTS: 2025-12-04T08:48:51.5841146Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:48:51.5841333Z PR_NUMBER: 2025-12-04T08:48:51.5841502Z ##[endgroup] 2025-12-04T08:48:51.5892204Z Current branch is 'main' 2025-12-04T08:48:52.9037590Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-12-04T08:48:52.9038715Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-12-04T08:48:52.9039685Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-12-04T08:48:52.9040403Z INFO : Setting output: label-type='' 2025-12-04T08:48:52.9356412Z Evaluate and set job outputs 2025-12-04T08:48:52.9363037Z Cleaning up orphan processes