2025-04-21T20:25:10.9904241Z Current runner version: '2.323.0' 2025-04-21T20:25:10.9934442Z ##[group]Operating System 2025-04-21T20:25:10.9935208Z Ubuntu 2025-04-21T20:25:10.9935706Z 24.04.2 2025-04-21T20:25:10.9936288Z LTS 2025-04-21T20:25:10.9936734Z ##[endgroup] 2025-04-21T20:25:10.9937247Z ##[group]Runner Image 2025-04-21T20:25:10.9937841Z Image: ubuntu-24.04 2025-04-21T20:25:10.9938376Z Version: 20250413.1.0 2025-04-21T20:25:10.9939356Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250413.1/images/ubuntu/Ubuntu2404-Readme.md 2025-04-21T20:25:10.9941023Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250413.1 2025-04-21T20:25:10.9941906Z ##[endgroup] 2025-04-21T20:25:10.9942433Z ##[group]Runner Image Provisioner 2025-04-21T20:25:10.9943070Z 2.0.422.1 2025-04-21T20:25:10.9943496Z ##[endgroup] 2025-04-21T20:25:10.9945763Z ##[group]GITHUB_TOKEN Permissions 2025-04-21T20:25:10.9948112Z Actions: read 2025-04-21T20:25:10.9948819Z Attestations: read 2025-04-21T20:25:10.9949583Z Checks: read 2025-04-21T20:25:10.9950206Z Contents: read 2025-04-21T20:25:10.9950772Z Deployments: read 2025-04-21T20:25:10.9951272Z Discussions: read 2025-04-21T20:25:10.9951751Z Issues: read 2025-04-21T20:25:10.9952274Z Metadata: read 2025-04-21T20:25:10.9952727Z Models: read 2025-04-21T20:25:10.9953210Z Packages: read 2025-04-21T20:25:10.9953642Z Pages: read 2025-04-21T20:25:10.9954200Z PullRequests: read 2025-04-21T20:25:10.9954680Z RepositoryProjects: read 2025-04-21T20:25:10.9955225Z SecurityEvents: read 2025-04-21T20:25:10.9955752Z Statuses: read 2025-04-21T20:25:10.9956225Z ##[endgroup] 2025-04-21T20:25:10.9958722Z Secret source: Actions 2025-04-21T20:25:10.9959975Z Prepare workflow directory 2025-04-21T20:25:11.0499835Z Prepare all required actions 2025-04-21T20:25:11.0558124Z Complete job name: get-label-type / runner-determinator 2025-04-21T20:25:11.1320375Z ##[group]Run cat < runner_determinator.py 2025-04-21T20:25:11.1323766Z cat < runner_determinator.py 2025-04-21T20:25:11.1324907Z # flake8: noqa: G004 2025-04-21T20:25:11.1325918Z  2025-04-21T20:25:11.1327193Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-04-21T20:25:11.1329009Z # must be kept in sync. You can do it easily by running the following command: 2025-04-21T20:25:11.1330965Z # python .github/scripts/update_runner_determinator.py 2025-04-21T20:25:11.1332216Z  2025-04-21T20:25:11.1332881Z """ 2025-04-21T20:25:11.1334236Z This runner determinator is used to determine which set of runners to run a 2025-04-21T20:25:11.1335957Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-04-21T20:25:11.1337955Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-04-21T20:25:11.1339573Z of which runners should be used to run which job. 2025-04-21T20:25:11.1341078Z  2025-04-21T20:25:11.1342596Z The configuration has two parts, the settings and a list of opted-in users, 2025-04-21T20:25:11.1344313Z separated by a line containing "---". If the line is not present, the 2025-04-21T20:25:11.1346014Z settings are considered to be empty with only the second part, the user 2025-04-21T20:25:11.1347484Z list, defined. 2025-04-21T20:25:11.1348339Z  2025-04-21T20:25:11.1349523Z The first part is a YAML block that defines the rollout settings. This can be 2025-04-21T20:25:11.1351531Z used to define any settings that are needed to determine which runners to use. 2025-04-21T20:25:11.1353197Z It's fields are defined by the RolloutSettings class below. 2025-04-21T20:25:11.1354324Z  2025-04-21T20:25:11.1355656Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-04-21T20:25:11.1357388Z The user list is also a comma separated list of additional features or 2025-04-21T20:25:11.1359372Z experiments which the user could be opted in to. 2025-04-21T20:25:11.1360826Z  2025-04-21T20:25:11.1361652Z The user list has the following rules: 2025-04-21T20:25:11.1362795Z  2025-04-21T20:25:11.1363881Z - Users are GitHub usernames, which must start with the @ prefix 2025-04-21T20:25:11.1365494Z - Each user is also a comma-separated list of features/experiments to enable 2025-04-21T20:25:11.1367076Z - A "#" prefix opts the user out of all experiments 2025-04-21T20:25:11.1368169Z  2025-04-21T20:25:11.1368946Z Example config: 2025-04-21T20:25:11.1370019Z  # A list of experiments that can be opted into. 2025-04-21T20:25:11.1371675Z  # This defines the behavior they'll induce when opted into. 2025-04-21T20:25:11.1372990Z  # Expected syntax is: 2025-04-21T20:25:11.1374387Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-04-21T20:25:11.1376290Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-04-21T20:25:11.1377703Z  2025-04-21T20:25:11.1378604Z  experiments: 2025-04-21T20:25:11.1379459Z  lf: 2025-04-21T20:25:11.1380512Z  rollout_percent: 25 2025-04-21T20:25:11.1381673Z  all_branches: false 2025-04-21T20:25:11.1382572Z  default: true 2025-04-21T20:25:11.1383467Z  --- 2025-04-21T20:25:11.1384316Z  2025-04-21T20:25:11.1385085Z  # Opt-ins: 2025-04-21T20:25:11.1386341Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-04-21T20:25:11.1388298Z  # and specifying experiments to enable in a comma-separated list. 2025-04-21T20:25:11.1389873Z  # To always opt out of an experiment, prefix it with a "-". 2025-04-21T20:25:11.1391548Z  # Experiments should be from the above list. 2025-04-21T20:25:11.1392787Z  2025-04-21T20:25:11.1393515Z  @User1,-lf,split_build 2025-04-21T20:25:11.1394510Z  @User2,lf 2025-04-21T20:25:11.1395509Z  @User3,split_build 2025-04-21T20:25:11.1396375Z """ 2025-04-21T20:25:11.1397146Z  2025-04-21T20:25:11.1397973Z import json 2025-04-21T20:25:11.1398821Z import logging 2025-04-21T20:25:11.1399661Z import os 2025-04-21T20:25:11.1401054Z import random 2025-04-21T20:25:11.1402086Z import re 2025-04-21T20:25:11.1402837Z import sys 2025-04-21T20:25:11.1403878Z from argparse import ArgumentParser 2025-04-21T20:25:11.1404985Z from collections.abc import Iterable 2025-04-21T20:25:11.1406071Z from functools import cache 2025-04-21T20:25:11.1407222Z from logging import LogRecord 2025-04-21T20:25:11.1408267Z from typing import Any, NamedTuple 2025-04-21T20:25:11.1409499Z from urllib.request import Request, urlopen 2025-04-21T20:25:11.1410741Z  2025-04-21T20:25:11.1411535Z import yaml 2025-04-21T20:25:11.1412349Z from github import Auth, Github 2025-04-21T20:25:11.1413533Z from github.Issue import Issue 2025-04-21T20:25:11.1414547Z  2025-04-21T20:25:11.1415210Z  2025-04-21T20:25:11.1416216Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-04-21T20:25:11.1417589Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-04-21T20:25:11.1419345Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-04-21T20:25:11.1420922Z  2025-04-21T20:25:11.1421884Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-04-21T20:25:11.1423141Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-04-21T20:25:11.1424227Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-04-21T20:25:11.1425908Z OPT_OUT_LABEL = "no-runner-experiments" 2025-04-21T20:25:11.1426976Z  2025-04-21T20:25:11.1427868Z SETTING_EXPERIMENTS = "experiments" 2025-04-21T20:25:11.1428838Z  2025-04-21T20:25:11.1429697Z LF_FLEET_EXPERIMENT = "lf" 2025-04-21T20:25:11.1431115Z CANARY_FLEET_SUFFIX = ".c" 2025-04-21T20:25:11.1432019Z  2025-04-21T20:25:11.1432831Z  2025-04-21T20:25:11.1433610Z class Experiment(NamedTuple): 2025-04-21T20:25:11.1434641Z  rollout_perc: float = ( 2025-04-21T20:25:11.1435987Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-04-21T20:25:11.1437395Z  ) 2025-04-21T20:25:11.1438204Z  all_branches: bool = ( 2025-04-21T20:25:11.1439532Z  False # If True, the experiment is also enabled on the exception branches 2025-04-21T20:25:11.1441154Z  ) 2025-04-21T20:25:11.1442006Z  default: bool = ( 2025-04-21T20:25:11.1443363Z  True # If True, the experiment is enabled by default for all queries 2025-04-21T20:25:11.1444646Z  ) 2025-04-21T20:25:11.1445330Z  2025-04-21T20:25:11.1446112Z  # Add more fields as needed 2025-04-21T20:25:11.1447009Z  2025-04-21T20:25:11.1447757Z  2025-04-21T20:25:11.1448557Z class Settings(NamedTuple): 2025-04-21T20:25:11.1449596Z  """ 2025-04-21T20:25:11.1450745Z  Settings for the experiments that can be opted into. 2025-04-21T20:25:11.1452141Z  """ 2025-04-21T20:25:11.1452926Z  2025-04-21T20:25:11.1453730Z  experiments: dict[str, Experiment] = {} 2025-04-21T20:25:11.1454915Z  2025-04-21T20:25:11.1455893Z  2025-04-21T20:25:11.1456792Z class ColorFormatter(logging.Formatter): 2025-04-21T20:25:11.1458143Z  """Color codes the log messages based on the log level""" 2025-04-21T20:25:11.1459393Z  2025-04-21T20:25:11.1460350Z  COLORS = { 2025-04-21T20:25:11.1461421Z  "WARNING": "\033[33m", # Yellow 2025-04-21T20:25:11.1462514Z  "ERROR": "\033[31m", # Red 2025-04-21T20:25:11.1463511Z  "CRITICAL": "\033[31m", # Red 2025-04-21T20:25:11.1464682Z  "INFO": "\033[0m", # Reset 2025-04-21T20:25:11.1465689Z  "DEBUG": "\033[0m", # Reset 2025-04-21T20:25:11.1466680Z  } 2025-04-21T20:25:11.1467562Z  2025-04-21T20:25:11.1468406Z  def format(self, record: LogRecord) -> str: 2025-04-21T20:25:11.1469897Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-04-21T20:25:11.1471710Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-04-21T20:25:11.1472972Z  return super().format(record) 2025-04-21T20:25:11.1473933Z  2025-04-21T20:25:11.1474787Z  2025-04-21T20:25:11.1475617Z handler = logging.StreamHandler() 2025-04-21T20:25:11.1477055Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-04-21T20:25:11.1478615Z  2025-04-21T20:25:11.1479526Z log = logging.getLogger(os.path.basename(__file__)) 2025-04-21T20:25:11.1480951Z log.addHandler(handler) 2025-04-21T20:25:11.1482050Z log.setLevel(logging.INFO) 2025-04-21T20:25:11.1483019Z  2025-04-21T20:25:11.1483739Z  2025-04-21T20:25:11.1484779Z def set_github_output(key: str, value: str) -> None: 2025-04-21T20:25:11.1485954Z  """ 2025-04-21T20:25:11.1486978Z  Defines outputs of the github action that invokes this script 2025-04-21T20:25:11.1488969Z  """ 2025-04-21T20:25:11.1576628Z  if not GITHUB_OUTPUT: 2025-04-21T20:25:11.1578727Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-04-21T20:25:11.1581769Z  log.warning( 2025-04-21T20:25:11.1582969Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-04-21T20:25:11.1583898Z  ) 2025-04-21T20:25:11.1584377Z  print(f"::set-output name={key}::{value}") 2025-04-21T20:25:11.1584971Z  return 2025-04-21T20:25:11.1585365Z  2025-04-21T20:25:11.1585787Z  with open(GITHUB_OUTPUT, "a") as f: 2025-04-21T20:25:11.1586390Z  log.info(f"Setting output: {key}='{value}'") 2025-04-21T20:25:11.1586991Z  f.write(f"{key}={value}\n") 2025-04-21T20:25:11.1587510Z  2025-04-21T20:25:11.1587869Z  2025-04-21T20:25:11.1588394Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-04-21T20:25:11.1589045Z  return frozenset( 2025-04-21T20:25:11.1589706Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-04-21T20:25:11.1590584Z  ) 2025-04-21T20:25:11.1590948Z  2025-04-21T20:25:11.1591279Z  2025-04-21T20:25:11.1591639Z def parse_args() -> Any: 2025-04-21T20:25:11.1592275Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-04-21T20:25:11.1593184Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-04-21T20:25:11.1593945Z  parser.add_argument( 2025-04-21T20:25:11.1594427Z  "--github-issue-repo", 2025-04-21T20:25:11.1594924Z  type=str, 2025-04-21T20:25:11.1595351Z  required=False, 2025-04-21T20:25:11.1596074Z  default="pytorch/test-infra", 2025-04-21T20:25:11.1596670Z  help="GitHub repo to get the issue", 2025-04-21T20:25:11.1597190Z  ) 2025-04-21T20:25:11.1597576Z  parser.add_argument( 2025-04-21T20:25:11.1598053Z  "--github-repo", 2025-04-21T20:25:11.1598524Z  type=str, 2025-04-21T20:25:11.1598950Z  required=True, 2025-04-21T20:25:11.1599457Z  help="GitHub repo where CI is running", 2025-04-21T20:25:11.1599969Z  ) 2025-04-21T20:25:11.1600604Z  parser.add_argument( 2025-04-21T20:25:11.1601266Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-04-21T20:25:11.1601915Z  ) 2025-04-21T20:25:11.1602302Z  parser.add_argument( 2025-04-21T20:25:11.1602973Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-04-21T20:25:11.1603653Z  ) 2025-04-21T20:25:11.1604024Z  parser.add_argument( 2025-04-21T20:25:11.1604718Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-04-21T20:25:11.1605409Z  ) 2025-04-21T20:25:11.1605786Z  parser.add_argument( 2025-04-21T20:25:11.1606471Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-04-21T20:25:11.1607169Z  ) 2025-04-21T20:25:11.1607563Z  parser.add_argument( 2025-04-21T20:25:11.1608034Z  "--github-ref-type", 2025-04-21T20:25:11.1608506Z  type=str, 2025-04-21T20:25:11.1608985Z  required=True, 2025-04-21T20:25:11.1609511Z  help="Current GitHub ref type, branch or tag", 2025-04-21T20:25:11.1610721Z  ) 2025-04-21T20:25:11.1611140Z  parser.add_argument( 2025-04-21T20:25:11.1611632Z  "--eligible-experiments", 2025-04-21T20:25:11.1612179Z  type=_str_comma_separated_to_set, 2025-04-21T20:25:11.1612694Z  required=False, 2025-04-21T20:25:11.1613324Z  default="", 2025-04-21T20:25:11.1614204Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-04-21T20:25:11.1615110Z  ) 2025-04-21T20:25:11.1615499Z  parser.add_argument( 2025-04-21T20:25:11.1615965Z  "--pr-number", 2025-04-21T20:25:11.1616414Z  type=str, 2025-04-21T20:25:11.1616836Z  required=False, 2025-04-21T20:25:11.1617293Z  default="", 2025-04-21T20:25:11.1617833Z  help="the optional PR number where this is run", 2025-04-21T20:25:11.1618429Z  ) 2025-04-21T20:25:11.1618832Z  2025-04-21T20:25:11.1619255Z  return parser.parse_args() 2025-04-21T20:25:11.1619738Z  2025-04-21T20:25:11.1620248Z  2025-04-21T20:25:11.1620926Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-04-21T20:25:11.1621709Z  auth = Auth.Token(github_token) 2025-04-21T20:25:11.1622244Z  return Github(auth=auth) 2025-04-21T20:25:11.1622706Z  2025-04-21T20:25:11.1623035Z  2025-04-21T20:25:11.1623684Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-04-21T20:25:11.1624469Z  repo = gh.get_repo(repo) 2025-04-21T20:25:11.1625001Z  return repo.get_issue(number=issue_num) 2025-04-21T20:25:11.1625511Z  2025-04-21T20:25:11.1625846Z  2025-04-21T20:25:11.1626212Z def get_potential_pr_author( 2025-04-21T20:25:11.1626880Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-04-21T20:25:11.1627545Z ) -> str: 2025-04-21T20:25:11.1628248Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-04-21T20:25:11.1629062Z  # Fetch the actual username from the original PR. The PR number is 2025-04-21T20:25:11.1629810Z  # embedded in the tag name: ciflow// 2025-04-21T20:25:11.1630582Z  2025-04-21T20:25:11.1630961Z  gh = get_gh_client(github_token) 2025-04-21T20:25:11.1631452Z  2025-04-21T20:25:11.1631916Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-04-21T20:25:11.1632591Z  split_tag = ref_name.split("/") 2025-04-21T20:25:11.1633146Z  if ( 2025-04-21T20:25:11.1633547Z  len(split_tag) == 3 2025-04-21T20:25:11.1634056Z  and split_tag[0] == "ciflow" 2025-04-21T20:25:11.1634584Z  and split_tag[2].isnumeric() 2025-04-21T20:25:11.1635090Z  ): 2025-04-21T20:25:11.1635510Z  pr_number = split_tag[2] 2025-04-21T20:25:11.1636004Z  try: 2025-04-21T20:25:11.1636476Z  repository = gh.get_repo(repo) 2025-04-21T20:25:11.1637095Z  pull = repository.get_pull(number=int(pr_number)) 2025-04-21T20:25:11.1637704Z  except Exception as e: 2025-04-21T20:25:11.1638237Z  raise Exception( # noqa: TRY002 2025-04-21T20:25:11.1638935Z  f"issue with pull request {pr_number} from repo {repository}" 2025-04-21T20:25:11.1639571Z  ) from e 2025-04-21T20:25:11.1640351Z  return pull.user.login # type: ignore[no-any-return] 2025-04-21T20:25:11.1641104Z  # In all other cases, return the original input username 2025-04-21T20:25:11.1641737Z  return username 2025-04-21T20:25:11.1642161Z  2025-04-21T20:25:11.1642486Z  2025-04-21T20:25:11.1642907Z def is_exception_branch(branch: str) -> bool: 2025-04-21T20:25:11.1643456Z  """ 2025-04-21T20:25:11.1644146Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-04-21T20:25:11.1645070Z  """ 2025-04-21T20:25:11.1645627Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-04-21T20:25:11.1646287Z  2025-04-21T20:25:11.1646610Z  2025-04-21T20:25:11.1646995Z def load_yaml(yaml_text: str) -> Any: 2025-04-21T20:25:11.1647488Z  try: 2025-04-21T20:25:11.1647897Z  data = yaml.safe_load(yaml_text) 2025-04-21T20:25:11.1648403Z  return data 2025-04-21T20:25:11.1648845Z  except yaml.YAMLError: 2025-04-21T20:25:11.1649360Z  log.exception("Error loading YAML") 2025-04-21T20:25:11.1649866Z  raise 2025-04-21T20:25:11.1650525Z  2025-04-21T20:25:11.1650894Z  2025-04-21T20:25:11.1651515Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-04-21T20:25:11.1652247Z  """ 2025-04-21T20:25:11.1652903Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-04-21T20:25:11.1653631Z  2025-04-21T20:25:11.1654178Z  If the issue body contains "---" then the text above that is the settings 2025-04-21T20:25:11.1654931Z  and the text below is the list of opted in users. 2025-04-21T20:25:11.1655477Z  2025-04-21T20:25:11.1656048Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-04-21T20:25:11.1656728Z  """ 2025-04-21T20:25:11.1657212Z  rollout_state_parts = rollout_state.split("---") 2025-04-21T20:25:11.1657808Z  if len(rollout_state_parts) >= 2: 2025-04-21T20:25:11.1658591Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-04-21T20:25:11.1659193Z  else: 2025-04-21T20:25:11.1659637Z  return "", rollout_state 2025-04-21T20:25:11.1660332Z  2025-04-21T20:25:11.1660730Z  2025-04-21T20:25:11.1661146Z class UserOptins(dict[str, list[str]]): 2025-04-21T20:25:11.1661661Z  """ 2025-04-21T20:25:11.1662197Z  Dictionary of users with a list of features they have opted into 2025-04-21T20:25:11.1662835Z  """ 2025-04-21T20:25:11.1663183Z  2025-04-21T20:25:11.1663511Z  2025-04-21T20:25:11.1664035Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-04-21T20:25:11.1664688Z  """ 2025-04-21T20:25:11.1665409Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-04-21T20:25:11.1666259Z  2025-04-21T20:25:11.1667072Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-04-21T20:25:11.1668046Z  - Example line: "@User1,lf,split_build" 2025-04-21T20:25:11.1668744Z  - A "#" prefix indicates the user is opted out of all experiments 2025-04-21T20:25:11.1669359Z  2025-04-21T20:25:11.1669694Z  2025-04-21T20:25:11.1670022Z  """ 2025-04-21T20:25:11.1670532Z  optins = UserOptins() 2025-04-21T20:25:11.1671052Z  for user in user_optin_text.split("\n"): 2025-04-21T20:25:11.1671610Z  user = user.strip("\r\n\t -") 2025-04-21T20:25:11.1672171Z  if not user or not user.startswith("@"): 2025-04-21T20:25:11.1672715Z  # Not a valid user. Skip 2025-04-21T20:25:11.1673207Z  continue 2025-04-21T20:25:11.1673626Z  2025-04-21T20:25:11.1673957Z  if user: 2025-04-21T20:25:11.1674427Z  usr_name = user.split(",")[0].strip("@") 2025-04-21T20:25:11.1675112Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-04-21T20:25:11.1676123Z  2025-04-21T20:25:11.1676673Z  return optins 2025-04-21T20:25:11.1677334Z  2025-04-21T20:25:11.1677798Z  2025-04-21T20:25:11.1678515Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-04-21T20:25:11.1679425Z  """ 2025-04-21T20:25:11.1680058Z  Check if the experiment name is valid. 2025-04-21T20:25:11.1681148Z  A valid name: 2025-04-21T20:25:11.1682182Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-04-21T20:25:11.1683805Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-04-21T20:25:11.1685078Z  - Cannot contain spaces 2025-04-21T20:25:11.1685850Z  """ 2025-04-21T20:25:11.1686396Z  2025-04-21T20:25:11.1687082Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-04-21T20:25:11.1688208Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-04-21T20:25:11.1689184Z  2025-04-21T20:25:11.1689731Z  if valid: 2025-04-21T20:25:11.1690402Z  return True 2025-04-21T20:25:11.1690832Z  2025-04-21T20:25:11.1691168Z  log.error( 2025-04-21T20:25:11.1692585Z  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-04-21T20:25:11.1694106Z  ) 2025-04-21T20:25:11.1694461Z  return False 2025-04-21T20:25:11.1694865Z  2025-04-21T20:25:11.1695187Z  2025-04-21T20:25:11.1696244Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-04-21T20:25:11.1696958Z  """ 2025-04-21T20:25:11.1697559Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-04-21T20:25:11.1698263Z  """ 2025-04-21T20:25:11.1698611Z  try: 2025-04-21T20:25:11.1698989Z  if settings_text: 2025-04-21T20:25:11.1699726Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-04-21T20:25:11.1700806Z  # for easy reading 2025-04-21T20:25:11.1701623Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-04-21T20:25:11.1702489Z  # the backtick character in shell commands. 2025-04-21T20:25:11.1703094Z  backtick = chr(96) # backtick character 2025-04-21T20:25:11.1703761Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-04-21T20:25:11.1704437Z  settings = load_yaml(settings_text) 2025-04-21T20:25:11.1704936Z  2025-04-21T20:25:11.1705510Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-04-21T20:25:11.1706242Z  experiments = {} 2025-04-21T20:25:11.1706681Z  2025-04-21T20:25:11.1707231Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-04-21T20:25:11.1708005Z  if not is_valid_experiment_name(exp_name): 2025-04-21T20:25:11.1709081Z  # 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-04-21T20:25:11.1710237Z  continue 2025-04-21T20:25:11.1710688Z  2025-04-21T20:25:11.1711058Z  valid_settings = {} 2025-04-21T20:25:11.1711587Z  for setting in exp_settings: 2025-04-21T20:25:11.1712158Z  if setting not in Experiment._fields: 2025-04-21T20:25:11.1712713Z  log.warning( 2025-04-21T20:25:11.1713588Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-04-21T20:25:11.1714279Z  ) 2025-04-21T20:25:11.1714721Z  else: 2025-04-21T20:25:11.1715257Z  valid_settings[setting] = exp_settings[setting] 2025-04-21T20:25:11.1715809Z  2025-04-21T20:25:11.1716278Z  experiments[exp_name] = Experiment(**valid_settings) 2025-04-21T20:25:11.1716919Z  return Settings(experiments) 2025-04-21T20:25:11.1717402Z  2025-04-21T20:25:11.1717766Z  except Exception: 2025-04-21T20:25:11.1718274Z  log.exception("Failed to parse settings") 2025-04-21T20:25:11.1718821Z  2025-04-21T20:25:11.1719158Z  return Settings() 2025-04-21T20:25:11.1719571Z  2025-04-21T20:25:11.1719890Z  2025-04-21T20:25:11.1720524Z def parse_settings(rollout_state: str) -> Settings: 2025-04-21T20:25:11.1721091Z  """ 2025-04-21T20:25:11.1721539Z  Parse settings, if any, from the rollout state. 2025-04-21T20:25:11.1722091Z  2025-04-21T20:25:11.1722620Z  If the issue body contains "---" then the text above that is the settings 2025-04-21T20:25:11.1723373Z  and the text below is the list of opted in users. 2025-04-21T20:25:11.1723916Z  2025-04-21T20:25:11.1724504Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-04-21T20:25:11.1725227Z  """ 2025-04-21T20:25:11.1725797Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-04-21T20:25:11.1726695Z  return parse_settings_from_text(settings_text) 2025-04-21T20:25:11.1727239Z  2025-04-21T20:25:11.1727568Z  2025-04-21T20:25:11.1728015Z def parse_users(rollout_state: str) -> UserOptins: 2025-04-21T20:25:11.1728571Z  """ 2025-04-21T20:25:11.1728989Z  Parse users from the rollout state. 2025-04-21T20:25:11.1729480Z  2025-04-21T20:25:11.1729807Z  """ 2025-04-21T20:25:11.1730559Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-04-21T20:25:11.1731328Z  return parse_user_opt_in_from_text(users_text) 2025-04-21T20:25:11.1731852Z  2025-04-21T20:25:11.1732176Z  2025-04-21T20:25:11.1732775Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-04-21T20:25:11.1733509Z  """ 2025-04-21T20:25:11.1733946Z  Check if a user is opted into an experiment 2025-04-21T20:25:11.1734470Z  """ 2025-04-21T20:25:11.1734945Z  return experiment_name in user_optins.get(user, []) 2025-04-21T20:25:11.1735497Z  2025-04-21T20:25:11.1735824Z  2025-04-21T20:25:11.1736429Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-04-21T20:25:11.1737162Z  """ 2025-04-21T20:25:11.1737629Z  Check if a user explicitly opted out of an experiment 2025-04-21T20:25:11.1738179Z  """ 2025-04-21T20:25:11.1738691Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-04-21T20:25:11.1739376Z  experiment_optout = "-" + experiment_name 2025-04-21T20:25:11.1740016Z  if experiment_optout not in user_optins.get(user, []): 2025-04-21T20:25:11.1740902Z  return False 2025-04-21T20:25:11.1741316Z  2025-04-21T20:25:11.1741816Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-04-21T20:25:11.1742402Z  log.warning( 2025-04-21T20:25:11.1743206Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-04-21T20:25:11.1744226Z  ) 2025-04-21T20:25:11.1744584Z  2025-04-21T20:25:11.1744914Z  return True 2025-04-21T20:25:11.1745309Z  2025-04-21T20:25:11.1745626Z  2025-04-21T20:25:11.1745978Z def get_runner_prefix( 2025-04-21T20:25:11.1746434Z  rollout_state: str, 2025-04-21T20:25:11.1746913Z  workflow_requestors: Iterable[str], 2025-04-21T20:25:11.1747418Z  branch: str, 2025-04-21T20:25:11.1747933Z  eligible_experiments: frozenset[str] = frozenset(), 2025-04-21T20:25:11.1748516Z  is_canary: bool = False, 2025-04-21T20:25:11.1748961Z ) -> str: 2025-04-21T20:25:11.1749401Z  settings = parse_settings(rollout_state) 2025-04-21T20:25:11.1749982Z  user_optins = parse_users(rollout_state) 2025-04-21T20:25:11.1750738Z  2025-04-21T20:25:11.1751095Z  fleet_prefix = "" 2025-04-21T20:25:11.1751532Z  prefixes = [] 2025-04-21T20:25:11.1752206Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-04-21T20:25:11.1753128Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-04-21T20:25:11.1753822Z  log.info( 2025-04-21T20:25:11.1754510Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-04-21T20:25:11.1755230Z  ) 2025-04-21T20:25:11.1755756Z  continue 2025-04-21T20:25:11.1756381Z  2025-04-21T20:25:11.1756761Z  if eligible_experiments: 2025-04-21T20:25:11.1757556Z  if experiment_name not in eligible_experiments: 2025-04-21T20:25:11.1758219Z  exp_list = ", ".join(eligible_experiments) 2025-04-21T20:25:11.1758762Z  log.info( 2025-04-21T20:25:11.1759556Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-04-21T20:25:11.1760650Z  ) 2025-04-21T20:25:11.1761065Z  continue 2025-04-21T20:25:11.1761571Z  elif not experiment_settings.default: 2025-04-21T20:25:11.1762081Z  log.info( 2025-04-21T20:25:11.1762759Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-04-21T20:25:11.1763467Z  ) 2025-04-21T20:25:11.1763850Z  continue 2025-04-21T20:25:11.1764255Z  2025-04-21T20:25:11.1764710Z  # Is any workflow_requestor opted out to this experiment? 2025-04-21T20:25:11.1765320Z  opted_out_users = [ 2025-04-21T20:25:11.1765782Z  requestor 2025-04-21T20:25:11.1766274Z  for requestor in workflow_requestors 2025-04-21T20:25:11.1766947Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-04-21T20:25:11.1767549Z  ] 2025-04-21T20:25:11.1767915Z  2025-04-21T20:25:11.1768258Z  if opted_out_users: 2025-04-21T20:25:11.1768719Z  log.info( 2025-04-21T20:25:11.1769348Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-04-21T20:25:11.1770026Z  ) 2025-04-21T20:25:11.1770747Z  continue 2025-04-21T20:25:11.1771156Z  2025-04-21T20:25:11.1771611Z  # Is any workflow_requestor opted in to this experiment? 2025-04-21T20:25:11.1772211Z  opted_in_users = [ 2025-04-21T20:25:11.1772680Z  requestor 2025-04-21T20:25:11.1773156Z  for requestor in workflow_requestors 2025-04-21T20:25:11.1773814Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-04-21T20:25:11.1774613Z  ] 2025-04-21T20:25:11.1774971Z  2025-04-21T20:25:11.1775321Z  enabled = False 2025-04-21T20:25:11.1775771Z  if opted_in_users: 2025-04-21T20:25:11.1776228Z  log.info( 2025-04-21T20:25:11.1776843Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-04-21T20:25:11.1777500Z  ) 2025-04-21T20:25:11.1778080Z  enabled = True 2025-04-21T20:25:11.1778695Z  2025-04-21T20:25:11.1779116Z  elif experiment_settings.rollout_perc: 2025-04-21T20:25:11.1779936Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-04-21T20:25:11.1780997Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-04-21T20:25:11.1781626Z  log.info( 2025-04-21T20:25:11.1782498Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-04-21T20:25:11.1783375Z  ) 2025-04-21T20:25:11.1783795Z  enabled = True 2025-04-21T20:25:11.1784247Z  2025-04-21T20:25:11.1784589Z  if enabled: 2025-04-21T20:25:11.1785042Z  label = experiment_name 2025-04-21T20:25:11.1785596Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-04-21T20:25:11.1786402Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-04-21T20:25:11.1787461Z  # - If it's enabled, then we always list it's prefix first 2025-04-21T20:25:11.1788218Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-04-21T20:25:11.1788858Z  if is_canary: 2025-04-21T20:25:11.1789365Z  label += CANARY_FLEET_SUFFIX 2025-04-21T20:25:11.1789903Z  fleet_prefix = label 2025-04-21T20:25:11.1790633Z  else: 2025-04-21T20:25:11.1791096Z  prefixes.append(label) 2025-04-21T20:25:11.1791580Z  2025-04-21T20:25:11.1791931Z  if len(prefixes) > 1: 2025-04-21T20:25:11.1792389Z  log.error( 2025-04-21T20:25:11.1793404Z  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-04-21T20:25:11.1794456Z  ) 2025-04-21T20:25:11.1794849Z  prefixes = prefixes[:1] 2025-04-21T20:25:11.1795327Z  2025-04-21T20:25:11.1795695Z  # Fleet always comes first 2025-04-21T20:25:11.1796172Z  if fleet_prefix: 2025-04-21T20:25:11.1796639Z  prefixes.insert(0, fleet_prefix) 2025-04-21T20:25:11.1797124Z  2025-04-21T20:25:11.1797560Z  return ".".join(prefixes) + "." if prefixes else "" 2025-04-21T20:25:11.1798101Z  2025-04-21T20:25:11.1798424Z  2025-04-21T20:25:11.1799032Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-04-21T20:25:11.1799774Z  """ 2025-04-21T20:25:11.1800496Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-04-21T20:25:11.1801175Z  2025-04-21T20:25:11.1801734Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-04-21T20:25:11.1802407Z  """ 2025-04-21T20:25:11.1802821Z  gh = get_gh_client(github_token) 2025-04-21T20:25:11.1803366Z  issue = get_issue(gh, repo, issue_num) 2025-04-21T20:25:11.1804011Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-04-21T20:25:11.1804739Z  2025-04-21T20:25:11.1805054Z  2025-04-21T20:25:11.1805635Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-04-21T20:25:11.1806360Z  for _ in range(num_retries): 2025-04-21T20:25:11.1806830Z  try: 2025-04-21T20:25:11.1807261Z  req = Request(url=url, headers=headers) 2025-04-21T20:25:11.1807928Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-04-21T20:25:11.1808565Z  return json.loads(content) 2025-04-21T20:25:11.1809101Z  except Exception as e: 2025-04-21T20:25:11.1809661Z  log.warning(f"Could not download {url}: {e}") 2025-04-21T20:25:11.1810410Z  2025-04-21T20:25:11.1810986Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-04-21T20:25:11.1811672Z  return {} 2025-04-21T20:25:11.1812064Z  2025-04-21T20:25:11.1812395Z  2025-04-21T20:25:11.1812725Z @cache 2025-04-21T20:25:11.1813355Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-04-21T20:25:11.1814118Z  """ 2025-04-21T20:25:11.1814523Z  Dynamically get PR information 2025-04-21T20:25:11.1814993Z  """ 2025-04-21T20:25:11.1815547Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-04-21T20:25:11.1816152Z  headers = { 2025-04-21T20:25:11.1816629Z  "Accept": "application/vnd.github.v3+json", 2025-04-21T20:25:11.1817231Z  "Authorization": f"token {github_token}", 2025-04-21T20:25:11.1817746Z  } 2025-04-21T20:25:11.1818336Z  json_response: dict[str, Any] = download_json( 2025-04-21T20:25:11.1818941Z  url=f"{github_api}/issues/{pr_number}", 2025-04-21T20:25:11.1819484Z  headers=headers, 2025-04-21T20:25:11.1819918Z  ) 2025-04-21T20:25:11.1820392Z  2025-04-21T20:25:11.1820748Z  if not json_response: 2025-04-21T20:25:11.1821333Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-04-21T20:25:11.1821930Z  return {} 2025-04-21T20:25:11.1822322Z  2025-04-21T20:25:11.1822681Z  return json_response 2025-04-21T20:25:11.1823105Z  2025-04-21T20:25:11.1823425Z  2025-04-21T20:25:11.1823992Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-04-21T20:25:11.1824922Z  """ 2025-04-21T20:25:11.1825465Z  Dynamically get the latest list of labels from the pull request 2025-04-21T20:25:11.1826102Z  """ 2025-04-21T20:25:11.1826599Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-04-21T20:25:11.1827192Z  return { 2025-04-21T20:25:11.1827792Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-04-21T20:25:11.1828458Z  } 2025-04-21T20:25:11.1828807Z  2025-04-21T20:25:11.1829134Z  2025-04-21T20:25:11.1829472Z def main() -> None: 2025-04-21T20:25:11.1829910Z  args = parse_args() 2025-04-21T20:25:11.1830600Z  2025-04-21T20:25:11.1831022Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-04-21T20:25:11.1831544Z  2025-04-21T20:25:11.1831914Z  # Check if the PR is opt-out 2025-04-21T20:25:11.1832408Z  if args.pr_number: 2025-04-21T20:25:11.1833083Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-04-21T20:25:11.1833833Z  if OPT_OUT_LABEL in labels: 2025-04-21T20:25:11.1834322Z  log.info( 2025-04-21T20:25:11.1835025Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-04-21T20:25:11.1835941Z  ) 2025-04-21T20:25:11.1836533Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-04-21T20:25:11.1837392Z  sys.exit() 2025-04-21T20:25:11.1837821Z  2025-04-21T20:25:11.1838155Z  try: 2025-04-21T20:25:11.1838597Z  rollout_state = get_rollout_state_from_issue( 2025-04-21T20:25:11.1839300Z  args.github_token, args.github_issue_repo, args.github_issue 2025-04-21T20:25:11.1839908Z  ) 2025-04-21T20:25:11.1840420Z  2025-04-21T20:25:11.1840798Z  username = get_potential_pr_author( 2025-04-21T20:25:11.1841325Z  args.github_token, 2025-04-21T20:25:11.1841853Z  args.github_repo, 2025-04-21T20:25:11.1842324Z  args.github_actor, 2025-04-21T20:25:11.1842819Z  args.github_ref_type, 2025-04-21T20:25:11.1843310Z  args.github_branch, 2025-04-21T20:25:11.1843769Z  ) 2025-04-21T20:25:11.1844122Z  2025-04-21T20:25:11.1844584Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-04-21T20:25:11.1845170Z  2025-04-21T20:25:11.1845569Z  runner_label_prefix = get_runner_prefix( 2025-04-21T20:25:11.1846109Z  rollout_state, 2025-04-21T20:25:11.1846604Z  (args.github_issue_owner, username), 2025-04-21T20:25:11.1847139Z  args.github_branch, 2025-04-21T20:25:11.1847640Z  args.eligible_experiments, 2025-04-21T20:25:11.1848144Z  is_canary, 2025-04-21T20:25:11.1848720Z  ) 2025-04-21T20:25:11.1849085Z  2025-04-21T20:25:11.1849433Z  except Exception as e: 2025-04-21T20:25:11.1849899Z  log.error( 2025-04-21T20:25:11.1851081Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-04-21T20:25:11.1852322Z  ) 2025-04-21T20:25:11.1852912Z  2025-04-21T20:25:11.1853707Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-04-21T20:25:11.1854673Z  2025-04-21T20:25:11.1855143Z  2025-04-21T20:25:11.1855665Z if __name__ == "__main__": 2025-04-21T20:25:11.1856372Z  main() 2025-04-21T20:25:11.1856964Z  2025-04-21T20:25:11.1857498Z EOF 2025-04-21T20:25:11.1857847Z  2025-04-21T20:25:11.1858209Z cat runner_determinator.py 2025-04-21T20:25:11.2392432Z shell: /usr/bin/bash -e {0} 2025-04-21T20:25:11.2393244Z env: 2025-04-21T20:25:11.2393941Z GITHUB_TOKEN: *** 2025-04-21T20:25:11.2394324Z ISSUE_NUMBER: 5132 2025-04-21T20:25:11.2394749Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-04-21T20:25:11.2395208Z ISSUE_OWNER: 2025-04-21T20:25:11.2395594Z CHECK_EXPERIMENTS: 2025-04-21T20:25:11.2395970Z PR_NUMBER: 2025-04-21T20:25:11.2396322Z ##[endgroup] 2025-04-21T20:25:11.2688267Z # flake8: noqa: G004 2025-04-21T20:25:11.2688786Z 2025-04-21T20:25:11.2689495Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-04-21T20:25:11.2691402Z # must be kept in sync. You can do it easily by running the following command: 2025-04-21T20:25:11.2692805Z # python .github/scripts/update_runner_determinator.py 2025-04-21T20:25:11.2693571Z 2025-04-21T20:25:11.2693822Z """ 2025-04-21T20:25:11.2694791Z This runner determinator is used to determine which set of runners to run a 2025-04-21T20:25:11.2696325Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-04-21T20:25:11.2697875Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-04-21T20:25:11.2699262Z of which runners should be used to run which job. 2025-04-21T20:25:11.2700959Z 2025-04-21T20:25:11.2701658Z The configuration has two parts, the settings and a list of opted-in users, 2025-04-21T20:25:11.2703234Z separated by a line containing "---". If the line is not present, the 2025-04-21T20:25:11.2704731Z settings are considered to be empty with only the second part, the user 2025-04-21T20:25:11.2705916Z list, defined. 2025-04-21T20:25:11.2706311Z 2025-04-21T20:25:11.2706912Z The first part is a YAML block that defines the rollout settings. This can be 2025-04-21T20:25:11.2708452Z used to define any settings that are needed to determine which runners to use. 2025-04-21T20:25:11.2709829Z It's fields are defined by the RolloutSettings class below. 2025-04-21T20:25:11.2710793Z 2025-04-21T20:25:11.2711428Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-04-21T20:25:11.2712894Z The user list is also a comma separated list of additional features or 2025-04-21T20:25:11.2714115Z experiments which the user could be opted in to. 2025-04-21T20:25:11.2714797Z 2025-04-21T20:25:11.2715107Z The user list has the following rules: 2025-04-21T20:25:11.2715677Z 2025-04-21T20:25:11.2716163Z - Users are GitHub usernames, which must start with the @ prefix 2025-04-21T20:25:11.2717657Z - Each user is also a comma-separated list of features/experiments to enable 2025-04-21T20:25:11.2719078Z - A "#" prefix opts the user out of all experiments 2025-04-21T20:25:11.2719745Z 2025-04-21T20:25:11.2719998Z Example config: 2025-04-21T20:25:11.2720995Z # A list of experiments that can be opted into. 2025-04-21T20:25:11.2722150Z # This defines the behavior they'll induce when opted into. 2025-04-21T20:25:11.2723269Z # Expected syntax is: 2025-04-21T20:25:11.2724365Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-04-21T20:25:11.2726363Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-04-21T20:25:11.2727463Z 2025-04-21T20:25:11.2727751Z experiments: 2025-04-21T20:25:11.2728373Z lf: 2025-04-21T20:25:11.2728976Z rollout_percent: 25 2025-04-21T20:25:11.2729717Z all_branches: false 2025-04-21T20:25:11.2730797Z default: true 2025-04-21T20:25:11.2731457Z --- 2025-04-21T20:25:11.2731795Z 2025-04-21T20:25:11.2732046Z # Opt-ins: 2025-04-21T20:25:11.2732995Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-04-21T20:25:11.2734484Z # and specifying experiments to enable in a comma-separated list. 2025-04-21T20:25:11.2735837Z # To always opt out of an experiment, prefix it with a "-". 2025-04-21T20:25:11.2736995Z # Experiments should be from the above list. 2025-04-21T20:25:11.2737683Z 2025-04-21T20:25:11.2737994Z @User1,-lf,split_build 2025-04-21T20:25:11.2738741Z @User2,lf 2025-04-21T20:25:11.2739426Z @User3,split_build 2025-04-21T20:25:11.2740443Z """ 2025-04-21T20:25:11.2740780Z 2025-04-21T20:25:11.2741033Z import json 2025-04-21T20:25:11.2741628Z import logging 2025-04-21T20:25:11.2742244Z import os 2025-04-21T20:25:11.2742818Z import random 2025-04-21T20:25:11.2743403Z import re 2025-04-21T20:25:11.2743973Z import sys 2025-04-21T20:25:11.2744603Z from argparse import ArgumentParser 2025-04-21T20:25:11.2745467Z from collections.abc import Iterable 2025-04-21T20:25:11.2746352Z from functools import cache 2025-04-21T20:25:11.2747180Z from logging import LogRecord 2025-04-21T20:25:11.2748026Z from typing import Any, NamedTuple 2025-04-21T20:25:11.2748968Z from urllib.request import Request, urlopen 2025-04-21T20:25:11.2749594Z 2025-04-21T20:25:11.2749867Z import yaml 2025-04-21T20:25:11.2750765Z from github import Auth, Github 2025-04-21T20:25:11.2751573Z from github.Issue import Issue 2025-04-21T20:25:11.2752079Z 2025-04-21T20:25:11.2752090Z 2025-04-21T20:25:11.2752461Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-04-21T20:25:11.2753612Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-04-21T20:25:11.2755100Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-04-21T20:25:11.2756415Z 2025-04-21T20:25:11.2756788Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-04-21T20:25:11.2757731Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-04-21T20:25:11.2758523Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-04-21T20:25:11.2759408Z OPT_OUT_LABEL = "no-runner-experiments" 2025-04-21T20:25:11.2760003Z 2025-04-21T20:25:11.2760554Z SETTING_EXPERIMENTS = "experiments" 2025-04-21T20:25:11.2761117Z 2025-04-21T20:25:11.2761400Z LF_FLEET_EXPERIMENT = "lf" 2025-04-21T20:25:11.2762119Z CANARY_FLEET_SUFFIX = ".c" 2025-04-21T20:25:11.2762582Z 2025-04-21T20:25:11.2762592Z 2025-04-21T20:25:11.2762876Z class Experiment(NamedTuple): 2025-04-21T20:25:11.2763634Z rollout_perc: float = ( 2025-04-21T20:25:11.2764652Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-04-21T20:25:11.2765800Z ) 2025-04-21T20:25:11.2766359Z all_branches: bool = ( 2025-04-21T20:25:11.2767395Z False # If True, the experiment is also enabled on the exception branches 2025-04-21T20:25:11.2768527Z ) 2025-04-21T20:25:11.2769134Z default: bool = ( 2025-04-21T20:25:11.2770306Z True # If True, the experiment is enabled by default for all queries 2025-04-21T20:25:11.2771406Z ) 2025-04-21T20:25:11.2771741Z 2025-04-21T20:25:11.2772049Z # Add more fields as needed 2025-04-21T20:25:11.2772572Z 2025-04-21T20:25:11.2772582Z 2025-04-21T20:25:11.2772879Z class Settings(NamedTuple): 2025-04-21T20:25:11.2773586Z """ 2025-04-21T20:25:11.2774296Z Settings for the experiments that can be opted into. 2025-04-21T20:25:11.2775232Z """ 2025-04-21T20:25:11.2775544Z 2025-04-21T20:25:11.2775868Z experiments: dict[str, Experiment] = {} 2025-04-21T20:25:11.2776477Z 2025-04-21T20:25:11.2776487Z 2025-04-21T20:25:11.2777131Z class ColorFormatter(logging.Formatter): 2025-04-21T20:25:11.2778169Z """Color codes the log messages based on the log level""" 2025-04-21T20:25:11.2778913Z 2025-04-21T20:25:11.2779176Z COLORS = { 2025-04-21T20:25:11.2779805Z "WARNING": "\033[33m", # Yellow 2025-04-21T20:25:11.2780866Z "ERROR": "\033[31m", # Red 2025-04-21T20:25:11.2781696Z "CRITICAL": "\033[31m", # Red 2025-04-21T20:25:11.2782514Z "INFO": "\033[0m", # Reset 2025-04-21T20:25:11.2783302Z "DEBUG": "\033[0m", # Reset 2025-04-21T20:25:11.2784058Z } 2025-04-21T20:25:11.2784393Z 2025-04-21T20:25:11.2784822Z def format(self, record: LogRecord) -> str: 2025-04-21T20:25:11.2786124Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-04-21T20:25:11.2787498Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-04-21T20:25:11.2788506Z return super().format(record) 2025-04-21T20:25:11.2789092Z 2025-04-21T20:25:11.2789105Z 2025-04-21T20:25:11.2789449Z handler = logging.StreamHandler() 2025-04-21T20:25:11.2790874Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-04-21T20:25:11.2791884Z 2025-04-21T20:25:11.2792318Z log = logging.getLogger(os.path.basename(__file__)) 2025-04-21T20:25:11.2793303Z log.addHandler(handler) 2025-04-21T20:25:11.2794036Z log.setLevel(logging.INFO) 2025-04-21T20:25:11.2794519Z 2025-04-21T20:25:11.2794530Z 2025-04-21T20:25:11.2794935Z def set_github_output(key: str, value: str) -> None: 2025-04-21T20:25:11.2795913Z """ 2025-04-21T20:25:11.2796773Z Defines outputs of the github action that invokes this script 2025-04-21T20:25:11.2797867Z """ 2025-04-21T20:25:11.2798464Z if not GITHUB_OUTPUT: 2025-04-21T20:25:11.2800526Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-04-21T20:25:11.2802550Z log.warning( 2025-04-21T20:25:11.2804019Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-04-21T20:25:11.2805595Z ) 2025-04-21T20:25:11.2818705Z print(f"::set-output name={key}::{value}") 2025-04-21T20:25:11.2819583Z return 2025-04-21T20:25:11.2819794Z 2025-04-21T20:25:11.2819986Z with open(GITHUB_OUTPUT, "a") as f: 2025-04-21T20:25:11.2820726Z log.info(f"Setting output: {key}='{value}'") 2025-04-21T20:25:11.2821259Z f.write(f"{key}={value}\n") 2025-04-21T20:25:11.2821557Z 2025-04-21T20:25:11.2821564Z 2025-04-21T20:25:11.2821847Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-04-21T20:25:11.2822425Z return frozenset( 2025-04-21T20:25:11.2822984Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-04-21T20:25:11.2823613Z ) 2025-04-21T20:25:11.2823799Z 2025-04-21T20:25:11.2823805Z 2025-04-21T20:25:11.2823978Z def parse_args() -> Any: 2025-04-21T20:25:11.2824493Z parser = ArgumentParser("Get dynamic rollout settings") 2025-04-21T20:25:11.2825283Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-04-21T20:25:11.2826001Z parser.add_argument( 2025-04-21T20:25:11.2826421Z "--github-issue-repo", 2025-04-21T20:25:11.2826878Z type=str, 2025-04-21T20:25:11.2827227Z required=False, 2025-04-21T20:25:11.2827636Z default="pytorch/test-infra", 2025-04-21T20:25:11.2828123Z help="GitHub repo to get the issue", 2025-04-21T20:25:11.2828581Z ) 2025-04-21T20:25:11.2828912Z parser.add_argument( 2025-04-21T20:25:11.2829316Z "--github-repo", 2025-04-21T20:25:11.2829698Z type=str, 2025-04-21T20:25:11.2830053Z required=True, 2025-04-21T20:25:11.2830571Z help="GitHub repo where CI is running", 2025-04-21T20:25:11.2831046Z ) 2025-04-21T20:25:11.2831374Z parser.add_argument( 2025-04-21T20:25:11.2831921Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-04-21T20:25:11.2832656Z ) 2025-04-21T20:25:11.2832993Z parser.add_argument( 2025-04-21T20:25:11.2833558Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-04-21T20:25:11.2834217Z ) 2025-04-21T20:25:11.2834539Z parser.add_argument( 2025-04-21T20:25:11.2835107Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-04-21T20:25:11.2835736Z ) 2025-04-21T20:25:11.2836047Z parser.add_argument( 2025-04-21T20:25:11.2836633Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-04-21T20:25:11.2837271Z ) 2025-04-21T20:25:11.2837591Z parser.add_argument( 2025-04-21T20:25:11.2837984Z "--github-ref-type", 2025-04-21T20:25:11.2838392Z type=str, 2025-04-21T20:25:11.2838738Z required=True, 2025-04-21T20:25:11.2839169Z help="Current GitHub ref type, branch or tag", 2025-04-21T20:25:11.2839767Z ) 2025-04-21T20:25:11.2840280Z parser.add_argument( 2025-04-21T20:25:11.2840824Z "--eligible-experiments", 2025-04-21T20:25:11.2841296Z type=_str_comma_separated_to_set, 2025-04-21T20:25:11.2841763Z required=False, 2025-04-21T20:25:11.2842139Z default="", 2025-04-21T20:25:11.2842925Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-04-21T20:25:11.2843769Z ) 2025-04-21T20:25:11.2844098Z parser.add_argument( 2025-04-21T20:25:11.2844483Z "--pr-number", 2025-04-21T20:25:11.2844848Z type=str, 2025-04-21T20:25:11.2845205Z required=False, 2025-04-21T20:25:11.2845574Z default="", 2025-04-21T20:25:11.2845995Z help="the optional PR number where this is run", 2025-04-21T20:25:11.2846493Z ) 2025-04-21T20:25:11.2846688Z 2025-04-21T20:25:11.2846866Z return parser.parse_args() 2025-04-21T20:25:11.2847147Z 2025-04-21T20:25:11.2847153Z 2025-04-21T20:25:11.2847525Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-04-21T20:25:11.2848219Z auth = Auth.Token(github_token) 2025-04-21T20:25:11.2848681Z return Github(auth=auth) 2025-04-21T20:25:11.2849151Z 2025-04-21T20:25:11.2849157Z 2025-04-21T20:25:11.2849569Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-04-21T20:25:11.2850580Z repo = gh.get_repo(repo) 2025-04-21T20:25:11.2851037Z return repo.get_issue(number=issue_num) 2025-04-21T20:25:11.2851378Z 2025-04-21T20:25:11.2851386Z 2025-04-21T20:25:11.2851555Z def get_potential_pr_author( 2025-04-21T20:25:11.2852268Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-04-21T20:25:11.2852973Z ) -> str: 2025-04-21T20:25:11.2853452Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-04-21T20:25:11.2854202Z # Fetch the actual username from the original PR. The PR number is 2025-04-21T20:25:11.2854895Z # embedded in the tag name: ciflow// 2025-04-21T20:25:11.2855275Z 2025-04-21T20:25:11.2855447Z gh = get_gh_client(github_token) 2025-04-21T20:25:11.2855757Z 2025-04-21T20:25:11.2855999Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-04-21T20:25:11.2856569Z split_tag = ref_name.split("/") 2025-04-21T20:25:11.2857029Z if ( 2025-04-21T20:25:11.2857384Z len(split_tag) == 3 2025-04-21T20:25:11.2857817Z and split_tag[0] == "ciflow" 2025-04-21T20:25:11.2858291Z and split_tag[2].isnumeric() 2025-04-21T20:25:11.2858724Z ): 2025-04-21T20:25:11.2859080Z pr_number = split_tag[2] 2025-04-21T20:25:11.2859515Z try: 2025-04-21T20:25:11.2859899Z repository = gh.get_repo(repo) 2025-04-21T20:25:11.2860594Z pull = repository.get_pull(number=int(pr_number)) 2025-04-21T20:25:11.2861143Z except Exception as e: 2025-04-21T20:25:11.2861615Z raise Exception( # noqa: TRY002 2025-04-21T20:25:11.2862466Z f"issue with pull request {pr_number} from repo {repository}" 2025-04-21T20:25:11.2863079Z ) from e 2025-04-21T20:25:11.2863568Z return pull.user.login # type: ignore[no-any-return] 2025-04-21T20:25:11.2864223Z # In all other cases, return the original input username 2025-04-21T20:25:11.2864753Z return username 2025-04-21T20:25:11.2864975Z 2025-04-21T20:25:11.2864981Z 2025-04-21T20:25:11.2865182Z def is_exception_branch(branch: str) -> bool: 2025-04-21T20:25:11.2865662Z """ 2025-04-21T20:25:11.2866246Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-04-21T20:25:11.2866993Z """ 2025-04-21T20:25:11.2867487Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-04-21T20:25:11.2867965Z 2025-04-21T20:25:11.2867977Z 2025-04-21T20:25:11.2868153Z def load_yaml(yaml_text: str) -> Any: 2025-04-21T20:25:11.2868592Z try: 2025-04-21T20:25:11.2868942Z data = yaml.safe_load(yaml_text) 2025-04-21T20:25:11.2869396Z return data 2025-04-21T20:25:11.2869769Z except yaml.YAMLError: 2025-04-21T20:25:11.2870344Z log.exception("Error loading YAML") 2025-04-21T20:25:11.2870827Z raise 2025-04-21T20:25:11.2871021Z 2025-04-21T20:25:11.2871027Z 2025-04-21T20:25:11.2871415Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-04-21T20:25:11.2872092Z """ 2025-04-21T20:25:11.2872650Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-04-21T20:25:11.2873203Z 2025-04-21T20:25:11.2873519Z If the issue body contains "---" then the text above that is the settings 2025-04-21T20:25:11.2874224Z and the text below is the list of opted in users. 2025-04-21T20:25:11.2874595Z 2025-04-21T20:25:11.2874943Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-04-21T20:25:11.2875577Z """ 2025-04-21T20:25:11.2875981Z rollout_state_parts = rollout_state.split("---") 2025-04-21T20:25:11.2876516Z if len(rollout_state_parts) >= 2: 2025-04-21T20:25:11.2926949Z return rollout_state_parts[0], rollout_state_parts[1] 2025-04-21T20:25:11.2928389Z else: 2025-04-21T20:25:11.2928803Z return "", rollout_state 2025-04-21T20:25:11.2929116Z 2025-04-21T20:25:11.2929121Z 2025-04-21T20:25:11.2929312Z class UserOptins(dict[str, list[str]]): 2025-04-21T20:25:11.2929786Z """ 2025-04-21T20:25:11.2930509Z Dictionary of users with a list of features they have opted into 2025-04-21T20:25:11.2931128Z """ 2025-04-21T20:25:11.2931362Z 2025-04-21T20:25:11.2931371Z 2025-04-21T20:25:11.2931765Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-04-21T20:25:11.2932368Z """ 2025-04-21T20:25:11.2933031Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-04-21T20:25:11.2933677Z 2025-04-21T20:25:11.2934359Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-04-21T20:25:11.2935444Z - Example line: "@User1,lf,split_build" 2025-04-21T20:25:11.2936119Z - A "#" prefix indicates the user is opted out of all experiments 2025-04-21T20:25:11.2936566Z 2025-04-21T20:25:11.2936572Z 2025-04-21T20:25:11.2936713Z """ 2025-04-21T20:25:11.2937051Z optins = UserOptins() 2025-04-21T20:25:11.2937494Z for user in user_optin_text.split("\n"): 2025-04-21T20:25:11.2938011Z user = user.strip("\r\n\t -") 2025-04-21T20:25:11.2938508Z if not user or not user.startswith("@"): 2025-04-21T20:25:11.2939014Z # Not a valid user. Skip 2025-04-21T20:25:11.2939460Z continue 2025-04-21T20:25:11.2939683Z 2025-04-21T20:25:11.2939825Z if user: 2025-04-21T20:25:11.2940406Z usr_name = user.split(",")[0].strip("@") 2025-04-21T20:25:11.2941245Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-04-21T20:25:11.2941719Z 2025-04-21T20:25:11.2941869Z return optins 2025-04-21T20:25:11.2942084Z 2025-04-21T20:25:11.2942091Z 2025-04-21T20:25:11.2942350Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-04-21T20:25:11.2942907Z """ 2025-04-21T20:25:11.2943267Z Check if the experiment name is valid. 2025-04-21T20:25:11.2943730Z A valid name: 2025-04-21T20:25:11.2944319Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-04-21T20:25:11.2945173Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-04-21T20:25:11.2945825Z - Cannot contain spaces 2025-04-21T20:25:11.2946232Z """ 2025-04-21T20:25:11.2946414Z 2025-04-21T20:25:11.2946651Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-04-21T20:25:11.2947291Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-04-21T20:25:11.2947699Z 2025-04-21T20:25:11.2947842Z if valid: 2025-04-21T20:25:11.2948191Z return True 2025-04-21T20:25:11.2948404Z 2025-04-21T20:25:11.2948549Z log.error( 2025-04-21T20:25:11.2949886Z 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-04-21T20:25:11.2951648Z ) 2025-04-21T20:25:11.2951975Z return False 2025-04-21T20:25:11.2952192Z 2025-04-21T20:25:11.2952204Z 2025-04-21T20:25:11.2952483Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-04-21T20:25:11.2953048Z """ 2025-04-21T20:25:11.2953600Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-04-21T20:25:11.2954257Z """ 2025-04-21T20:25:11.2954580Z try: 2025-04-21T20:25:11.2954918Z if settings_text: 2025-04-21T20:25:11.2955574Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-04-21T20:25:11.2956311Z # for easy reading 2025-04-21T20:25:11.2957029Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-04-21T20:25:11.2958052Z # the backtick character in shell commands. 2025-04-21T20:25:11.2958602Z backtick = chr(96) # backtick character 2025-04-21T20:25:11.2959215Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-04-21T20:25:11.2959820Z settings = load_yaml(settings_text) 2025-04-21T20:25:11.2960372Z 2025-04-21T20:25:11.2960748Z # For now we just load experiments. We can expand this if/when we add more settings 2025-04-21T20:25:11.2961437Z experiments = {} 2025-04-21T20:25:11.2961706Z 2025-04-21T20:25:11.2962026Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-04-21T20:25:11.2962715Z if not is_valid_experiment_name(exp_name): 2025-04-21T20:25:11.2963738Z # 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-04-21T20:25:11.2964706Z continue 2025-04-21T20:25:11.2964964Z 2025-04-21T20:25:11.2965131Z valid_settings = {} 2025-04-21T20:25:11.2965594Z for setting in exp_settings: 2025-04-21T20:25:11.2966105Z if setting not in Experiment._fields: 2025-04-21T20:25:11.2966602Z log.warning( 2025-04-21T20:25:11.2967236Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-04-21T20:25:11.2967879Z ) 2025-04-21T20:25:11.2968262Z else: 2025-04-21T20:25:11.2968728Z valid_settings[setting] = exp_settings[setting] 2025-04-21T20:25:11.2969112Z 2025-04-21T20:25:11.2969359Z experiments[exp_name] = Experiment(**valid_settings) 2025-04-21T20:25:11.2970259Z return Settings(experiments) 2025-04-21T20:25:11.2970688Z 2025-04-21T20:25:11.2970849Z except Exception: 2025-04-21T20:25:11.2971288Z log.exception("Failed to parse settings") 2025-04-21T20:25:11.2971650Z 2025-04-21T20:25:11.2971795Z return Settings() 2025-04-21T20:25:11.2972032Z 2025-04-21T20:25:11.2972038Z 2025-04-21T20:25:11.2972263Z def parse_settings(rollout_state: str) -> Settings: 2025-04-21T20:25:11.2972783Z """ 2025-04-21T20:25:11.2973162Z Parse settings, if any, from the rollout state. 2025-04-21T20:25:11.2973532Z 2025-04-21T20:25:11.2973843Z If the issue body contains "---" then the text above that is the settings 2025-04-21T20:25:11.2974522Z and the text below is the list of opted in users. 2025-04-21T20:25:11.2974892Z 2025-04-21T20:25:11.2975302Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-04-21T20:25:11.2975971Z """ 2025-04-21T20:25:11.2976465Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-04-21T20:25:11.2977147Z return parse_settings_from_text(settings_text) 2025-04-21T20:25:11.2977511Z 2025-04-21T20:25:11.2977517Z 2025-04-21T20:25:11.2977740Z def parse_users(rollout_state: str) -> UserOptins: 2025-04-21T20:25:11.2978245Z """ 2025-04-21T20:25:11.2978587Z Parse users from the rollout state. 2025-04-21T20:25:11.2978910Z 2025-04-21T20:25:11.2979046Z """ 2025-04-21T20:25:11.2979519Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-04-21T20:25:11.2980360Z return parse_user_opt_in_from_text(users_text) 2025-04-21T20:25:11.2980731Z 2025-04-21T20:25:11.2980738Z 2025-04-21T20:25:11.2981123Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-04-21T20:25:11.2981795Z """ 2025-04-21T20:25:11.2982170Z Check if a user is opted into an experiment 2025-04-21T20:25:11.2982647Z """ 2025-04-21T20:25:11.2983044Z return experiment_name in user_optins.get(user, []) 2025-04-21T20:25:11.2983427Z 2025-04-21T20:25:11.2983434Z 2025-04-21T20:25:11.2983818Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-04-21T20:25:11.2984744Z """ 2025-04-21T20:25:11.2985154Z Check if a user explicitly opted out of an experiment 2025-04-21T20:25:11.2985670Z """ 2025-04-21T20:25:11.2986121Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-04-21T20:25:11.2986733Z experiment_optout = "-" + experiment_name 2025-04-21T20:25:11.2987314Z if experiment_optout not in user_optins.get(user, []): 2025-04-21T20:25:11.2987850Z return False 2025-04-21T20:25:11.2988078Z 2025-04-21T20:25:11.2988316Z if is_user_opted_in(user, user_optins, experiment_name): 2025-04-21T20:25:11.2988867Z log.warning( 2025-04-21T20:25:11.2989587Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-04-21T20:25:11.2990622Z ) 2025-04-21T20:25:11.2990815Z 2025-04-21T20:25:11.2990960Z return True 2025-04-21T20:25:11.2991171Z 2025-04-21T20:25:11.2991178Z 2025-04-21T20:25:11.2991333Z def get_runner_prefix( 2025-04-21T20:25:11.2991726Z rollout_state: str, 2025-04-21T20:25:11.2992141Z workflow_requestors: Iterable[str], 2025-04-21T20:25:11.2992604Z branch: str, 2025-04-21T20:25:11.2993036Z eligible_experiments: frozenset[str] = frozenset(), 2025-04-21T20:25:11.2993568Z is_canary: bool = False, 2025-04-21T20:25:11.2993965Z ) -> str: 2025-04-21T20:25:11.2994349Z settings = parse_settings(rollout_state) 2025-04-21T20:25:11.2994867Z user_optins = parse_users(rollout_state) 2025-04-21T20:25:11.2995205Z 2025-04-21T20:25:11.2995355Z fleet_prefix = "" 2025-04-21T20:25:11.2995720Z prefixes = [] 2025-04-21T20:25:11.2996278Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-04-21T20:25:11.2997128Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-04-21T20:25:11.2997916Z log.info( 2025-04-21T20:25:11.2998535Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-04-21T20:25:11.2999220Z ) 2025-04-21T20:25:11.2999551Z continue 2025-04-21T20:25:11.2999769Z 2025-04-21T20:25:11.2999936Z if eligible_experiments: 2025-04-21T20:25:11.3000639Z if experiment_name not in eligible_experiments: 2025-04-21T20:25:11.3001216Z exp_list = ", ".join(eligible_experiments) 2025-04-21T20:25:11.3001712Z log.info( 2025-04-21T20:25:11.3002449Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-04-21T20:25:11.3003203Z ) 2025-04-21T20:25:11.3003555Z continue 2025-04-21T20:25:11.3003973Z elif not experiment_settings.default: 2025-04-21T20:25:11.3004458Z log.info( 2025-04-21T20:25:11.3005047Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-04-21T20:25:11.3005712Z ) 2025-04-21T20:25:11.3006046Z continue 2025-04-21T20:25:11.3006273Z 2025-04-21T20:25:11.3006524Z # Is any workflow_requestor opted out to this experiment? 2025-04-21T20:25:11.3007084Z opted_out_users = [ 2025-04-21T20:25:11.3007484Z requestor 2025-04-21T20:25:11.3007892Z for requestor in workflow_requestors 2025-04-21T20:25:11.3008491Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-04-21T20:25:11.3009056Z ] 2025-04-21T20:25:11.3009230Z 2025-04-21T20:25:11.3009387Z if opted_out_users: 2025-04-21T20:25:11.3009783Z log.info( 2025-04-21T20:25:11.3010556Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-04-21T20:25:11.3011192Z ) 2025-04-21T20:25:11.3011532Z continue 2025-04-21T20:25:11.3011759Z 2025-04-21T20:25:11.3012004Z # Is any workflow_requestor opted in to this experiment? 2025-04-21T20:25:11.3012554Z opted_in_users = [ 2025-04-21T20:25:11.3012942Z requestor 2025-04-21T20:25:11.3013520Z for requestor in workflow_requestors 2025-04-21T20:25:11.3014102Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-04-21T20:25:11.3014666Z ] 2025-04-21T20:25:11.3014847Z 2025-04-21T20:25:11.3015002Z enabled = False 2025-04-21T20:25:11.3015385Z if opted_in_users: 2025-04-21T20:25:11.3015781Z log.info( 2025-04-21T20:25:11.3016305Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-04-21T20:25:11.3016913Z ) 2025-04-21T20:25:11.3017244Z enabled = True 2025-04-21T20:25:11.3017497Z 2025-04-21T20:25:11.3017688Z elif experiment_settings.rollout_perc: 2025-04-21T20:25:11.3018444Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-04-21T20:25:11.3019307Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-04-21T20:25:11.3019902Z log.info( 2025-04-21T20:25:11.3020952Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-04-21T20:25:11.3021808Z ) 2025-04-21T20:25:11.3022162Z enabled = True 2025-04-21T20:25:11.3022436Z 2025-04-21T20:25:11.3022580Z if enabled: 2025-04-21T20:25:11.3022947Z label = experiment_name 2025-04-21T20:25:11.3023437Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-04-21T20:25:11.3024185Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-04-21T20:25:11.3024966Z # - If it's enabled, then we always list it's prefix first 2025-04-21T20:25:11.3025793Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-04-21T20:25:11.3026400Z if is_canary: 2025-04-21T20:25:11.3026892Z label += CANARY_FLEET_SUFFIX 2025-04-21T20:25:11.3027392Z fleet_prefix = label 2025-04-21T20:25:11.3027827Z else: 2025-04-21T20:25:11.3028208Z prefixes.append(label) 2025-04-21T20:25:11.3028521Z 2025-04-21T20:25:11.3028679Z if len(prefixes) > 1: 2025-04-21T20:25:11.3029073Z log.error( 2025-04-21T20:25:11.3030008Z 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-04-21T20:25:11.3031292Z ) 2025-04-21T20:25:11.3031639Z prefixes = prefixes[:1] 2025-04-21T20:25:11.3031921Z 2025-04-21T20:25:11.3032187Z # Fleet always comes first 2025-04-21T20:25:11.3032657Z if fleet_prefix: 2025-04-21T20:25:11.3033057Z prefixes.insert(0, fleet_prefix) 2025-04-21T20:25:11.3033380Z 2025-04-21T20:25:11.3033616Z return ".".join(prefixes) + "." if prefixes else "" 2025-04-21T20:25:11.3033991Z 2025-04-21T20:25:11.3033997Z 2025-04-21T20:25:11.3034392Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-04-21T20:25:11.3035097Z """ 2025-04-21T20:25:11.3035621Z Gets the first comment of the issue, which contains the desired rollout state. 2025-04-21T20:25:11.3036134Z 2025-04-21T20:25:11.3036487Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-04-21T20:25:11.3037124Z """ 2025-04-21T20:25:11.3037464Z gh = get_gh_client(github_token) 2025-04-21T20:25:11.3037950Z issue = get_issue(gh, repo, issue_num) 2025-04-21T20:25:11.3038516Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-04-21T20:25:11.3038920Z 2025-04-21T20:25:11.3038926Z 2025-04-21T20:25:11.3039282Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-04-21T20:25:11.3039969Z for _ in range(num_retries): 2025-04-21T20:25:11.3040618Z try: 2025-04-21T20:25:11.3040998Z req = Request(url=url, headers=headers) 2025-04-21T20:25:11.3041601Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-04-21T20:25:11.3042373Z return json.loads(content) 2025-04-21T20:25:11.3042839Z except Exception as e: 2025-04-21T20:25:11.3043320Z log.warning(f"Could not download {url}: {e}") 2025-04-21T20:25:11.3043683Z 2025-04-21T20:25:11.3044027Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-04-21T20:25:11.3044670Z return {} 2025-04-21T20:25:11.3044864Z 2025-04-21T20:25:11.3044870Z 2025-04-21T20:25:11.3045014Z @cache 2025-04-21T20:25:11.3045564Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-04-21T20:25:11.3046248Z """ 2025-04-21T20:25:11.3046587Z Dynamically get PR information 2025-04-21T20:25:11.3047022Z """ 2025-04-21T20:25:11.3047469Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-04-21T20:25:11.3048026Z headers = { 2025-04-21T20:25:11.3048430Z "Accept": "application/vnd.github.v3+json", 2025-04-21T20:25:11.3048967Z "Authorization": f"token {github_token}", 2025-04-21T20:25:11.3049451Z } 2025-04-21T20:25:11.3049815Z json_response: dict[str, Any] = download_json( 2025-04-21T20:25:11.3050600Z url=f"{github_api}/issues/{pr_number}", 2025-04-21T20:25:11.3051086Z headers=headers, 2025-04-21T20:25:11.3051463Z ) 2025-04-21T20:25:11.3051661Z 2025-04-21T20:25:11.3051830Z if not json_response: 2025-04-21T20:25:11.3052335Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-04-21T20:25:11.3052875Z return {} 2025-04-21T20:25:11.3053088Z 2025-04-21T20:25:11.3053244Z return json_response 2025-04-21T20:25:11.3053490Z 2025-04-21T20:25:11.3053496Z 2025-04-21T20:25:11.3053857Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-04-21T20:25:11.3054630Z """ 2025-04-21T20:25:11.3055110Z Dynamically get the latest list of labels from the pull request 2025-04-21T20:25:11.3055686Z """ 2025-04-21T20:25:11.3056111Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-04-21T20:25:11.3056645Z return { 2025-04-21T20:25:11.3057159Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-04-21T20:25:11.3057782Z } 2025-04-21T20:25:11.3057954Z 2025-04-21T20:25:11.3057961Z 2025-04-21T20:25:11.3058115Z def main() -> None: 2025-04-21T20:25:11.3058485Z args = parse_args() 2025-04-21T20:25:11.3058721Z 2025-04-21T20:25:11.3058912Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-04-21T20:25:11.3059263Z 2025-04-21T20:25:11.3059429Z # Check if the PR is opt-out 2025-04-21T20:25:11.3059855Z if args.pr_number: 2025-04-21T20:25:11.3060649Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-04-21T20:25:11.3061335Z if OPT_OUT_LABEL in labels: 2025-04-21T20:25:11.3061774Z log.info( 2025-04-21T20:25:11.3062390Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-04-21T20:25:11.3063085Z ) 2025-04-21T20:25:11.3063581Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-04-21T20:25:11.3064174Z sys.exit() 2025-04-21T20:25:11.3064409Z 2025-04-21T20:25:11.3064551Z try: 2025-04-21T20:25:11.3064931Z rollout_state = get_rollout_state_from_issue( 2025-04-21T20:25:11.3065568Z args.github_token, args.github_issue_repo, args.github_issue 2025-04-21T20:25:11.3066135Z ) 2025-04-21T20:25:11.3066317Z 2025-04-21T20:25:11.3066496Z username = get_potential_pr_author( 2025-04-21T20:25:11.3066985Z args.github_token, 2025-04-21T20:25:11.3067410Z args.github_repo, 2025-04-21T20:25:11.3067831Z args.github_actor, 2025-04-21T20:25:11.3068252Z args.github_ref_type, 2025-04-21T20:25:11.3068696Z args.github_branch, 2025-04-21T20:25:11.3069098Z ) 2025-04-21T20:25:11.3069289Z 2025-04-21T20:25:11.3069540Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-04-21T20:25:11.3070333Z 2025-04-21T20:25:11.3070568Z runner_label_prefix = get_runner_prefix( 2025-04-21T20:25:11.3071072Z rollout_state, 2025-04-21T20:25:11.3071509Z (args.github_issue_owner, username), 2025-04-21T20:25:11.3072003Z args.github_branch, 2025-04-21T20:25:11.3072445Z args.eligible_experiments, 2025-04-21T20:25:11.3072900Z is_canary, 2025-04-21T20:25:11.3073263Z ) 2025-04-21T20:25:11.3073443Z 2025-04-21T20:25:11.3073612Z except Exception as e: 2025-04-21T20:25:11.3074010Z log.error( 2025-04-21T20:25:11.3074610Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-04-21T20:25:11.3075287Z ) 2025-04-21T20:25:11.3075464Z 2025-04-21T20:25:11.3075766Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-04-21T20:25:11.3076217Z 2025-04-21T20:25:11.3076223Z 2025-04-21T20:25:11.3076385Z if __name__ == "__main__": 2025-04-21T20:25:11.3076765Z main() 2025-04-21T20:25:11.3076947Z 2025-04-21T20:25:11.3169411Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-04-21T20:25:11.3170421Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-04-21T20:25:11.3217566Z shell: /usr/bin/bash -e {0} 2025-04-21T20:25:11.3218010Z env: 2025-04-21T20:25:11.3218627Z GITHUB_TOKEN: *** 2025-04-21T20:25:11.3219012Z ISSUE_NUMBER: 5132 2025-04-21T20:25:11.3219414Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-04-21T20:25:11.3219883Z ISSUE_OWNER: 2025-04-21T20:25:11.3220372Z CHECK_EXPERIMENTS: 2025-04-21T20:25:11.3220750Z PR_NUMBER: 2025-04-21T20:25:11.3221076Z ##[endgroup] 2025-04-21T20:25:12.4714615Z Defaulting to user installation because normal site-packages is not writeable 2025-04-21T20:25:13.1821596Z Collecting urllib3==1.26.18 2025-04-21T20:25:13.2408109Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-04-21T20:25:13.2649711Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.9 MB/s eta 0:00:00 2025-04-21T20:25:13.2922743Z Collecting PyGithub==2.3.0 2025-04-21T20:25:13.2998273Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-04-21T20:25:13.3509010Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-04-21T20:25:13.3587642Z 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-04-21T20:25:13.3648567Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-04-21T20:25:13.3669397Z 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-04-21T20:25:13.3685899Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-04-21T20:25:13.4019260Z Collecting Deprecated (from PyGithub==2.3.0) 2025-04-21T20:25:13.4095050Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-04-21T20:25:13.4348320Z 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-04-21T20:25:13.5684503Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-04-21T20:25:13.5760725Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-04-21T20:25:13.6928901Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-04-21T20:25:13.7009855Z 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-04-21T20:25:13.7259165Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-04-21T20:25:13.7341249Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-04-21T20:25:13.7694043Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-04-21T20:25:13.7806049Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 14.7 MB/s eta 0:00:00 2025-04-21T20:25:13.7883759Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-04-21T20:25:13.8007216Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 33.4 MB/s eta 0:00:00 2025-04-21T20:25:13.8081528Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-04-21T20:25:13.8216951Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 74.1 MB/s eta 0:00:00 2025-04-21T20:25:13.8287877Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-04-21T20:25:13.8402241Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-04-21T20:25:13.8478564Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 84.3 MB/s eta 0:00:00 2025-04-21T20:25:13.8552529Z 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-04-21T20:25:13.8601536Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 24.5 MB/s eta 0:00:00 2025-04-21T20:25:13.8674716Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-04-21T20:25:13.8741576Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 22.4 MB/s eta 0:00:00 2025-04-21T20:25:14.1863887Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-04-21T20:25:14.7377845Z 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-04-21T20:25:14.8439610Z ##[group]Run curr_branch="ciflow/inductor/148893" 2025-04-21T20:25:14.8440049Z curr_branch="ciflow/inductor/148893" 2025-04-21T20:25:14.8440528Z curr_ref_type="tag" 2025-04-21T20:25:14.8440778Z echo "Current branch is '$curr_branch'" 2025-04-21T20:25:14.8441027Z  2025-04-21T20:25:14.8441216Z python3 runner_determinator.py \ 2025-04-21T20:25:14.8441501Z  --github-token "$GITHUB_TOKEN" \ 2025-04-21T20:25:14.8441788Z  --github-issue "$ISSUE_NUMBER" \ 2025-04-21T20:25:14.8442040Z  --github-branch "$curr_branch" \ 2025-04-21T20:25:14.8442296Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-04-21T20:25:14.8442578Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-04-21T20:25:14.8442852Z  --github-ref-type "$curr_ref_type" \ 2025-04-21T20:25:14.8443125Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-04-21T20:25:14.8443473Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-04-21T20:25:14.8443759Z  --pr-number "${PR_NUMBER}" 2025-04-21T20:25:14.8490977Z shell: /usr/bin/bash -e {0} 2025-04-21T20:25:14.8491222Z env: 2025-04-21T20:25:14.8491886Z GITHUB_TOKEN: *** 2025-04-21T20:25:14.8492075Z ISSUE_NUMBER: 5132 2025-04-21T20:25:14.8492286Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-04-21T20:25:14.8492512Z ISSUE_OWNER: 2025-04-21T20:25:14.8492691Z CHECK_EXPERIMENTS: 2025-04-21T20:25:14.8492887Z PR_NUMBER: 2025-04-21T20:25:14.8493054Z ##[endgroup] 2025-04-21T20:25:14.8560678Z Current branch is 'ciflow/inductor/148893' 2025-04-21T20:25:16.8546739Z INFO : Based on rollout percentage of 45%, enabling experiment lf. 2025-04-21T20:25:16.8547653Z INFO : Based on rollout percentage of 30%, enabling experiment ephemeral. 2025-04-21T20:25:16.8549242Z INFO : Setting output: label-type='lf.ephemeral.' 2025-04-21T20:25:16.8912337Z Evaluate and set job outputs 2025-04-21T20:25:16.8919158Z Set output 'label-type' 2025-04-21T20:25:16.8921285Z Cleaning up orphan processes