2025-03-04T19:47:10.9764689Z Current runner version: '2.322.0' 2025-03-04T19:47:10.9797168Z ##[group]Operating System 2025-03-04T19:47:10.9798298Z Ubuntu 2025-03-04T19:47:10.9798967Z 24.04.2 2025-03-04T19:47:10.9799449Z LTS 2025-03-04T19:47:10.9799914Z ##[endgroup] 2025-03-04T19:47:10.9800499Z ##[group]Runner Image 2025-03-04T19:47:10.9801081Z Image: ubuntu-24.04 2025-03-04T19:47:10.9801593Z Version: 20250223.1.0 2025-03-04T19:47:10.9802644Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250223.1/images/ubuntu/Ubuntu2404-Readme.md 2025-03-04T19:47:10.9804258Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250223.1 2025-03-04T19:47:10.9805129Z ##[endgroup] 2025-03-04T19:47:10.9805745Z ##[group]Runner Image Provisioner 2025-03-04T19:47:10.9806331Z 2.0.422.1 2025-03-04T19:47:10.9806755Z ##[endgroup] 2025-03-04T19:47:10.9808911Z ##[group]GITHUB_TOKEN Permissions 2025-03-04T19:47:10.9811078Z Actions: read 2025-03-04T19:47:10.9811927Z Attestations: read 2025-03-04T19:47:10.9812646Z Checks: read 2025-03-04T19:47:10.9813370Z Contents: read 2025-03-04T19:47:10.9813922Z Deployments: read 2025-03-04T19:47:10.9814497Z Discussions: read 2025-03-04T19:47:10.9814969Z Issues: read 2025-03-04T19:47:10.9815470Z Metadata: read 2025-03-04T19:47:10.9895731Z Packages: read 2025-03-04T19:47:10.9896184Z Pages: read 2025-03-04T19:47:10.9896629Z PullRequests: read 2025-03-04T19:47:10.9897084Z RepositoryProjects: read 2025-03-04T19:47:10.9897587Z SecurityEvents: read 2025-03-04T19:47:10.9898020Z Statuses: read 2025-03-04T19:47:10.9898415Z ##[endgroup] 2025-03-04T19:47:10.9901654Z Secret source: Actions 2025-03-04T19:47:10.9902251Z Prepare workflow directory 2025-03-04T19:47:11.0380278Z Prepare all required actions 2025-03-04T19:47:11.0432546Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (92beda54c8707d476ea8bc193ce79a37653d2e49) 2025-03-04T19:47:11.0437685Z ##[group] Inputs 2025-03-04T19:47:11.0438203Z check_experiments: 2025-03-04T19:47:11.0438701Z triggering_actor: williamwen42 2025-03-04T19:47:11.0439204Z issue_owner: williamwen42 2025-03-04T19:47:11.0439694Z curr_branch: gh/williamwen42/215/head 2025-03-04T19:47:11.0440235Z curr_ref_type: branch 2025-03-04T19:47:11.0440672Z issue_number: 5132 2025-03-04T19:47:11.0441092Z ##[endgroup] 2025-03-04T19:47:11.0441579Z Complete job name: get-label-type / runner-determinator 2025-03-04T19:47:11.1062162Z ##[group]Run cat < runner_determinator.py 2025-03-04T19:47:11.1064002Z cat < runner_determinator.py 2025-03-04T19:47:11.1064616Z # flake8: noqa: G004 2025-03-04T19:47:11.1065080Z  2025-03-04T19:47:11.1065729Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-03-04T19:47:11.1066688Z # must be kept in sync. You can do it easily by running the following command: 2025-03-04T19:47:11.1067512Z # python .github/scripts/update_runner_determinator.py 2025-03-04T19:47:11.1068119Z  2025-03-04T19:47:11.1068501Z """ 2025-03-04T19:47:11.1069111Z This runner determinator is used to determine which set of runners to run a 2025-03-04T19:47:11.1070017Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-03-04T19:47:11.1070984Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-03-04T19:47:11.1071875Z of which runners should be used to run which job. 2025-03-04T19:47:11.1072440Z  2025-03-04T19:47:11.1073045Z The configuration has two parts, the settings and a list of opted-in users, 2025-03-04T19:47:11.1074151Z separated by a line containing "---". If the line is not present, the 2025-03-04T19:47:11.1075063Z settings are considered to be empty with only the second part, the user 2025-03-04T19:47:11.1075778Z list, defined. 2025-03-04T19:47:11.1076194Z  2025-03-04T19:47:11.1076773Z The first part is a YAML block that defines the rollout settings. This can be 2025-03-04T19:47:11.1077969Z used to define any settings that are needed to determine which runners to use. 2025-03-04T19:47:11.1078833Z It's fields are defined by the RolloutSettings class below. 2025-03-04T19:47:11.1079457Z  2025-03-04T19:47:11.1080069Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-03-04T19:47:11.1080977Z The user list is also a comma separated list of additional features or 2025-03-04T19:47:11.1081778Z experiments which the user could be opted in to. 2025-03-04T19:47:11.1082371Z  2025-03-04T19:47:11.1082807Z The user list has the following rules: 2025-03-04T19:47:11.1083600Z  2025-03-04T19:47:11.1084162Z - Users are GitHub usernames, which must start with the @ prefix 2025-03-04T19:47:11.1085040Z - Each user is also a comma-separated list of features/experiments to enable 2025-03-04T19:47:11.1085857Z - A "#" prefix opts the user out of all experiments 2025-03-04T19:47:11.1086428Z  2025-03-04T19:47:11.1086813Z Example config: 2025-03-04T19:47:11.1087330Z  # A list of experiments that can be opted into. 2025-03-04T19:47:11.1088036Z  # This defines the behavior they'll induce when opted into. 2025-03-04T19:47:11.1088677Z  # Expected syntax is: 2025-03-04T19:47:11.1089379Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-03-04T19:47:11.1090365Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-03-04T19:47:11.1091134Z  2025-03-04T19:47:11.1091523Z  experiments: 2025-03-04T19:47:11.1091958Z  lf: 2025-03-04T19:47:11.1092380Z  rollout_percent: 25 2025-03-04T19:47:11.1092892Z  all_branches: false 2025-03-04T19:47:11.1093654Z  default: true 2025-03-04T19:47:11.1094129Z  --- 2025-03-04T19:47:11.1094516Z  2025-03-04T19:47:11.1094878Z  # Opt-ins: 2025-03-04T19:47:11.1095530Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-03-04T19:47:11.1096586Z  # and specifying experiments to enable in a comma-separated list. 2025-03-04T19:47:11.1097407Z  # To always opt out of an experiment, prefix it with a "-". 2025-03-04T19:47:11.1098100Z  # Experiments should be from the above list. 2025-03-04T19:47:11.1098654Z  2025-03-04T19:47:11.1099090Z  @User1,-lf,split_build 2025-03-04T19:47:11.1099572Z  @User2,lf 2025-03-04T19:47:11.1100013Z  @User3,split_build 2025-03-04T19:47:11.1100473Z """ 2025-03-04T19:47:11.1100842Z  2025-03-04T19:47:11.1101206Z import json 2025-03-04T19:47:11.1101626Z import logging 2025-03-04T19:47:11.1102066Z import os 2025-03-04T19:47:11.1102478Z import random 2025-03-04T19:47:11.1102902Z import re 2025-03-04T19:47:11.1103455Z import sys 2025-03-04T19:47:11.1103908Z from argparse import ArgumentParser 2025-03-04T19:47:11.1104489Z from collections.abc import Iterable 2025-03-04T19:47:11.1105043Z from functools import cache 2025-03-04T19:47:11.1105563Z from logging import LogRecord 2025-03-04T19:47:11.1106106Z from typing import Any, NamedTuple 2025-03-04T19:47:11.1106701Z from urllib.request import Request, urlopen 2025-03-04T19:47:11.1107254Z  2025-03-04T19:47:11.1107625Z import yaml 2025-03-04T19:47:11.1108075Z from github import Auth, Github 2025-03-04T19:47:11.1108613Z from github.Issue import Issue 2025-03-04T19:47:11.1109098Z  2025-03-04T19:47:11.1109457Z  2025-03-04T19:47:11.1109902Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-03-04T19:47:11.1110792Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-03-04T19:47:11.1111678Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-03-04T19:47:11.1112390Z  2025-03-04T19:47:11.1112838Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-03-04T19:47:11.1113545Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-03-04T19:47:11.1114113Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-03-04T19:47:11.1114718Z OPT_OUT_LABEL = "no-runner-experiments" 2025-03-04T19:47:11.1115250Z  2025-03-04T19:47:11.1115661Z SETTING_EXPERIMENTS = "experiments" 2025-03-04T19:47:11.1116181Z  2025-03-04T19:47:11.1116569Z LF_FLEET_EXPERIMENT = "lf" 2025-03-04T19:47:11.1117078Z CANARY_FLEET_SUFFIX = ".c" 2025-03-04T19:47:11.1117547Z  2025-03-04T19:47:11.1117895Z  2025-03-04T19:47:11.1118476Z class Experiment(NamedTuple): 2025-03-04T19:47:11.1119182Z  rollout_perc: float = ( 2025-03-04T19:47:11.1119890Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-03-04T19:47:11.1120577Z  ) 2025-03-04T19:47:11.1120979Z  all_branches: bool = ( 2025-03-04T19:47:11.1121671Z  False # If True, the experiment is also enabled on the exception branches 2025-03-04T19:47:11.1122358Z  ) 2025-03-04T19:47:11.1122759Z  default: bool = ( 2025-03-04T19:47:11.1123674Z  True # If True, the experiment is enabled by default for all queries 2025-03-04T19:47:11.1124421Z  ) 2025-03-04T19:47:11.1124790Z  2025-03-04T19:47:11.1125183Z  # Add more fields as needed 2025-03-04T19:47:11.1125680Z  2025-03-04T19:47:11.1126038Z  2025-03-04T19:47:11.1126428Z class Settings(NamedTuple): 2025-03-04T19:47:11.1126924Z  """ 2025-03-04T19:47:11.1127447Z  Settings for the experiments that can be opted into. 2025-03-04T19:47:11.1128043Z  """ 2025-03-04T19:47:11.1128431Z  2025-03-04T19:47:11.1128857Z  experiments: dict[str, Experiment] = {} 2025-03-04T19:47:11.1129386Z  2025-03-04T19:47:11.1129893Z  2025-03-04T19:47:11.1130341Z class ColorFormatter(logging.Formatter): 2025-03-04T19:47:11.1131017Z  """Color codes the log messages based on the log level""" 2025-03-04T19:47:11.1131623Z  2025-03-04T19:47:11.1131982Z  COLORS = { 2025-03-04T19:47:11.1132449Z  "WARNING": "\033[33m", # Yellow 2025-03-04T19:47:11.1132996Z  "ERROR": "\033[31m", # Red 2025-03-04T19:47:11.1133816Z  "CRITICAL": "\033[31m", # Red 2025-03-04T19:47:11.1134364Z  "INFO": "\033[0m", # Reset 2025-03-04T19:47:11.1134887Z  "DEBUG": "\033[0m", # Reset 2025-03-04T19:47:11.1135405Z  } 2025-03-04T19:47:11.1135779Z  2025-03-04T19:47:11.1136213Z  def format(self, record: LogRecord) -> str: 2025-03-04T19:47:11.1136995Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-03-04T19:47:11.1137783Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-03-04T19:47:11.1138383Z  return super().format(record) 2025-03-04T19:47:11.1138896Z  2025-03-04T19:47:11.1139249Z  2025-03-04T19:47:11.1139652Z handler = logging.StreamHandler() 2025-03-04T19:47:11.1140405Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-03-04T19:47:11.1141119Z  2025-03-04T19:47:11.1141595Z log = logging.getLogger(os.path.basename(__file__)) 2025-03-04T19:47:11.1142213Z log.addHandler(handler) 2025-03-04T19:47:11.1142721Z log.setLevel(logging.INFO) 2025-03-04T19:47:11.1143483Z  2025-03-04T19:47:11.1143846Z  2025-03-04T19:47:11.1144337Z def set_github_output(key: str, value: str) -> None: 2025-03-04T19:47:11.1144934Z  """ 2025-03-04T19:47:11.1145486Z  Defines outputs of the github action that invokes this script 2025-03-04T19:47:11.1146131Z  """ 2025-03-04T19:47:11.1146545Z  if not GITHUB_OUTPUT: 2025-03-04T19:47:11.1147634Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-03-04T19:47:11.1148725Z  log.warning( 2025-03-04T19:47:11.1149606Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-03-04T19:47:11.1150512Z  ) 2025-03-04T19:47:11.1150990Z  print(f"::set-output name={key}::{value}") 2025-03-04T19:47:11.1151560Z  return 2025-03-04T19:47:11.1151974Z  2025-03-04T19:47:11.1152385Z  with open(GITHUB_OUTPUT, "a") as f: 2025-03-04T19:47:11.1152990Z  log.info(f"Setting output: {key}='{value}'") 2025-03-04T19:47:11.1153695Z  f.write(f"{key}={value}\n") 2025-03-04T19:47:11.1154193Z  2025-03-04T19:47:11.1154556Z  2025-03-04T19:47:11.1155089Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-03-04T19:47:11.1155749Z  return frozenset( 2025-03-04T19:47:11.1156420Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-03-04T19:47:11.1157096Z  ) 2025-03-04T19:47:11.1157471Z  2025-03-04T19:47:11.1157822Z  2025-03-04T19:47:11.1158203Z def parse_args() -> Any: 2025-03-04T19:47:11.1158815Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-03-04T19:47:11.1159690Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-03-04T19:47:11.1160469Z  parser.add_argument( 2025-03-04T19:47:11.1160970Z  "--github-issue-repo", 2025-03-04T19:47:11.1161479Z  type=str, 2025-03-04T19:47:11.1161942Z  required=False, 2025-03-04T19:47:11.1162572Z  default="pytorch/test-infra", 2025-03-04T19:47:11.1163250Z  help="GitHub repo to get the issue", 2025-03-04T19:47:11.1163785Z  ) 2025-03-04T19:47:11.1164186Z  parser.add_argument( 2025-03-04T19:47:11.1164701Z  "--github-repo", 2025-03-04T19:47:11.1165171Z  type=str, 2025-03-04T19:47:11.1165612Z  required=True, 2025-03-04T19:47:11.1166141Z  help="GitHub repo where CI is running", 2025-03-04T19:47:11.1166681Z  ) 2025-03-04T19:47:11.1167081Z  parser.add_argument( 2025-03-04T19:47:11.1167754Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-03-04T19:47:11.1168410Z  ) 2025-03-04T19:47:11.1168820Z  parser.add_argument( 2025-03-04T19:47:11.1169512Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-03-04T19:47:11.1170196Z  ) 2025-03-04T19:47:11.1170604Z  parser.add_argument( 2025-03-04T19:47:11.1171288Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-03-04T19:47:11.1171976Z  ) 2025-03-04T19:47:11.1172372Z  parser.add_argument( 2025-03-04T19:47:11.1173076Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-03-04T19:47:11.1174051Z  ) 2025-03-04T19:47:11.1174461Z  parser.add_argument( 2025-03-04T19:47:11.1174962Z  "--github-ref-type", 2025-03-04T19:47:11.1175458Z  type=str, 2025-03-04T19:47:11.1176063Z  required=True, 2025-03-04T19:47:11.1176607Z  help="Current GitHub ref type, branch or tag", 2025-03-04T19:47:11.1177174Z  ) 2025-03-04T19:47:11.1177611Z  parser.add_argument( 2025-03-04T19:47:11.1178120Z  "--eligible-experiments", 2025-03-04T19:47:11.1178693Z  type=_str_comma_separated_to_set, 2025-03-04T19:47:11.1179427Z  required=False, 2025-03-04T19:47:11.1180199Z  default="", 2025-03-04T19:47:11.1181716Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-03-04T19:47:11.1183704Z  ) 2025-03-04T19:47:11.1184454Z  parser.add_argument( 2025-03-04T19:47:11.1185425Z  "--pr-number", 2025-03-04T19:47:11.1186334Z  type=str, 2025-03-04T19:47:11.1187165Z  required=False, 2025-03-04T19:47:11.1188047Z  default="", 2025-03-04T19:47:11.1189021Z  help="the optional PR number where this is run", 2025-03-04T19:47:11.1190044Z  ) 2025-03-04T19:47:11.1190692Z  2025-03-04T19:47:11.1191392Z  return parser.parse_args() 2025-03-04T19:47:11.1192272Z  2025-03-04T19:47:11.1192883Z  2025-03-04T19:47:11.1194219Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-03-04T19:47:11.1195667Z  auth = Auth.Token(github_token) 2025-03-04T19:47:11.1196618Z  return Github(auth=auth) 2025-03-04T19:47:11.1197534Z  2025-03-04T19:47:11.1198193Z  2025-03-04T19:47:11.1199442Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-03-04T19:47:11.1200939Z  repo = gh.get_repo(repo) 2025-03-04T19:47:11.1201934Z  return repo.get_issue(number=issue_num) 2025-03-04T19:47:11.1202918Z  2025-03-04T19:47:11.1203752Z  2025-03-04T19:47:11.1204472Z def get_potential_pr_author( 2025-03-04T19:47:11.1205829Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-03-04T19:47:11.1207188Z ) -> str: 2025-03-04T19:47:11.1208542Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-03-04T19:47:11.1210011Z  # Fetch the actual username from the original PR. The PR number is 2025-03-04T19:47:11.1211350Z  # embedded in the tag name: ciflow// 2025-03-04T19:47:11.1212444Z  2025-03-04T19:47:11.1213358Z  gh = get_gh_client(github_token) 2025-03-04T19:47:11.1214314Z  2025-03-04T19:47:11.1215176Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-03-04T19:47:11.1216345Z  split_tag = ref_name.split("/") 2025-03-04T19:47:11.1217331Z  if ( 2025-03-04T19:47:11.1218102Z  len(split_tag) == 3 2025-03-04T19:47:11.1219029Z  and split_tag[0] == "ciflow" 2025-03-04T19:47:11.1220059Z  and split_tag[2].isnumeric() 2025-03-04T19:47:11.1220972Z  ): 2025-03-04T19:47:11.1221834Z  pr_number = split_tag[2] 2025-03-04T19:47:11.1222777Z  try: 2025-03-04T19:47:11.1223916Z  repository = gh.get_repo(repo) 2025-03-04T19:47:11.1225130Z  pull = repository.get_pull(number=int(pr_number)) 2025-03-04T19:47:11.1226304Z  except Exception as e: 2025-03-04T19:47:11.1227322Z  raise Exception( # noqa: TRY002 2025-03-04T19:47:11.1228565Z  f"issue with pull request {pr_number} from repo {repository}" 2025-03-04T19:47:11.1229745Z  ) from e 2025-03-04T19:47:11.1231110Z  return pull.user.login # type: ignore[no-any-return] 2025-03-04T19:47:11.1232486Z  # In all other cases, return the original input username 2025-03-04T19:47:11.1233850Z  return username 2025-03-04T19:47:11.1234677Z  2025-03-04T19:47:11.1235322Z  2025-03-04T19:47:11.1236130Z def is_exception_branch(branch: str) -> bool: 2025-03-04T19:47:11.1237140Z  """ 2025-03-04T19:47:11.1238371Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-03-04T19:47:11.1239781Z  """ 2025-03-04T19:47:11.1240843Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-03-04T19:47:11.1242132Z  2025-03-04T19:47:11.1242771Z  2025-03-04T19:47:11.1243696Z def load_yaml(yaml_text: str) -> Any: 2025-03-04T19:47:11.1244622Z  try: 2025-03-04T19:47:11.1245429Z  data = yaml.safe_load(yaml_text) 2025-03-04T19:47:11.1246439Z  return data 2025-03-04T19:47:11.1247310Z  except yaml.YAMLError: 2025-03-04T19:47:11.1248326Z  log.exception("Error loading YAML") 2025-03-04T19:47:11.1249310Z  raise 2025-03-04T19:47:11.1250113Z  2025-03-04T19:47:11.1250755Z  2025-03-04T19:47:11.1251919Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-03-04T19:47:11.1253535Z  """ 2025-03-04T19:47:11.1254790Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-03-04T19:47:11.1256177Z  2025-03-04T19:47:11.1257146Z  If the issue body contains "---" then the text above that is the settings 2025-03-04T19:47:11.1258529Z  and the text below is the list of opted in users. 2025-03-04T19:47:11.1259546Z  2025-03-04T19:47:11.1260556Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-03-04T19:47:11.1261779Z  """ 2025-03-04T19:47:11.1262598Z  rollout_state_parts = rollout_state.split("---") 2025-03-04T19:47:11.1263888Z  if len(rollout_state_parts) >= 2: 2025-03-04T19:47:11.1265506Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-03-04T19:47:11.1266526Z  else: 2025-03-04T19:47:11.1267183Z  return "", rollout_state 2025-03-04T19:47:11.1268053Z  2025-03-04T19:47:11.1268836Z  2025-03-04T19:47:11.1269566Z class UserOptins(dict[str, list[str]]): 2025-03-04T19:47:11.1270283Z  """ 2025-03-04T19:47:11.1270867Z  Dictionary of users with a list of features they have opted into 2025-03-04T19:47:11.1271527Z  """ 2025-03-04T19:47:11.1271903Z  2025-03-04T19:47:11.1272258Z  2025-03-04T19:47:11.1272820Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-03-04T19:47:11.1273759Z  """ 2025-03-04T19:47:11.1274511Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-03-04T19:47:11.1275332Z  2025-03-04T19:47:11.1276141Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-03-04T19:47:11.1277136Z  - Example line: "@User1,lf,split_build" 2025-03-04T19:47:11.1277841Z  - A "#" prefix indicates the user is opted out of all experiments 2025-03-04T19:47:11.1278470Z  2025-03-04T19:47:11.1278818Z  2025-03-04T19:47:11.1279166Z  """ 2025-03-04T19:47:11.1279568Z  optins = UserOptins() 2025-03-04T19:47:11.1280124Z  for user in user_optin_text.split("\n"): 2025-03-04T19:47:11.1280710Z  user = user.strip("\r\n\t -") 2025-03-04T19:47:11.1281488Z  if not user or not user.startswith("@"): 2025-03-04T19:47:11.1282060Z  # Not a valid user. Skip 2025-03-04T19:47:11.1282571Z  continue 2025-03-04T19:47:11.1283014Z  2025-03-04T19:47:11.1283551Z  if user: 2025-03-04T19:47:11.1284064Z  usr_name = user.split(",")[0].strip("@") 2025-03-04T19:47:11.1284773Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-03-04T19:47:11.1285408Z  2025-03-04T19:47:11.1285777Z  return optins 2025-03-04T19:47:11.1286204Z  2025-03-04T19:47:11.1286562Z  2025-03-04T19:47:11.1287074Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-03-04T19:47:11.1287835Z  """ 2025-03-04T19:47:11.1288287Z  Check if the experiment name is valid. 2025-03-04T19:47:11.1288826Z  A valid name: 2025-03-04T19:47:11.1289525Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-03-04T19:47:11.1290528Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-03-04T19:47:11.1291233Z  - Cannot contain spaces 2025-03-04T19:47:11.1291724Z  """ 2025-03-04T19:47:11.1292110Z  2025-03-04T19:47:11.1292590Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-03-04T19:47:11.1293520Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-03-04T19:47:11.1294131Z  2025-03-04T19:47:11.1294488Z  if valid: 2025-03-04T19:47:11.1294910Z  return True 2025-03-04T19:47:11.1295340Z  2025-03-04T19:47:11.1295695Z  log.error( 2025-03-04T19:47:11.1297097Z  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-03-04T19:47:11.1298543Z  ) 2025-03-04T19:47:11.1298925Z  return False 2025-03-04T19:47:11.1299340Z  2025-03-04T19:47:11.1299682Z  2025-03-04T19:47:11.1300351Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-03-04T19:47:11.1301001Z  """ 2025-03-04T19:47:11.1301620Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-03-04T19:47:11.1302511Z  """ 2025-03-04T19:47:11.1302882Z  try: 2025-03-04T19:47:11.1303442Z  if settings_text: 2025-03-04T19:47:11.1304209Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-03-04T19:47:11.1304980Z  # for easy reading 2025-03-04T19:47:11.1305806Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-03-04T19:47:11.1306772Z  # the backtick character in shell commands. 2025-03-04T19:47:11.1307397Z  backtick = chr(96) # backtick character 2025-03-04T19:47:11.1308087Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-03-04T19:47:11.1308763Z  settings = load_yaml(settings_text) 2025-03-04T19:47:11.1309278Z  2025-03-04T19:47:11.1309886Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-03-04T19:47:11.1310633Z  experiments = {} 2025-03-04T19:47:11.1311105Z  2025-03-04T19:47:11.1311681Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-03-04T19:47:11.1312445Z  if not is_valid_experiment_name(exp_name): 2025-03-04T19:47:11.1313762Z  # 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-03-04T19:47:11.1314952Z  continue 2025-03-04T19:47:11.1315413Z  2025-03-04T19:47:11.1315799Z  valid_settings = {} 2025-03-04T19:47:11.1316352Z  for setting in exp_settings: 2025-03-04T19:47:11.1316949Z  if setting not in Experiment._fields: 2025-03-04T19:47:11.1317515Z  log.warning( 2025-03-04T19:47:11.1318247Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-03-04T19:47:11.1318956Z  ) 2025-03-04T19:47:11.1319430Z  else: 2025-03-04T19:47:11.1319998Z  valid_settings[setting] = exp_settings[setting] 2025-03-04T19:47:11.1320575Z  2025-03-04T19:47:11.1321059Z  experiments[exp_name] = Experiment(**valid_settings) 2025-03-04T19:47:11.1321709Z  return Settings(experiments) 2025-03-04T19:47:11.1322225Z  2025-03-04T19:47:11.1322598Z  except Exception: 2025-03-04T19:47:11.1323316Z  log.exception("Failed to parse settings") 2025-03-04T19:47:11.1323869Z  2025-03-04T19:47:11.1324241Z  return Settings() 2025-03-04T19:47:11.1324678Z  2025-03-04T19:47:11.1325020Z  2025-03-04T19:47:11.1325492Z def parse_settings(rollout_state: str) -> Settings: 2025-03-04T19:47:11.1326066Z  """ 2025-03-04T19:47:11.1326544Z  Parse settings, if any, from the rollout state. 2025-03-04T19:47:11.1327096Z  2025-03-04T19:47:11.1327646Z  If the issue body contains "---" then the text above that is the settings 2025-03-04T19:47:11.1328415Z  and the text below is the list of opted in users. 2025-03-04T19:47:11.1328980Z  2025-03-04T19:47:11.1329572Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-03-04T19:47:11.1330286Z  """ 2025-03-04T19:47:11.1330872Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-04T19:47:11.1331772Z  return parse_settings_from_text(settings_text) 2025-03-04T19:47:11.1332329Z  2025-03-04T19:47:11.1332665Z  2025-03-04T19:47:11.1333234Z def parse_users(rollout_state: str) -> UserOptins: 2025-03-04T19:47:11.1333809Z  """ 2025-03-04T19:47:11.1334243Z  Parse users from the rollout state. 2025-03-04T19:47:11.1334752Z  2025-03-04T19:47:11.1335091Z  """ 2025-03-04T19:47:11.1335661Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-04T19:47:11.1336419Z  return parse_user_opt_in_from_text(users_text) 2025-03-04T19:47:11.1336987Z  2025-03-04T19:47:11.1337334Z  2025-03-04T19:47:11.1337961Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-04T19:47:11.1338694Z  """ 2025-03-04T19:47:11.1339156Z  Check if a user is opted into an experiment 2025-03-04T19:47:11.1339705Z  """ 2025-03-04T19:47:11.1340207Z  return experiment_name in user_optins.get(user, []) 2025-03-04T19:47:11.1340788Z  2025-03-04T19:47:11.1341126Z  2025-03-04T19:47:11.1341748Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-04T19:47:11.1342494Z  """ 2025-03-04T19:47:11.1342989Z  Check if a user explicitly opted out of an experiment 2025-03-04T19:47:11.1343672Z  """ 2025-03-04T19:47:11.1344215Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-03-04T19:47:11.1345046Z  experiment_optout = "-" + experiment_name 2025-03-04T19:47:11.1345707Z  if experiment_optout not in user_optins.get(user, []): 2025-03-04T19:47:11.1346308Z  return False 2025-03-04T19:47:11.1346737Z  2025-03-04T19:47:11.1347221Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-03-04T19:47:11.1347814Z  log.warning( 2025-03-04T19:47:11.1348631Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-03-04T19:47:11.1349476Z  ) 2025-03-04T19:47:11.1349854Z  2025-03-04T19:47:11.1350208Z  return True 2025-03-04T19:47:11.1350617Z  2025-03-04T19:47:11.1350956Z  2025-03-04T19:47:11.1351324Z def get_runner_prefix( 2025-03-04T19:47:11.1351806Z  rollout_state: str, 2025-03-04T19:47:11.1352309Z  workflow_requestors: Iterable[str], 2025-03-04T19:47:11.1352847Z  branch: str, 2025-03-04T19:47:11.1353594Z  eligible_experiments: frozenset[str] = frozenset(), 2025-03-04T19:47:11.1354208Z  is_canary: bool = False, 2025-03-04T19:47:11.1354686Z ) -> str: 2025-03-04T19:47:11.1355150Z  settings = parse_settings(rollout_state) 2025-03-04T19:47:11.1355761Z  user_optins = parse_users(rollout_state) 2025-03-04T19:47:11.1356280Z  2025-03-04T19:47:11.1356654Z  fleet_prefix = "" 2025-03-04T19:47:11.1357116Z  prefixes = [] 2025-03-04T19:47:11.1357785Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-03-04T19:47:11.1358717Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-03-04T19:47:11.1359728Z  log.info( 2025-03-04T19:47:11.1360570Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-03-04T19:47:11.1361404Z  ) 2025-03-04T19:47:11.1361821Z  continue 2025-03-04T19:47:11.1362253Z  2025-03-04T19:47:11.1362666Z  if eligible_experiments: 2025-03-04T19:47:11.1363589Z  if experiment_name not in eligible_experiments: 2025-03-04T19:47:11.1364267Z  exp_list = ", ".join(eligible_experiments) 2025-03-04T19:47:11.1364865Z  log.info( 2025-03-04T19:47:11.1365662Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-03-04T19:47:11.1366478Z  ) 2025-03-04T19:47:11.1366911Z  continue 2025-03-04T19:47:11.1367422Z  elif not experiment_settings.default: 2025-03-04T19:47:11.1367967Z  log.info( 2025-03-04T19:47:11.1368656Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-03-04T19:47:11.1369381Z  ) 2025-03-04T19:47:11.1369795Z  continue 2025-03-04T19:47:11.1370229Z  2025-03-04T19:47:11.1370706Z  # Is any workflow_requestor opted out to this experiment? 2025-03-04T19:47:11.1371333Z  opted_out_users = [ 2025-03-04T19:47:11.1371827Z  requestor 2025-03-04T19:47:11.1372331Z  for requestor in workflow_requestors 2025-03-04T19:47:11.1373018Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-03-04T19:47:11.1373740Z  ] 2025-03-04T19:47:11.1374120Z  2025-03-04T19:47:11.1374492Z  if opted_out_users: 2025-03-04T19:47:11.1374977Z  log.info( 2025-03-04T19:47:11.1375629Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-03-04T19:47:11.1376436Z  ) 2025-03-04T19:47:11.1376839Z  continue 2025-03-04T19:47:11.1377266Z  2025-03-04T19:47:11.1377743Z  # Is any workflow_requestor opted in to this experiment? 2025-03-04T19:47:11.1378356Z  opted_in_users = [ 2025-03-04T19:47:11.1378847Z  requestor 2025-03-04T19:47:11.1379349Z  for requestor in workflow_requestors 2025-03-04T19:47:11.1380023Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-03-04T19:47:11.1380637Z  ] 2025-03-04T19:47:11.1381013Z  2025-03-04T19:47:11.1381371Z  enabled = False 2025-03-04T19:47:11.1381835Z  if opted_in_users: 2025-03-04T19:47:11.1382311Z  log.info( 2025-03-04T19:47:11.1382947Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-03-04T19:47:11.1383734Z  ) 2025-03-04T19:47:11.1384150Z  enabled = True 2025-03-04T19:47:11.1384605Z  2025-03-04T19:47:11.1385019Z  elif experiment_settings.rollout_perc: 2025-03-04T19:47:11.1385861Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-03-04T19:47:11.1386782Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-03-04T19:47:11.1387421Z  log.info( 2025-03-04T19:47:11.1388297Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-03-04T19:47:11.1389179Z  ) 2025-03-04T19:47:11.1389618Z  enabled = True 2025-03-04T19:47:11.1390093Z  2025-03-04T19:47:11.1390458Z  if enabled: 2025-03-04T19:47:11.1390926Z  label = experiment_name 2025-03-04T19:47:11.1391514Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-03-04T19:47:11.1392339Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-03-04T19:47:11.1393446Z  # - If it's enabled, then we always list it's prefix first 2025-03-04T19:47:11.1394227Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-03-04T19:47:11.1458429Z  if is_canary: 2025-03-04T19:47:11.1459546Z  label += CANARY_FLEET_SUFFIX 2025-03-04T19:47:11.1460624Z  fleet_prefix = label 2025-03-04T19:47:11.1461502Z  else: 2025-03-04T19:47:11.1462222Z  prefixes.append(label) 2025-03-04T19:47:11.1462754Z  2025-03-04T19:47:11.1463277Z  if len(prefixes) > 1: 2025-03-04T19:47:11.1463786Z  log.error( 2025-03-04T19:47:11.1464895Z  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-03-04T19:47:11.1465960Z  ) 2025-03-04T19:47:11.1466390Z  prefixes = prefixes[:1] 2025-03-04T19:47:11.1466881Z  2025-03-04T19:47:11.1467273Z  # Fleet always comes first 2025-03-04T19:47:11.1467783Z  if fleet_prefix: 2025-03-04T19:47:11.1468841Z  prefixes.insert(0, fleet_prefix) 2025-03-04T19:47:11.1469679Z  2025-03-04T19:47:11.1470361Z  return ".".join(prefixes) + "." if prefixes else "" 2025-03-04T19:47:11.1471337Z  2025-03-04T19:47:11.1471913Z  2025-03-04T19:47:11.1473023Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-03-04T19:47:11.1474573Z  """ 2025-03-04T19:47:11.1475870Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-03-04T19:47:11.1477101Z  2025-03-04T19:47:11.1478085Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-03-04T19:47:11.1479312Z  """ 2025-03-04T19:47:11.1480040Z  gh = get_gh_client(github_token) 2025-03-04T19:47:11.1481022Z  issue = get_issue(gh, repo, issue_num) 2025-03-04T19:47:11.1482103Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-03-04T19:47:11.1483299Z  2025-03-04T19:47:11.1483892Z  2025-03-04T19:47:11.1484899Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-03-04T19:47:11.1486190Z  for _ in range(num_retries): 2025-03-04T19:47:11.1487026Z  try: 2025-03-04T19:47:11.1487790Z  req = Request(url=url, headers=headers) 2025-03-04T19:47:11.1488944Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-03-04T19:47:11.1490030Z  return json.loads(content) 2025-03-04T19:47:11.1490963Z  except Exception as e: 2025-03-04T19:47:11.1491931Z  log.warning(f"Could not download {url}: {e}") 2025-03-04T19:47:11.1492884Z  2025-03-04T19:47:11.1494007Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-03-04T19:47:11.1495243Z  return {} 2025-03-04T19:47:11.1495933Z  2025-03-04T19:47:11.1496426Z  2025-03-04T19:47:11.1496772Z @cache 2025-03-04T19:47:11.1497436Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-03-04T19:47:11.1498193Z  """ 2025-03-04T19:47:11.1498619Z  Dynamically get PR information 2025-03-04T19:47:11.1499172Z  """ 2025-03-04T19:47:11.1499726Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-03-04T19:47:11.1500363Z  headers = { 2025-03-04T19:47:11.1500862Z  "Accept": "application/vnd.github.v3+json", 2025-03-04T19:47:11.1501487Z  "Authorization": f"token {github_token}", 2025-03-04T19:47:11.1502024Z  } 2025-03-04T19:47:11.1502664Z  json_response: dict[str, Any] = download_json( 2025-03-04T19:47:11.1503750Z  url=f"{github_api}/issues/{pr_number}", 2025-03-04T19:47:11.1504304Z  headers=headers, 2025-03-04T19:47:11.1504760Z  ) 2025-03-04T19:47:11.1505141Z  2025-03-04T19:47:11.1505512Z  if not json_response: 2025-03-04T19:47:11.1506128Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-03-04T19:47:11.1506750Z  return {} 2025-03-04T19:47:11.1507171Z  2025-03-04T19:47:11.1507541Z  return json_response 2025-03-04T19:47:11.1508000Z  2025-03-04T19:47:11.1508342Z  2025-03-04T19:47:11.1508936Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-03-04T19:47:11.1509653Z  """ 2025-03-04T19:47:11.1510206Z  Dynamically get the latest list of labels from the pull request 2025-03-04T19:47:11.1510859Z  """ 2025-03-04T19:47:11.1511368Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-03-04T19:47:11.1511964Z  return { 2025-03-04T19:47:11.1512567Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-03-04T19:47:11.1513567Z  } 2025-03-04T19:47:11.1513939Z  2025-03-04T19:47:11.1514279Z  2025-03-04T19:47:11.1514640Z def main() -> None: 2025-03-04T19:47:11.1515100Z  args = parse_args() 2025-03-04T19:47:11.1515550Z  2025-03-04T19:47:11.1515984Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-03-04T19:47:11.1516666Z  2025-03-04T19:47:11.1517044Z  # Check if the PR is opt-out 2025-03-04T19:47:11.1517557Z  if args.pr_number: 2025-03-04T19:47:11.1518242Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-03-04T19:47:11.1519000Z  if OPT_OUT_LABEL in labels: 2025-03-04T19:47:11.1519510Z  log.info( 2025-03-04T19:47:11.1520238Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-03-04T19:47:11.1520974Z  ) 2025-03-04T19:47:11.1521562Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-04T19:47:11.1522228Z  sys.exit() 2025-03-04T19:47:11.1522667Z  2025-03-04T19:47:11.1523019Z  try: 2025-03-04T19:47:11.1523598Z  rollout_state = get_rollout_state_from_issue( 2025-03-04T19:47:11.1524329Z  args.github_token, args.github_issue_repo, args.github_issue 2025-03-04T19:47:11.1524956Z  ) 2025-03-04T19:47:11.1525333Z  2025-03-04T19:47:11.1525746Z  username = get_potential_pr_author( 2025-03-04T19:47:11.1526288Z  args.github_token, 2025-03-04T19:47:11.1526797Z  args.github_repo, 2025-03-04T19:47:11.1527301Z  args.github_actor, 2025-03-04T19:47:11.1527811Z  args.github_ref_type, 2025-03-04T19:47:11.1528333Z  args.github_branch, 2025-03-04T19:47:11.1528817Z  ) 2025-03-04T19:47:11.1529191Z  2025-03-04T19:47:11.1529676Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-03-04T19:47:11.1530269Z  2025-03-04T19:47:11.1530691Z  runner_label_prefix = get_runner_prefix( 2025-03-04T19:47:11.1531239Z  rollout_state, 2025-03-04T19:47:11.1531763Z  (args.github_issue_owner, username), 2025-03-04T19:47:11.1532317Z  args.github_branch, 2025-03-04T19:47:11.1532841Z  args.eligible_experiments, 2025-03-04T19:47:11.1533460Z  is_canary, 2025-03-04T19:47:11.1534026Z  ) 2025-03-04T19:47:11.1534408Z  2025-03-04T19:47:11.1534777Z  except Exception as e: 2025-03-04T19:47:11.1535256Z  log.error( 2025-03-04T19:47:11.1535955Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-03-04T19:47:11.1536689Z  ) 2025-03-04T19:47:11.1537073Z  2025-03-04T19:47:11.1537598Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-04T19:47:11.1538239Z  2025-03-04T19:47:11.1538582Z  2025-03-04T19:47:11.1538941Z if __name__ == "__main__": 2025-03-04T19:47:11.1539411Z  main() 2025-03-04T19:47:11.1539794Z  2025-03-04T19:47:11.1540137Z EOF 2025-03-04T19:47:11.1540494Z  2025-03-04T19:47:11.1540866Z cat runner_determinator.py 2025-03-04T19:47:11.1850588Z shell: /usr/bin/bash -e {0} 2025-03-04T19:47:11.1851344Z env: 2025-03-04T19:47:11.1851999Z GITHUB_TOKEN: *** 2025-03-04T19:47:11.1852410Z ISSUE_NUMBER: 5132 2025-03-04T19:47:11.1852831Z TRIGGERING_ACTOR: williamwen42 2025-03-04T19:47:11.1853488Z ISSUE_OWNER: williamwen42 2025-03-04T19:47:11.1853946Z CHECK_EXPERIMENTS: 2025-03-04T19:47:11.1854364Z PR_NUMBER: 148205 2025-03-04T19:47:11.1854762Z ##[endgroup] 2025-03-04T19:47:11.2087353Z # flake8: noqa: G004 2025-03-04T19:47:11.2087692Z 2025-03-04T19:47:11.2088117Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-03-04T19:47:11.2089023Z # must be kept in sync. You can do it easily by running the following command: 2025-03-04T19:47:11.2090029Z # python .github/scripts/update_runner_determinator.py 2025-03-04T19:47:11.2090455Z 2025-03-04T19:47:11.2090610Z """ 2025-03-04T19:47:11.2091168Z This runner determinator is used to determine which set of runners to run a 2025-03-04T19:47:11.2091987Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-03-04T19:47:11.2092848Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-03-04T19:47:11.2093870Z of which runners should be used to run which job. 2025-03-04T19:47:11.2094250Z 2025-03-04T19:47:11.2094619Z The configuration has two parts, the settings and a list of opted-in users, 2025-03-04T19:47:11.2095460Z separated by a line containing "---". If the line is not present, the 2025-03-04T19:47:11.2096275Z settings are considered to be empty with only the second part, the user 2025-03-04T19:47:11.2096922Z list, defined. 2025-03-04T19:47:11.2097148Z 2025-03-04T19:47:11.2097484Z The first part is a YAML block that defines the rollout settings. This can be 2025-03-04T19:47:11.2098349Z used to define any settings that are needed to determine which runners to use. 2025-03-04T19:47:11.2099127Z It's fields are defined by the RolloutSettings class below. 2025-03-04T19:47:11.2099540Z 2025-03-04T19:47:11.2099907Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-03-04T19:47:11.2100738Z The user list is also a comma separated list of additional features or 2025-03-04T19:47:11.2101431Z experiments which the user could be opted in to. 2025-03-04T19:47:11.2101821Z 2025-03-04T19:47:11.2102009Z The user list has the following rules: 2025-03-04T19:47:11.2102341Z 2025-03-04T19:47:11.2102637Z - Users are GitHub usernames, which must start with the @ prefix 2025-03-04T19:47:11.2103680Z - Each user is also a comma-separated list of features/experiments to enable 2025-03-04T19:47:11.2104405Z - A "#" prefix opts the user out of all experiments 2025-03-04T19:47:11.2104783Z 2025-03-04T19:47:11.2104946Z Example config: 2025-03-04T19:47:11.2105385Z # A list of experiments that can be opted into. 2025-03-04T19:47:11.2106028Z # This defines the behavior they'll induce when opted into. 2025-03-04T19:47:11.2106624Z # Expected syntax is: 2025-03-04T19:47:11.2107238Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-03-04T19:47:11.2108297Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-03-04T19:47:11.2108880Z 2025-03-04T19:47:11.2109041Z experiments: 2025-03-04T19:47:11.2109413Z lf: 2025-03-04T19:47:11.2109778Z rollout_percent: 25 2025-03-04T19:47:11.2110218Z all_branches: false 2025-03-04T19:47:11.2110641Z default: true 2025-03-04T19:47:11.2111028Z --- 2025-03-04T19:47:11.2111230Z 2025-03-04T19:47:11.2111382Z # Opt-ins: 2025-03-04T19:47:11.2111941Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-03-04T19:47:11.2112754Z # and specifying experiments to enable in a comma-separated list. 2025-03-04T19:47:11.2113863Z # To always opt out of an experiment, prefix it with a "-". 2025-03-04T19:47:11.2114492Z # Experiments should be from the above list. 2025-03-04T19:47:11.2114863Z 2025-03-04T19:47:11.2115035Z @User1,-lf,split_build 2025-03-04T19:47:11.2115461Z @User2,lf 2025-03-04T19:47:11.2115842Z @User3,split_build 2025-03-04T19:47:11.2116233Z """ 2025-03-04T19:47:11.2116421Z 2025-03-04T19:47:11.2116575Z import json 2025-03-04T19:47:11.2116936Z import logging 2025-03-04T19:47:11.2117308Z import os 2025-03-04T19:47:11.2117661Z import random 2025-03-04T19:47:11.2118025Z import re 2025-03-04T19:47:11.2118363Z import sys 2025-03-04T19:47:11.2118749Z from argparse import ArgumentParser 2025-03-04T19:47:11.2119266Z from collections.abc import Iterable 2025-03-04T19:47:11.2119770Z from functools import cache 2025-03-04T19:47:11.2120224Z from logging import LogRecord 2025-03-04T19:47:11.2120687Z from typing import Any, NamedTuple 2025-03-04T19:47:11.2121340Z from urllib.request import Request, urlopen 2025-03-04T19:47:11.2121699Z 2025-03-04T19:47:11.2121856Z import yaml 2025-03-04T19:47:11.2122230Z from github import Auth, Github 2025-03-04T19:47:11.2122692Z from github.Issue import Issue 2025-03-04T19:47:11.2122981Z 2025-03-04T19:47:11.2122986Z 2025-03-04T19:47:11.2123404Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-03-04T19:47:11.2124123Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-03-04T19:47:11.2124931Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-03-04T19:47:11.2125463Z 2025-03-04T19:47:11.2125675Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-03-04T19:47:11.2126211Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-03-04T19:47:11.2126691Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-03-04T19:47:11.2127333Z OPT_OUT_LABEL = "no-runner-experiments" 2025-03-04T19:47:11.2127688Z 2025-03-04T19:47:11.2127874Z SETTING_EXPERIMENTS = "experiments" 2025-03-04T19:47:11.2128205Z 2025-03-04T19:47:11.2128382Z LF_FLEET_EXPERIMENT = "lf" 2025-03-04T19:47:11.2128820Z CANARY_FLEET_SUFFIX = ".c" 2025-03-04T19:47:11.2129094Z 2025-03-04T19:47:11.2129100Z 2025-03-04T19:47:11.2129283Z class Experiment(NamedTuple): 2025-03-04T19:47:11.2129742Z rollout_perc: float = ( 2025-03-04T19:47:11.2130343Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-03-04T19:47:11.2130979Z ) 2025-03-04T19:47:11.2131338Z all_branches: bool = ( 2025-03-04T19:47:11.2131930Z False # If True, the experiment is also enabled on the exception branches 2025-03-04T19:47:11.2132562Z ) 2025-03-04T19:47:11.2133004Z default: bool = ( 2025-03-04T19:47:11.2133682Z True # If True, the experiment is enabled by default for all queries 2025-03-04T19:47:11.2134787Z ) 2025-03-04T19:47:11.2135134Z 2025-03-04T19:47:11.2135330Z # Add more fields as needed 2025-03-04T19:47:11.2135709Z 2025-03-04T19:47:11.2135716Z 2025-03-04T19:47:11.2135911Z class Settings(NamedTuple): 2025-03-04T19:47:11.2136341Z """ 2025-03-04T19:47:11.2136784Z Settings for the experiments that can be opted into. 2025-03-04T19:47:11.2137330Z """ 2025-03-04T19:47:11.2137522Z 2025-03-04T19:47:11.2137733Z experiments: dict[str, Experiment] = {} 2025-03-04T19:47:11.2138083Z 2025-03-04T19:47:11.2138089Z 2025-03-04T19:47:11.2138552Z class ColorFormatter(logging.Formatter): 2025-03-04T19:47:11.2139193Z """Color codes the log messages based on the log level""" 2025-03-04T19:47:11.2139608Z 2025-03-04T19:47:11.2139763Z COLORS = { 2025-03-04T19:47:11.2140151Z "WARNING": "\033[33m", # Yellow 2025-03-04T19:47:11.2140655Z "ERROR": "\033[31m", # Red 2025-03-04T19:47:11.2141129Z "CRITICAL": "\033[31m", # Red 2025-03-04T19:47:11.2141608Z "INFO": "\033[0m", # Reset 2025-03-04T19:47:11.2142069Z "DEBUG": "\033[0m", # Reset 2025-03-04T19:47:11.2142518Z } 2025-03-04T19:47:11.2142716Z 2025-03-04T19:47:11.2142928Z def format(self, record: LogRecord) -> str: 2025-03-04T19:47:11.2143797Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-03-04T19:47:11.2144561Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-03-04T19:47:11.2145113Z return super().format(record) 2025-03-04T19:47:11.2145439Z 2025-03-04T19:47:11.2145445Z 2025-03-04T19:47:11.2145638Z handler = logging.StreamHandler() 2025-03-04T19:47:11.2146306Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-03-04T19:47:11.2146832Z 2025-03-04T19:47:11.2147068Z log = logging.getLogger(os.path.basename(__file__)) 2025-03-04T19:47:11.2147630Z log.addHandler(handler) 2025-03-04T19:47:11.2148062Z log.setLevel(logging.INFO) 2025-03-04T19:47:11.2148336Z 2025-03-04T19:47:11.2148342Z 2025-03-04T19:47:11.2148578Z def set_github_output(key: str, value: str) -> None: 2025-03-04T19:47:11.2149116Z """ 2025-03-04T19:47:11.2149600Z Defines outputs of the github action that invokes this script 2025-03-04T19:47:11.2150323Z """ 2025-03-04T19:47:11.2150677Z if not GITHUB_OUTPUT: 2025-03-04T19:47:11.2151672Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-03-04T19:47:11.2152707Z log.warning( 2025-03-04T19:47:11.2153645Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-03-04T19:47:11.2154533Z ) 2025-03-04T19:47:11.2164679Z print(f"::set-output name={key}::{value}") 2025-03-04T19:47:11.2165268Z return 2025-03-04T19:47:11.2165494Z 2025-03-04T19:47:11.2165684Z with open(GITHUB_OUTPUT, "a") as f: 2025-03-04T19:47:11.2166249Z log.info(f"Setting output: {key}='{value}'") 2025-03-04T19:47:11.2166816Z f.write(f"{key}={value}\n") 2025-03-04T19:47:11.2167136Z 2025-03-04T19:47:11.2167142Z 2025-03-04T19:47:11.2167437Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-03-04T19:47:11.2168062Z return frozenset( 2025-03-04T19:47:11.2168660Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-03-04T19:47:11.2169309Z ) 2025-03-04T19:47:11.2169507Z 2025-03-04T19:47:11.2169513Z 2025-03-04T19:47:11.2169687Z def parse_args() -> Any: 2025-03-04T19:47:11.2170229Z parser = ArgumentParser("Get dynamic rollout settings") 2025-03-04T19:47:11.2171056Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-03-04T19:47:11.2171782Z parser.add_argument( 2025-03-04T19:47:11.2172214Z "--github-issue-repo", 2025-03-04T19:47:11.2172660Z type=str, 2025-03-04T19:47:11.2173044Z required=False, 2025-03-04T19:47:11.2173612Z default="pytorch/test-infra", 2025-03-04T19:47:11.2174127Z help="GitHub repo to get the issue", 2025-03-04T19:47:11.2174608Z ) 2025-03-04T19:47:11.2174963Z parser.add_argument( 2025-03-04T19:47:11.2175384Z "--github-repo", 2025-03-04T19:47:11.2175802Z type=str, 2025-03-04T19:47:11.2176184Z required=True, 2025-03-04T19:47:11.2176617Z help="GitHub repo where CI is running", 2025-03-04T19:47:11.2177117Z ) 2025-03-04T19:47:11.2177471Z parser.add_argument( 2025-03-04T19:47:11.2178229Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-03-04T19:47:11.2179218Z ) 2025-03-04T19:47:11.2179866Z parser.add_argument( 2025-03-04T19:47:11.2180576Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-03-04T19:47:11.2181240Z ) 2025-03-04T19:47:11.2181599Z parser.add_argument( 2025-03-04T19:47:11.2182202Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-03-04T19:47:11.2182859Z ) 2025-03-04T19:47:11.2183398Z parser.add_argument( 2025-03-04T19:47:11.2184082Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-03-04T19:47:11.2184757Z ) 2025-03-04T19:47:11.2185121Z parser.add_argument( 2025-03-04T19:47:11.2185553Z "--github-ref-type", 2025-03-04T19:47:11.2185983Z type=str, 2025-03-04T19:47:11.2186367Z required=True, 2025-03-04T19:47:11.2186833Z help="Current GitHub ref type, branch or tag", 2025-03-04T19:47:11.2187357Z ) 2025-03-04T19:47:11.2187717Z parser.add_argument( 2025-03-04T19:47:11.2188159Z "--eligible-experiments", 2025-03-04T19:47:11.2188647Z type=_str_comma_separated_to_set, 2025-03-04T19:47:11.2189214Z required=False, 2025-03-04T19:47:11.2189608Z default="", 2025-03-04T19:47:11.2190406Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-03-04T19:47:11.2191268Z ) 2025-03-04T19:47:11.2191624Z parser.add_argument( 2025-03-04T19:47:11.2192041Z "--pr-number", 2025-03-04T19:47:11.2192432Z type=str, 2025-03-04T19:47:11.2192817Z required=False, 2025-03-04T19:47:11.2193516Z default="", 2025-03-04T19:47:11.2193974Z help="the optional PR number where this is run", 2025-03-04T19:47:11.2194504Z ) 2025-03-04T19:47:11.2194693Z 2025-03-04T19:47:11.2194871Z return parser.parse_args() 2025-03-04T19:47:11.2195168Z 2025-03-04T19:47:11.2195175Z 2025-03-04T19:47:11.2195560Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-03-04T19:47:11.2196276Z auth = Auth.Token(github_token) 2025-03-04T19:47:11.2196778Z return Github(auth=auth) 2025-03-04T19:47:11.2197079Z 2025-03-04T19:47:11.2197086Z 2025-03-04T19:47:11.2197591Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-03-04T19:47:11.2198352Z repo = gh.get_repo(repo) 2025-03-04T19:47:11.2198833Z return repo.get_issue(number=issue_num) 2025-03-04T19:47:11.2199181Z 2025-03-04T19:47:11.2199188Z 2025-03-04T19:47:11.2199374Z def get_potential_pr_author( 2025-03-04T19:47:11.2199975Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-03-04T19:47:11.2200612Z ) -> str: 2025-03-04T19:47:11.2201106Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-03-04T19:47:11.2201862Z # Fetch the actual username from the original PR. The PR number is 2025-03-04T19:47:11.2202567Z # embedded in the tag name: ciflow// 2025-03-04T19:47:11.2202963Z 2025-03-04T19:47:11.2203245Z gh = get_gh_client(github_token) 2025-03-04T19:47:11.2203579Z 2025-03-04T19:47:11.2203839Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-03-04T19:47:11.2204433Z split_tag = ref_name.split("/") 2025-03-04T19:47:11.2204919Z if ( 2025-03-04T19:47:11.2205294Z len(split_tag) == 3 2025-03-04T19:47:11.2205754Z and split_tag[0] == "ciflow" 2025-03-04T19:47:11.2206254Z and split_tag[2].isnumeric() 2025-03-04T19:47:11.2206719Z ): 2025-03-04T19:47:11.2207089Z pr_number = split_tag[2] 2025-03-04T19:47:11.2207560Z try: 2025-03-04T19:47:11.2207973Z repository = gh.get_repo(repo) 2025-03-04T19:47:11.2208558Z pull = repository.get_pull(number=int(pr_number)) 2025-03-04T19:47:11.2209120Z except Exception as e: 2025-03-04T19:47:11.2209620Z raise Exception( # noqa: TRY002 2025-03-04T19:47:11.2210387Z f"issue with pull request {pr_number} from repo {repository}" 2025-03-04T19:47:11.2211009Z ) from e 2025-03-04T19:47:11.2211520Z return pull.user.login # type: ignore[no-any-return] 2025-03-04T19:47:11.2212176Z # In all other cases, return the original input username 2025-03-04T19:47:11.2212739Z return username 2025-03-04T19:47:11.2212979Z 2025-03-04T19:47:11.2212985Z 2025-03-04T19:47:11.2213385Z def is_exception_branch(branch: str) -> bool: 2025-03-04T19:47:11.2213917Z """ 2025-03-04T19:47:11.2214522Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-03-04T19:47:11.2215255Z """ 2025-03-04T19:47:11.2215769Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-03-04T19:47:11.2216259Z 2025-03-04T19:47:11.2216267Z 2025-03-04T19:47:11.2216450Z def load_yaml(yaml_text: str) -> Any: 2025-03-04T19:47:11.2216920Z try: 2025-03-04T19:47:11.2217303Z data = yaml.safe_load(yaml_text) 2025-03-04T19:47:11.2217793Z return data 2025-03-04T19:47:11.2218189Z except yaml.YAMLError: 2025-03-04T19:47:11.2218655Z log.exception("Error loading YAML") 2025-03-04T19:47:11.2219145Z raise 2025-03-04T19:47:11.2219352Z 2025-03-04T19:47:11.2219358Z 2025-03-04T19:47:11.2219749Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-03-04T19:47:11.2220439Z """ 2025-03-04T19:47:11.2221020Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-03-04T19:47:11.2221589Z 2025-03-04T19:47:11.2221913Z If the issue body contains "---" then the text above that is the settings 2025-03-04T19:47:11.2222766Z and the text below is the list of opted in users. 2025-03-04T19:47:11.2223345Z 2025-03-04T19:47:11.2223746Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-03-04T19:47:11.2224412Z """ 2025-03-04T19:47:11.2224848Z rollout_state_parts = rollout_state.split("---") 2025-03-04T19:47:11.2225416Z if len(rollout_state_parts) >= 2: 2025-03-04T19:47:11.2225990Z return rollout_state_parts[0], rollout_state_parts[1] 2025-03-04T19:47:11.2226550Z else: 2025-03-04T19:47:11.2226922Z return "", rollout_state 2025-03-04T19:47:11.2227216Z 2025-03-04T19:47:11.2227222Z 2025-03-04T19:47:11.2227415Z class UserOptins(dict[str, list[str]]): 2025-03-04T19:47:11.2227899Z """ 2025-03-04T19:47:11.2228394Z Dictionary of users with a list of features they have opted into 2025-03-04T19:47:11.2229005Z """ 2025-03-04T19:47:11.2229199Z 2025-03-04T19:47:11.2229212Z 2025-03-04T19:47:11.2229530Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-03-04T19:47:11.2230146Z """ 2025-03-04T19:47:11.2230811Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-03-04T19:47:11.2231445Z 2025-03-04T19:47:11.2232028Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-03-04T19:47:11.2232950Z - Example line: "@User1,lf,split_build" 2025-03-04T19:47:11.2233717Z - A "#" prefix indicates the user is opted out of all experiments 2025-03-04T19:47:11.2234176Z 2025-03-04T19:47:11.2234184Z 2025-03-04T19:47:11.2234330Z """ 2025-03-04T19:47:11.2234688Z optins = UserOptins() 2025-03-04T19:47:11.2235153Z for user in user_optin_text.split("\n"): 2025-03-04T19:47:11.2235681Z user = user.strip("\r\n\t -") 2025-03-04T19:47:11.2236198Z if not user or not user.startswith("@"): 2025-03-04T19:47:11.2236736Z # Not a valid user. Skip 2025-03-04T19:47:11.2237201Z continue 2025-03-04T19:47:11.2237438Z 2025-03-04T19:47:11.2237596Z if user: 2025-03-04T19:47:11.2238010Z usr_name = user.split(",")[0].strip("@") 2025-03-04T19:47:11.2238799Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-03-04T19:47:11.2239277Z 2025-03-04T19:47:11.2239436Z return optins 2025-03-04T19:47:11.2239672Z 2025-03-04T19:47:11.2239678Z 2025-03-04T19:47:11.2239950Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-03-04T19:47:11.2240959Z """ 2025-03-04T19:47:11.2241496Z Check if the experiment name is valid. 2025-03-04T19:47:11.2242065Z A valid name: 2025-03-04T19:47:11.2242681Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-03-04T19:47:11.2243731Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-03-04T19:47:11.2244465Z - Cannot contain spaces 2025-03-04T19:47:11.2244906Z """ 2025-03-04T19:47:11.2245100Z 2025-03-04T19:47:11.2245351Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-03-04T19:47:11.2246016Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-03-04T19:47:11.2246443Z 2025-03-04T19:47:11.2246597Z if valid: 2025-03-04T19:47:11.2246971Z return True 2025-03-04T19:47:11.2247204Z 2025-03-04T19:47:11.2247371Z log.error( 2025-03-04T19:47:11.2248725Z 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-03-04T19:47:11.2250303Z ) 2025-03-04T19:47:11.2250654Z return False 2025-03-04T19:47:11.2250893Z 2025-03-04T19:47:11.2250898Z 2025-03-04T19:47:11.2251184Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-03-04T19:47:11.2251779Z """ 2025-03-04T19:47:11.2252509Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-03-04T19:47:11.2253294Z """ 2025-03-04T19:47:11.2253635Z try: 2025-03-04T19:47:11.2253997Z if settings_text: 2025-03-04T19:47:11.2254682Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-03-04T19:47:11.2255437Z # for easy reading 2025-03-04T19:47:11.2256186Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-03-04T19:47:11.2257025Z # the backtick character in shell commands. 2025-03-04T19:47:11.2257607Z backtick = chr(96) # backtick character 2025-03-04T19:47:11.2258243Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-03-04T19:47:11.2258868Z settings = load_yaml(settings_text) 2025-03-04T19:47:11.2259215Z 2025-03-04T19:47:11.2259594Z # For now we just load experiments. We can expand this if/when we add more settings 2025-03-04T19:47:11.2260778Z experiments = {} 2025-03-04T19:47:11.2261074Z 2025-03-04T19:47:11.2261412Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-03-04T19:47:11.2262287Z if not is_valid_experiment_name(exp_name): 2025-03-04T19:47:11.2263643Z # 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-03-04T19:47:11.2264646Z continue 2025-03-04T19:47:11.2264922Z 2025-03-04T19:47:11.2265099Z valid_settings = {} 2025-03-04T19:47:11.2265598Z for setting in exp_settings: 2025-03-04T19:47:11.2266137Z if setting not in Experiment._fields: 2025-03-04T19:47:11.2266667Z log.warning( 2025-03-04T19:47:11.2267338Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-03-04T19:47:11.2268018Z ) 2025-03-04T19:47:11.2268430Z else: 2025-03-04T19:47:11.2268920Z valid_settings[setting] = exp_settings[setting] 2025-03-04T19:47:11.2269326Z 2025-03-04T19:47:11.2269581Z experiments[exp_name] = Experiment(**valid_settings) 2025-03-04T19:47:11.2270350Z return Settings(experiments) 2025-03-04T19:47:11.2270702Z 2025-03-04T19:47:11.2270864Z except Exception: 2025-03-04T19:47:11.2271321Z log.exception("Failed to parse settings") 2025-03-04T19:47:11.2271687Z 2025-03-04T19:47:11.2271851Z return Settings() 2025-03-04T19:47:11.2272092Z 2025-03-04T19:47:11.2272098Z 2025-03-04T19:47:11.2272333Z def parse_settings(rollout_state: str) -> Settings: 2025-03-04T19:47:11.2272873Z """ 2025-03-04T19:47:11.2273505Z Parse settings, if any, from the rollout state. 2025-03-04T19:47:11.2273890Z 2025-03-04T19:47:11.2274222Z If the issue body contains "---" then the text above that is the settings 2025-03-04T19:47:11.2274940Z and the text below is the list of opted in users. 2025-03-04T19:47:11.2275314Z 2025-03-04T19:47:11.2275721Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-03-04T19:47:11.2276398Z """ 2025-03-04T19:47:11.2276925Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-04T19:47:11.2277630Z return parse_settings_from_text(settings_text) 2025-03-04T19:47:11.2278019Z 2025-03-04T19:47:11.2278025Z 2025-03-04T19:47:11.2278262Z def parse_users(rollout_state: str) -> UserOptins: 2025-03-04T19:47:11.2278790Z """ 2025-03-04T19:47:11.2279157Z Parse users from the rollout state. 2025-03-04T19:47:11.2279495Z 2025-03-04T19:47:11.2279644Z """ 2025-03-04T19:47:11.2280141Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-04T19:47:11.2280823Z return parse_user_opt_in_from_text(users_text) 2025-03-04T19:47:11.2281198Z 2025-03-04T19:47:11.2281334Z 2025-03-04T19:47:11.2281737Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-04T19:47:11.2282428Z """ 2025-03-04T19:47:11.2282813Z Check if a user is opted into an experiment 2025-03-04T19:47:11.2283499Z """ 2025-03-04T19:47:11.2283948Z return experiment_name in user_optins.get(user, []) 2025-03-04T19:47:11.2284343Z 2025-03-04T19:47:11.2284357Z 2025-03-04T19:47:11.2284755Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-04T19:47:11.2285458Z """ 2025-03-04T19:47:11.2285897Z Check if a user explicitly opted out of an experiment 2025-03-04T19:47:11.2286438Z """ 2025-03-04T19:47:11.2286922Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-03-04T19:47:11.2287566Z experiment_optout = "-" + experiment_name 2025-03-04T19:47:11.2288167Z if experiment_optout not in user_optins.get(user, []): 2025-03-04T19:47:11.2288723Z return False 2025-03-04T19:47:11.2288971Z 2025-03-04T19:47:11.2289222Z if is_user_opted_in(user, user_optins, experiment_name): 2025-03-04T19:47:11.2289789Z log.warning( 2025-03-04T19:47:11.2290537Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-03-04T19:47:11.2291348Z ) 2025-03-04T19:47:11.2291550Z 2025-03-04T19:47:11.2291710Z return True 2025-03-04T19:47:11.2291931Z 2025-03-04T19:47:11.2291937Z 2025-03-04T19:47:11.2292109Z def get_runner_prefix( 2025-03-04T19:47:11.2292523Z rollout_state: str, 2025-03-04T19:47:11.2292965Z workflow_requestors: Iterable[str], 2025-03-04T19:47:11.2293618Z branch: str, 2025-03-04T19:47:11.2294077Z eligible_experiments: frozenset[str] = frozenset(), 2025-03-04T19:47:11.2294645Z is_canary: bool = False, 2025-03-04T19:47:11.2295066Z ) -> str: 2025-03-04T19:47:11.2295460Z settings = parse_settings(rollout_state) 2025-03-04T19:47:11.2295999Z user_optins = parse_users(rollout_state) 2025-03-04T19:47:11.2296352Z 2025-03-04T19:47:11.2296523Z fleet_prefix = "" 2025-03-04T19:47:11.2296921Z prefixes = [] 2025-03-04T19:47:11.2297498Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-03-04T19:47:11.2298371Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-03-04T19:47:11.2299183Z log.info( 2025-03-04T19:47:11.2299824Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-03-04T19:47:11.2300526Z ) 2025-03-04T19:47:11.2300882Z continue 2025-03-04T19:47:11.2301126Z 2025-03-04T19:47:11.2301304Z if eligible_experiments: 2025-03-04T19:47:11.2301833Z if experiment_name not in eligible_experiments: 2025-03-04T19:47:11.2302426Z exp_list = ", ".join(eligible_experiments) 2025-03-04T19:47:11.2302946Z log.info( 2025-03-04T19:47:11.2303889Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-03-04T19:47:11.2304679Z ) 2025-03-04T19:47:11.2305064Z continue 2025-03-04T19:47:11.2305518Z elif not experiment_settings.default: 2025-03-04T19:47:11.2306039Z log.info( 2025-03-04T19:47:11.2306681Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-03-04T19:47:11.2307369Z ) 2025-03-04T19:47:11.2307722Z continue 2025-03-04T19:47:11.2307963Z 2025-03-04T19:47:11.2308221Z # Is any workflow_requestor opted out to this experiment? 2025-03-04T19:47:11.2308793Z opted_out_users = [ 2025-03-04T19:47:11.2309220Z requestor 2025-03-04T19:47:11.2309649Z for requestor in workflow_requestors 2025-03-04T19:47:11.2310284Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-03-04T19:47:11.2310868Z ] 2025-03-04T19:47:11.2311063Z 2025-03-04T19:47:11.2311371Z if opted_out_users: 2025-03-04T19:47:11.2311801Z log.info( 2025-03-04T19:47:11.2312383Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-03-04T19:47:11.2313035Z ) 2025-03-04T19:47:11.2313587Z continue 2025-03-04T19:47:11.2313823Z 2025-03-04T19:47:11.2314091Z # Is any workflow_requestor opted in to this experiment? 2025-03-04T19:47:11.2314666Z opted_in_users = [ 2025-03-04T19:47:11.2315080Z requestor 2025-03-04T19:47:11.2315512Z for requestor in workflow_requestors 2025-03-04T19:47:11.2316135Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-03-04T19:47:11.2316716Z ] 2025-03-04T19:47:11.2316912Z 2025-03-04T19:47:11.2317077Z enabled = False 2025-03-04T19:47:11.2317484Z if opted_in_users: 2025-03-04T19:47:11.2317905Z log.info( 2025-03-04T19:47:11.2318469Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-03-04T19:47:11.2319108Z ) 2025-03-04T19:47:11.2319479Z enabled = True 2025-03-04T19:47:11.2319739Z 2025-03-04T19:47:11.2319951Z elif experiment_settings.rollout_perc: 2025-03-04T19:47:11.2320720Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-03-04T19:47:11.2321578Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-03-04T19:47:11.2322184Z log.info( 2025-03-04T19:47:11.2322989Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-03-04T19:47:11.2324002Z ) 2025-03-04T19:47:11.2324379Z enabled = True 2025-03-04T19:47:11.2324664Z 2025-03-04T19:47:11.2324819Z if enabled: 2025-03-04T19:47:11.2325220Z label = experiment_name 2025-03-04T19:47:11.2325741Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-03-04T19:47:11.2326514Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-03-04T19:47:11.2327325Z # - If it's enabled, then we always list it's prefix first 2025-03-04T19:47:11.2328164Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-03-04T19:47:11.2328797Z if is_canary: 2025-03-04T19:47:11.2329263Z label += CANARY_FLEET_SUFFIX 2025-03-04T19:47:11.2329779Z fleet_prefix = label 2025-03-04T19:47:11.2330242Z else: 2025-03-04T19:47:11.2330641Z prefixes.append(label) 2025-03-04T19:47:11.2330971Z 2025-03-04T19:47:11.2331138Z if len(prefixes) > 1: 2025-03-04T19:47:11.2331556Z log.error( 2025-03-04T19:47:11.2332510Z 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-03-04T19:47:11.2333713Z ) 2025-03-04T19:47:11.2334085Z prefixes = prefixes[:1] 2025-03-04T19:47:11.2334385Z 2025-03-04T19:47:11.2334559Z # Fleet always comes first 2025-03-04T19:47:11.2335006Z if fleet_prefix: 2025-03-04T19:47:11.2335429Z prefixes.insert(0, fleet_prefix) 2025-03-04T19:47:11.2335766Z 2025-03-04T19:47:11.2336010Z return ".".join(prefixes) + "." if prefixes else "" 2025-03-04T19:47:11.2336391Z 2025-03-04T19:47:11.2336397Z 2025-03-04T19:47:11.2336811Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-03-04T19:47:11.2337518Z """ 2025-03-04T19:47:11.2338064Z Gets the first comment of the issue, which contains the desired rollout state. 2025-03-04T19:47:11.2338972Z 2025-03-04T19:47:11.2339333Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-03-04T19:47:11.2340115Z """ 2025-03-04T19:47:11.2340492Z gh = get_gh_client(github_token) 2025-03-04T19:47:11.2341158Z issue = get_issue(gh, repo, issue_num) 2025-03-04T19:47:11.2341750Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-03-04T19:47:11.2342172Z 2025-03-04T19:47:11.2342178Z 2025-03-04T19:47:11.2342544Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-03-04T19:47:11.2343486Z for _ in range(num_retries): 2025-03-04T19:47:11.2343955Z try: 2025-03-04T19:47:11.2344388Z req = Request(url=url, headers=headers) 2025-03-04T19:47:11.2345009Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-03-04T19:47:11.2345611Z return json.loads(content) 2025-03-04T19:47:11.2346103Z except Exception as e: 2025-03-04T19:47:11.2346610Z log.warning(f"Could not download {url}: {e}") 2025-03-04T19:47:11.2346984Z 2025-03-04T19:47:11.2347339Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-03-04T19:47:11.2347995Z return {} 2025-03-04T19:47:11.2348209Z 2025-03-04T19:47:11.2348214Z 2025-03-04T19:47:11.2348359Z @cache 2025-03-04T19:47:11.2348939Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-03-04T19:47:11.2349638Z """ 2025-03-04T19:47:11.2350009Z Dynamically get PR information 2025-03-04T19:47:11.2350467Z """ 2025-03-04T19:47:11.2350932Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-03-04T19:47:11.2351514Z headers = { 2025-03-04T19:47:11.2351944Z "Accept": "application/vnd.github.v3+json", 2025-03-04T19:47:11.2352509Z "Authorization": f"token {github_token}", 2025-03-04T19:47:11.2353005Z } 2025-03-04T19:47:11.2353600Z json_response: dict[str, Any] = download_json( 2025-03-04T19:47:11.2354170Z url=f"{github_api}/issues/{pr_number}", 2025-03-04T19:47:11.2354679Z headers=headers, 2025-03-04T19:47:11.2355088Z ) 2025-03-04T19:47:11.2355277Z 2025-03-04T19:47:11.2355455Z if not json_response: 2025-03-04T19:47:11.2355986Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-03-04T19:47:11.2356560Z return {} 2025-03-04T19:47:11.2356787Z 2025-03-04T19:47:11.2356956Z return json_response 2025-03-04T19:47:11.2357213Z 2025-03-04T19:47:11.2357226Z 2025-03-04T19:47:11.2357590Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-03-04T19:47:11.2358399Z """ 2025-03-04T19:47:11.2358900Z Dynamically get the latest list of labels from the pull request 2025-03-04T19:47:11.2359499Z """ 2025-03-04T19:47:11.2359958Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-03-04T19:47:11.2360525Z return { 2025-03-04T19:47:11.2361065Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-03-04T19:47:11.2361713Z } 2025-03-04T19:47:11.2361908Z 2025-03-04T19:47:11.2361914Z 2025-03-04T19:47:11.2362078Z def main() -> None: 2025-03-04T19:47:11.2362476Z args = parse_args() 2025-03-04T19:47:11.2362740Z 2025-03-04T19:47:11.2362954Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-03-04T19:47:11.2363424Z 2025-03-04T19:47:11.2363610Z # Check if the PR is opt-out 2025-03-04T19:47:11.2364068Z if args.pr_number: 2025-03-04T19:47:11.2364669Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-03-04T19:47:11.2365376Z if OPT_OUT_LABEL in labels: 2025-03-04T19:47:11.2365838Z log.info( 2025-03-04T19:47:11.2366477Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-03-04T19:47:11.2367185Z ) 2025-03-04T19:47:11.2367696Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-04T19:47:11.2368309Z sys.exit() 2025-03-04T19:47:11.2368554Z 2025-03-04T19:47:11.2368704Z try: 2025-03-04T19:47:11.2369108Z rollout_state = get_rollout_state_from_issue( 2025-03-04T19:47:11.2369768Z args.github_token, args.github_issue_repo, args.github_issue 2025-03-04T19:47:11.2370491Z ) 2025-03-04T19:47:11.2370688Z 2025-03-04T19:47:11.2370878Z username = get_potential_pr_author( 2025-03-04T19:47:11.2371383Z args.github_token, 2025-03-04T19:47:11.2371832Z args.github_repo, 2025-03-04T19:47:11.2372273Z args.github_actor, 2025-03-04T19:47:11.2372735Z args.github_ref_type, 2025-03-04T19:47:11.2373287Z args.github_branch, 2025-03-04T19:47:11.2373718Z ) 2025-03-04T19:47:11.2373915Z 2025-03-04T19:47:11.2374175Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-03-04T19:47:11.2374595Z 2025-03-04T19:47:11.2374803Z runner_label_prefix = get_runner_prefix( 2025-03-04T19:47:11.2375325Z rollout_state, 2025-03-04T19:47:11.2375778Z (args.github_issue_owner, username), 2025-03-04T19:47:11.2376295Z args.github_branch, 2025-03-04T19:47:11.2376758Z args.eligible_experiments, 2025-03-04T19:47:11.2377236Z is_canary, 2025-03-04T19:47:11.2377635Z ) 2025-03-04T19:47:11.2377828Z 2025-03-04T19:47:11.2378001Z except Exception as e: 2025-03-04T19:47:11.2378428Z log.error( 2025-03-04T19:47:11.2379052Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-03-04T19:47:11.2379752Z ) 2025-03-04T19:47:11.2379953Z 2025-03-04T19:47:11.2380264Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-04T19:47:11.2380721Z 2025-03-04T19:47:11.2380727Z 2025-03-04T19:47:11.2380898Z if __name__ == "__main__": 2025-03-04T19:47:11.2381302Z main() 2025-03-04T19:47:11.2381509Z 2025-03-04T19:47:11.2473404Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-03-04T19:47:11.2474256Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-03-04T19:47:11.2539832Z shell: /usr/bin/bash -e {0} 2025-03-04T19:47:11.2540300Z env: 2025-03-04T19:47:11.2540896Z GITHUB_TOKEN: *** 2025-03-04T19:47:11.2541294Z ISSUE_NUMBER: 5132 2025-03-04T19:47:11.2541730Z TRIGGERING_ACTOR: williamwen42 2025-03-04T19:47:11.2542193Z ISSUE_OWNER: williamwen42 2025-03-04T19:47:11.2542632Z CHECK_EXPERIMENTS: 2025-03-04T19:47:11.2543032Z PR_NUMBER: 148205 2025-03-04T19:47:11.2543710Z ##[endgroup] 2025-03-04T19:47:12.0908833Z Defaulting to user installation because normal site-packages is not writeable 2025-03-04T19:47:12.7589905Z Collecting urllib3==1.26.18 2025-03-04T19:47:12.8137688Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-03-04T19:47:12.8419266Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.6 MB/s eta 0:00:00 2025-03-04T19:47:12.8656784Z Collecting PyGithub==2.3.0 2025-03-04T19:47:12.8727609Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-03-04T19:47:12.9239162Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-03-04T19:47:12.9307057Z 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-03-04T19:47:12.9353694Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-03-04T19:47:12.9370280Z 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-03-04T19:47:12.9385591Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-03-04T19:47:12.9679209Z Collecting Deprecated (from PyGithub==2.3.0) 2025-03-04T19:47:12.9747039Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-03-04T19:47:12.9974191Z 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-03-04T19:47:13.1128531Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-03-04T19:47:13.1201333Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-03-04T19:47:13.2275704Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-03-04T19:47:13.2345046Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.4 kB) 2025-03-04T19:47:13.2568229Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-03-04T19:47:13.2635519Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-03-04T19:47:13.2898890Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-03-04T19:47:13.3000507Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 16.1 MB/s eta 0:00:00 2025-03-04T19:47:13.3085715Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-03-04T19:47:13.3186092Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 41.4 MB/s eta 0:00:00 2025-03-04T19:47:13.3257248Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-03-04T19:47:13.3369834Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 92.0 MB/s eta 0:00:00 2025-03-04T19:47:13.3444759Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-03-04T19:47:13.3538100Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-03-04T19:47:13.3610586Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 88.1 MB/s eta 0:00:00 2025-03-04T19:47:13.3680239Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (89 kB) 2025-03-04T19:47:13.3738499Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 23.0 MB/s eta 0:00:00 2025-03-04T19:47:13.3803937Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-03-04T19:47:13.3854468Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 31.6 MB/s eta 0:00:00 2025-03-04T19:47:13.6905602Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-03-04T19:47:14.2194061Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.2 2025-03-04T19:47:14.2942225Z ##[group]Run curr_branch="gh/williamwen42/215/head" 2025-03-04T19:47:14.2942634Z curr_branch="gh/williamwen42/215/head" 2025-03-04T19:47:14.2942907Z curr_ref_type="branch" 2025-03-04T19:47:14.2943406Z echo "Current branch is '$curr_branch'" 2025-03-04T19:47:14.2943669Z  2025-03-04T19:47:14.2943871Z python3 runner_determinator.py \ 2025-03-04T19:47:14.2944168Z  --github-token "$GITHUB_TOKEN" \ 2025-03-04T19:47:14.2944443Z  --github-issue "$ISSUE_NUMBER" \ 2025-03-04T19:47:14.2944711Z  --github-branch "$curr_branch" \ 2025-03-04T19:47:14.2944983Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-03-04T19:47:14.2945273Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-03-04T19:47:14.2945558Z  --github-ref-type "$curr_ref_type" \ 2025-03-04T19:47:14.2945840Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-03-04T19:47:14.2946212Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-03-04T19:47:14.2946512Z  --pr-number "${PR_NUMBER}" 2025-03-04T19:47:14.2992832Z shell: /usr/bin/bash -e {0} 2025-03-04T19:47:14.2993061Z env: 2025-03-04T19:47:14.2993877Z GITHUB_TOKEN: *** 2025-03-04T19:47:14.2994085Z ISSUE_NUMBER: 5132 2025-03-04T19:47:14.2994308Z TRIGGERING_ACTOR: williamwen42 2025-03-04T19:47:14.2994541Z ISSUE_OWNER: williamwen42 2025-03-04T19:47:14.2994750Z CHECK_EXPERIMENTS: 2025-03-04T19:47:14.2994945Z PR_NUMBER: 148205 2025-03-04T19:47:14.2995129Z ##[endgroup] 2025-03-04T19:47:14.3059103Z Current branch is 'gh/williamwen42/215/head' 2025-03-04T19:47:15.9097587Z INFO : Based on rollout percentage of 55%, enabling experiment lf. 2025-03-04T19:47:15.9098717Z INFO : Skipping experiment 'awsa100', as it is not a default experiment 2025-03-04T19:47:15.9099504Z INFO : Setting output: label-type='lf.' 2025-03-04T19:47:15.9409430Z Evaluate and set job outputs 2025-03-04T19:47:15.9416858Z Set output 'label-type' 2025-03-04T19:47:15.9418666Z Cleaning up orphan processes