2025-01-24T00:52:02.4566307Z Current runner version: '2.321.0' 2025-01-24T00:52:02.4592788Z ##[group]Operating System 2025-01-24T00:52:02.4593650Z Ubuntu 2025-01-24T00:52:02.4594152Z 24.04.1 2025-01-24T00:52:02.4594629Z LTS 2025-01-24T00:52:02.4595184Z ##[endgroup] 2025-01-24T00:52:02.4595758Z ##[group]Runner Image 2025-01-24T00:52:02.4596319Z Image: ubuntu-24.04 2025-01-24T00:52:02.4596900Z Version: 20250120.5.0 2025-01-24T00:52:02.4597953Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250120.5/images/ubuntu/Ubuntu2404-Readme.md 2025-01-24T00:52:02.4599284Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250120.5 2025-01-24T00:52:02.4600226Z ##[endgroup] 2025-01-24T00:52:02.4600760Z ##[group]Runner Image Provisioner 2025-01-24T00:52:02.4601309Z 2.0.417.1 2025-01-24T00:52:02.4602088Z ##[endgroup] 2025-01-24T00:52:02.4603165Z ##[group]GITHUB_TOKEN Permissions 2025-01-24T00:52:02.4605223Z Contents: read 2025-01-24T00:52:02.4605796Z Metadata: read 2025-01-24T00:52:02.4606454Z ##[endgroup] 2025-01-24T00:52:02.4609662Z Secret source: Actions 2025-01-24T00:52:02.4610685Z Prepare workflow directory 2025-01-24T00:52:02.5187799Z Prepare all required actions 2025-01-24T00:52:02.5240536Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (b2c89bc115123aea8e075e882ee121537ec92f89) 2025-01-24T00:52:02.5245511Z ##[group] Inputs 2025-01-24T00:52:02.5246012Z check_experiments: 2025-01-24T00:52:02.5246514Z triggering_actor: facebook-github-bot 2025-01-24T00:52:02.5247061Z issue_owner: yushangdi 2025-01-24T00:52:02.5247529Z curr_branch: export-D68294638 2025-01-24T00:52:02.5248153Z curr_ref_type: branch 2025-01-24T00:52:02.5248815Z issue_number: 5132 2025-01-24T00:52:02.5249482Z ##[endgroup] 2025-01-24T00:52:02.5250301Z Complete job name: before-test / get-label-type / runner-determinator 2025-01-24T00:52:03.1734878Z ##[group]Run cat < runner_determinator.py 2025-01-24T00:52:03.1736560Z cat < runner_determinator.py 2025-01-24T00:52:03.1737159Z # flake8: noqa: G004 2025-01-24T00:52:03.1737620Z  2025-01-24T00:52:03.1738281Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-01-24T00:52:03.1739252Z # must be kept in sync. You can do it easily by running the following command: 2025-01-24T00:52:03.1740124Z # python .github/scripts/update_runner_determinator.py 2025-01-24T00:52:03.1740751Z  2025-01-24T00:52:03.1741102Z """ 2025-01-24T00:52:03.1741898Z This runner determinator is used to determine which set of runners to run a 2025-01-24T00:52:03.1742837Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-01-24T00:52:03.1743822Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-01-24T00:52:03.1744723Z of which runners should be used to run which job. 2025-01-24T00:52:03.1745294Z  2025-01-24T00:52:03.1745908Z The configuration has two parts, the settings and a list of opted-in users, 2025-01-24T00:52:03.1746866Z separated by a line containing "---". If the line is not present, the 2025-01-24T00:52:03.1747788Z settings are considered to be empty with only the second part, the user 2025-01-24T00:52:03.1748516Z list, defined. 2025-01-24T00:52:03.1748948Z  2025-01-24T00:52:03.1749518Z The first part is a YAML block that defines the rollout settings. This can be 2025-01-24T00:52:03.1750488Z used to define any settings that are needed to determine which runners to use. 2025-01-24T00:52:03.1751370Z It's fields are defined by the RolloutSettings class below. 2025-01-24T00:52:03.1752105Z  2025-01-24T00:52:03.1752704Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-01-24T00:52:03.1753615Z The user list is also a comma separated list of additional features or 2025-01-24T00:52:03.1754660Z experiments which the user could be opted in to. 2025-01-24T00:52:03.1755278Z  2025-01-24T00:52:03.1755701Z The user list has the following rules: 2025-01-24T00:52:03.1756240Z  2025-01-24T00:52:03.1756778Z - Users are GitHub usernames, which must start with the @ prefix 2025-01-24T00:52:03.1757658Z - Each user is also a comma-separated list of features/experiments to enable 2025-01-24T00:52:03.1758471Z - A "#" prefix opts the user out of all experiments 2025-01-24T00:52:03.1759033Z  2025-01-24T00:52:03.1759495Z Example config: 2025-01-24T00:52:03.1760024Z  # A list of experiments that can be opted into. 2025-01-24T00:52:03.1760756Z  # This defines the behavior they'll induce when opted into. 2025-01-24T00:52:03.1761422Z  # Expected syntax is: 2025-01-24T00:52:03.1762258Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-01-24T00:52:03.1763299Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-01-24T00:52:03.1764091Z  2025-01-24T00:52:03.1764469Z  experiments: 2025-01-24T00:52:03.1764923Z  lf: 2025-01-24T00:52:03.1765350Z  rollout_percent: 25 2025-01-24T00:52:03.1765872Z  all_branches: false 2025-01-24T00:52:03.1766388Z  default: true 2025-01-24T00:52:03.1766850Z  --- 2025-01-24T00:52:03.1767249Z  2025-01-24T00:52:03.1767628Z  # Opt-ins: 2025-01-24T00:52:03.1768278Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-01-24T00:52:03.1769360Z  # and specifying experiments to enable in a comma-separated list. 2025-01-24T00:52:03.1770190Z  # To always opt out of an experiment, prefix it with a "-". 2025-01-24T00:52:03.1770895Z  # Experiments should be from the above list. 2025-01-24T00:52:03.1771463Z  2025-01-24T00:52:03.1772015Z  @User1,-lf,split_build 2025-01-24T00:52:03.1772511Z  @User2,lf 2025-01-24T00:52:03.1772948Z  @User3,split_build 2025-01-24T00:52:03.1773417Z """ 2025-01-24T00:52:03.1773783Z  2025-01-24T00:52:03.1774152Z import json 2025-01-24T00:52:03.1774590Z import logging 2025-01-24T00:52:03.1775019Z import os 2025-01-24T00:52:03.1775431Z import random 2025-01-24T00:52:03.1775862Z import re 2025-01-24T00:52:03.1776268Z import sys 2025-01-24T00:52:03.1776733Z from argparse import ArgumentParser 2025-01-24T00:52:03.1777307Z from functools import lru_cache 2025-01-24T00:52:03.1777858Z from logging import LogRecord 2025-01-24T00:52:03.1778629Z from typing import Any, Dict, FrozenSet, Iterable, List, NamedTuple, Set, Tuple 2025-01-24T00:52:03.1779458Z from urllib.request import Request, urlopen 2025-01-24T00:52:03.1780017Z  2025-01-24T00:52:03.1780383Z import yaml 2025-01-24T00:52:03.1780831Z from github import Auth, Github 2025-01-24T00:52:03.1781375Z from github.Issue import Issue 2025-01-24T00:52:03.1781992Z  2025-01-24T00:52:03.1782349Z  2025-01-24T00:52:03.1782791Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-01-24T00:52:03.1783539Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-01-24T00:52:03.1784470Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-01-24T00:52:03.1785198Z  2025-01-24T00:52:03.1785655Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-01-24T00:52:03.1786266Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-01-24T00:52:03.1786838Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-01-24T00:52:03.1787456Z OPT_OUT_LABEL = "no-runner-experiments" 2025-01-24T00:52:03.1788158Z  2025-01-24T00:52:03.1788568Z SETTING_EXPERIMENTS = "experiments" 2025-01-24T00:52:03.1789103Z  2025-01-24T00:52:03.1789495Z LF_FLEET_EXPERIMENT = "lf" 2025-01-24T00:52:03.1790012Z CANARY_FLEET_SUFFIX = ".c" 2025-01-24T00:52:03.1790500Z  2025-01-24T00:52:03.1790867Z  2025-01-24T00:52:03.1791257Z class Experiment(NamedTuple): 2025-01-24T00:52:03.1791900Z  rollout_perc: float = ( 2025-01-24T00:52:03.1792615Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-01-24T00:52:03.1793320Z  ) 2025-01-24T00:52:03.1793725Z  all_branches: bool = ( 2025-01-24T00:52:03.1794426Z  False # If True, the experiment is also enabled on the exception branches 2025-01-24T00:52:03.1795125Z  ) 2025-01-24T00:52:03.1795573Z  default: bool = ( 2025-01-24T00:52:03.1796224Z  True # If True, the experiment is enabled by default for all queries 2025-01-24T00:52:03.1796908Z  ) 2025-01-24T00:52:03.1797284Z  2025-01-24T00:52:03.1797684Z  # Add more fields as needed 2025-01-24T00:52:03.1798195Z  2025-01-24T00:52:03.1798548Z  2025-01-24T00:52:03.1798941Z class Settings(NamedTuple): 2025-01-24T00:52:03.1799439Z  """ 2025-01-24T00:52:03.1799948Z  Settings for the experiments that can be opted into. 2025-01-24T00:52:03.1800563Z  """ 2025-01-24T00:52:03.1800950Z  2025-01-24T00:52:03.1801371Z  experiments: Dict[str, Experiment] = {} 2025-01-24T00:52:03.1802157Z  2025-01-24T00:52:03.1802520Z  2025-01-24T00:52:03.1803108Z class ColorFormatter(logging.Formatter): 2025-01-24T00:52:03.1803812Z  """Color codes the log messages based on the log level""" 2025-01-24T00:52:03.1804443Z  2025-01-24T00:52:03.1804803Z  COLORS = { 2025-01-24T00:52:03.1805273Z  "WARNING": "\033[33m", # Yellow 2025-01-24T00:52:03.1805828Z  "ERROR": "\033[31m", # Red 2025-01-24T00:52:03.1806363Z  "CRITICAL": "\033[31m", # Red 2025-01-24T00:52:03.1806907Z  "INFO": "\033[0m", # Reset 2025-01-24T00:52:03.1807449Z  "DEBUG": "\033[0m", # Reset 2025-01-24T00:52:03.1807959Z  } 2025-01-24T00:52:03.1808336Z  2025-01-24T00:52:03.1808785Z  def format(self, record: LogRecord) -> str: 2025-01-24T00:52:03.1809583Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-01-24T00:52:03.1810403Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-01-24T00:52:03.1811026Z  return super().format(record) 2025-01-24T00:52:03.1811665Z  2025-01-24T00:52:03.1812032Z  2025-01-24T00:52:03.1812451Z handler = logging.StreamHandler() 2025-01-24T00:52:03.1813231Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-01-24T00:52:03.1813982Z  2025-01-24T00:52:03.1814469Z log = logging.getLogger(os.path.basename(__file__)) 2025-01-24T00:52:03.1815102Z log.addHandler(handler) 2025-01-24T00:52:03.1815610Z log.setLevel(logging.INFO) 2025-01-24T00:52:03.1816102Z  2025-01-24T00:52:03.1816459Z  2025-01-24T00:52:03.1816947Z def set_github_output(key: str, value: str) -> None: 2025-01-24T00:52:03.1817558Z  """ 2025-01-24T00:52:03.1818115Z  Defines outputs of the github action that invokes this script 2025-01-24T00:52:03.1818778Z  """ 2025-01-24T00:52:03.1819253Z  if not GITHUB_OUTPUT: 2025-01-24T00:52:03.1820376Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-01-24T00:52:03.1821747Z  log.warning( 2025-01-24T00:52:03.1822663Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-01-24T00:52:03.1823620Z  ) 2025-01-24T00:52:03.1824095Z  print(f"::set-output name={key}::{value}") 2025-01-24T00:52:03.1824673Z  return 2025-01-24T00:52:03.1825100Z  2025-01-24T00:52:03.1825510Z  with open(GITHUB_OUTPUT, "a") as f: 2025-01-24T00:52:03.1826132Z  log.info(f"Setting output: {key}='{value}'") 2025-01-24T00:52:03.1826742Z  f.write(f"{key}={value}\n") 2025-01-24T00:52:03.1827253Z  2025-01-24T00:52:03.1827623Z  2025-01-24T00:52:03.1828161Z def _str_comma_separated_to_set(value: str) -> FrozenSet[str]: 2025-01-24T00:52:03.1828838Z  return frozenset( 2025-01-24T00:52:03.1829526Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-01-24T00:52:03.1830242Z  ) 2025-01-24T00:52:03.1830622Z  2025-01-24T00:52:03.1830982Z  2025-01-24T00:52:03.1831368Z def parse_args() -> Any: 2025-01-24T00:52:03.1832083Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-01-24T00:52:03.1833029Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-01-24T00:52:03.1833822Z  parser.add_argument( 2025-01-24T00:52:03.1834331Z  "--github-issue-repo", 2025-01-24T00:52:03.1834857Z  type=str, 2025-01-24T00:52:03.1835324Z  required=False, 2025-01-24T00:52:03.1836059Z  default="pytorch/test-infra", 2025-01-24T00:52:03.1837055Z  help="GitHub repo to get the issue", 2025-01-24T00:52:03.1837801Z  ) 2025-01-24T00:52:03.1838239Z  parser.add_argument( 2025-01-24T00:52:03.1838757Z  "--github-repo", 2025-01-24T00:52:03.1839253Z  type=str, 2025-01-24T00:52:03.1839712Z  required=True, 2025-01-24T00:52:03.1840262Z  help="GitHub repo where CI is running", 2025-01-24T00:52:03.1840827Z  ) 2025-01-24T00:52:03.1841244Z  parser.add_argument( 2025-01-24T00:52:03.1842199Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-01-24T00:52:03.1842898Z  ) 2025-01-24T00:52:03.1843307Z  parser.add_argument( 2025-01-24T00:52:03.1844006Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-01-24T00:52:03.1844930Z  ) 2025-01-24T00:52:03.1845345Z  parser.add_argument( 2025-01-24T00:52:03.1846203Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-01-24T00:52:03.1846955Z  ) 2025-01-24T00:52:03.1847476Z  parser.add_argument( 2025-01-24T00:52:03.1848237Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-01-24T00:52:03.1848986Z  ) 2025-01-24T00:52:03.1849395Z  parser.add_argument( 2025-01-24T00:52:03.1849894Z  "--github-ref-type", 2025-01-24T00:52:03.1850403Z  type=str, 2025-01-24T00:52:03.1850861Z  required=True, 2025-01-24T00:52:03.1851423Z  help="Current GitHub ref type, branch or tag", 2025-01-24T00:52:03.1852282Z  ) 2025-01-24T00:52:03.1852683Z  parser.add_argument( 2025-01-24T00:52:03.1853204Z  "--eligible-experiments", 2025-01-24T00:52:03.1853792Z  type=_str_comma_separated_to_set, 2025-01-24T00:52:03.1854350Z  required=False, 2025-01-24T00:52:03.1854835Z  default="", 2025-01-24T00:52:03.1855945Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-01-24T00:52:03.1856913Z  ) 2025-01-24T00:52:03.1857322Z  parser.add_argument( 2025-01-24T00:52:03.1857819Z  "--pr-number", 2025-01-24T00:52:03.1858294Z  type=str, 2025-01-24T00:52:03.1858753Z  required=False, 2025-01-24T00:52:03.1859234Z  default="", 2025-01-24T00:52:03.1859788Z  help="the optional PR number where this is run", 2025-01-24T00:52:03.1860383Z  ) 2025-01-24T00:52:03.1860762Z  2025-01-24T00:52:03.1861167Z  return parser.parse_args() 2025-01-24T00:52:03.1861787Z  2025-01-24T00:52:03.1862161Z  2025-01-24T00:52:03.1862624Z def get_gh_client(github_token: str) -> Github: 2025-01-24T00:52:03.1863246Z  auth = Auth.Token(github_token) 2025-01-24T00:52:03.1863796Z  return Github(auth=auth) 2025-01-24T00:52:03.1864291Z  2025-01-24T00:52:03.1864641Z  2025-01-24T00:52:03.1865162Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: 2025-01-24T00:52:03.1865839Z  repo = gh.get_repo(repo) 2025-01-24T00:52:03.1866388Z  return repo.get_issue(number=issue_num) 2025-01-24T00:52:03.1866933Z  2025-01-24T00:52:03.1867289Z  2025-01-24T00:52:03.1867671Z def get_potential_pr_author( 2025-01-24T00:52:03.1868377Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-01-24T00:52:03.1869084Z ) -> str: 2025-01-24T00:52:03.1869650Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-01-24T00:52:03.1870610Z  # Fetch the actual username from the original PR. The PR number is 2025-01-24T00:52:03.1871411Z  # embedded in the tag name: ciflow// 2025-01-24T00:52:03.1872218Z  2025-01-24T00:52:03.1872628Z  gh = get_gh_client(github_token) 2025-01-24T00:52:03.1873157Z  2025-01-24T00:52:03.1873650Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-01-24T00:52:03.1874306Z  split_tag = ref_name.split("/") 2025-01-24T00:52:03.1874845Z  if ( 2025-01-24T00:52:03.1875284Z  len(split_tag) == 3 2025-01-24T00:52:03.1875827Z  and split_tag[0] == "ciflow" 2025-01-24T00:52:03.1876400Z  and split_tag[2].isnumeric() 2025-01-24T00:52:03.1876929Z  ): 2025-01-24T00:52:03.1877372Z  pr_number = split_tag[2] 2025-01-24T00:52:03.1877900Z  try: 2025-01-24T00:52:03.1878397Z  repository = gh.get_repo(repo) 2025-01-24T00:52:03.1879047Z  pull = repository.get_pull(number=int(pr_number)) 2025-01-24T00:52:03.1879701Z  except Exception as e: 2025-01-24T00:52:03.1880282Z  raise Exception( # noqa: TRY002 2025-01-24T00:52:03.1880987Z  f"issue with pull request {pr_number} from repo {repository}" 2025-01-24T00:52:03.1881917Z  ) from e 2025-01-24T00:52:03.1882503Z  return pull.user.login 2025-01-24T00:52:03.1883146Z  # In all other cases, return the original input username 2025-01-24T00:52:03.1883773Z  return username 2025-01-24T00:52:03.1884227Z  2025-01-24T00:52:03.1884577Z  2025-01-24T00:52:03.1885023Z def is_exception_branch(branch: str) -> bool: 2025-01-24T00:52:03.1885591Z  """ 2025-01-24T00:52:03.1886285Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-01-24T00:52:03.1887078Z  """ 2025-01-24T00:52:03.1887670Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-01-24T00:52:03.1888520Z  2025-01-24T00:52:03.1888867Z  2025-01-24T00:52:03.1889277Z def load_yaml(yaml_text: str) -> Any: 2025-01-24T00:52:03.1889808Z  try: 2025-01-24T00:52:03.1890241Z  data = yaml.safe_load(yaml_text) 2025-01-24T00:52:03.1890796Z  return data 2025-01-24T00:52:03.1891271Z  except yaml.YAMLError: 2025-01-24T00:52:03.1892083Z  log.exception("Error loading YAML") 2025-01-24T00:52:03.1892628Z  raise 2025-01-24T00:52:03.1893045Z  2025-01-24T00:52:03.1893400Z  2025-01-24T00:52:03.1894030Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> Tuple[str, str]: 2025-01-24T00:52:03.1894809Z  """ 2025-01-24T00:52:03.1895478Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-01-24T00:52:03.1896253Z  2025-01-24T00:52:03.1896809Z  If the issue body contains "---" then the text above that is the settings 2025-01-24T00:52:03.1897601Z  and the text below is the list of opted in users. 2025-01-24T00:52:03.1898175Z  2025-01-24T00:52:03.1898762Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-01-24T00:52:03.1899476Z  """ 2025-01-24T00:52:03.1899964Z  rollout_state_parts = rollout_state.split("---") 2025-01-24T00:52:03.1900581Z  if len(rollout_state_parts) >= 2: 2025-01-24T00:52:03.1901223Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-01-24T00:52:03.1901949Z  else: 2025-01-24T00:52:03.1902494Z  return "", rollout_state 2025-01-24T00:52:03.1902994Z  2025-01-24T00:52:03.1903339Z  2025-01-24T00:52:03.1903750Z class UserOptins(Dict[str, List[str]]): 2025-01-24T00:52:03.1904298Z  """ 2025-01-24T00:52:03.1904874Z  Dictionary of users with a list of features they have opted into 2025-01-24T00:52:03.1905530Z  """ 2025-01-24T00:52:03.1905901Z  2025-01-24T00:52:03.1906247Z  2025-01-24T00:52:03.1906793Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-01-24T00:52:03.1907472Z  """ 2025-01-24T00:52:03.1908235Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-01-24T00:52:03.1909080Z  2025-01-24T00:52:03.1909895Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-01-24T00:52:03.1910910Z  - Example line: "@User1,lf,split_build" 2025-01-24T00:52:03.1911820Z  - A "#" prefix indicates the user is opted out of all experiments 2025-01-24T00:52:03.1912497Z  2025-01-24T00:52:03.1912865Z  2025-01-24T00:52:03.1913222Z  """ 2025-01-24T00:52:03.1913628Z  optins = UserOptins() 2025-01-24T00:52:03.1914170Z  for user in user_optin_text.split("\n"): 2025-01-24T00:52:03.1914761Z  user = user.strip("\r\n\t -") 2025-01-24T00:52:03.1915357Z  if not user or not user.startswith("@"): 2025-01-24T00:52:03.1915939Z  # Not a valid user. Skip 2025-01-24T00:52:03.1916462Z  continue 2025-01-24T00:52:03.1916896Z  2025-01-24T00:52:03.1917253Z  if user: 2025-01-24T00:52:03.1917758Z  usr_name = user.split(",")[0].strip("@") 2025-01-24T00:52:03.1918493Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-01-24T00:52:03.1919146Z  2025-01-24T00:52:03.1919517Z  return optins 2025-01-24T00:52:03.1919951Z  2025-01-24T00:52:03.1920424Z  2025-01-24T00:52:03.1920944Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-01-24T00:52:03.1921781Z  """ 2025-01-24T00:52:03.1922287Z  Check if the experiment name is valid. 2025-01-24T00:52:03.1922842Z  A valid name: 2025-01-24T00:52:03.1923557Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-01-24T00:52:03.1924510Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-01-24T00:52:03.1925238Z  - Cannot contain spaces 2025-01-24T00:52:03.1925737Z  """ 2025-01-24T00:52:03.1926104Z  2025-01-24T00:52:03.1926580Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-01-24T00:52:03.1927327Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-01-24T00:52:03.1927945Z  2025-01-24T00:52:03.1928298Z  if valid: 2025-01-24T00:52:03.1928732Z  return True 2025-01-24T00:52:03.1929166Z  2025-01-24T00:52:03.1929521Z  log.error( 2025-01-24T00:52:03.1930971Z  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-01-24T00:52:03.1932729Z  ) 2025-01-24T00:52:03.1933110Z  return False 2025-01-24T00:52:03.1933545Z  2025-01-24T00:52:03.1933891Z  2025-01-24T00:52:03.1934422Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-01-24T00:52:03.1935070Z  """ 2025-01-24T00:52:03.1935835Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-01-24T00:52:03.1936577Z  """ 2025-01-24T00:52:03.1936956Z  try: 2025-01-24T00:52:03.1937361Z  if settings_text: 2025-01-24T00:52:03.1938118Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-01-24T00:52:03.1938929Z  # for easy reading 2025-01-24T00:52:03.1939763Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-01-24T00:52:03.1940671Z  # the backtick character in shell commands. 2025-01-24T00:52:03.1941304Z  backtick = chr(96) # backtick character 2025-01-24T00:52:03.1942188Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-01-24T00:52:03.1942884Z  settings = load_yaml(settings_text) 2025-01-24T00:52:03.1943414Z  2025-01-24T00:52:03.1944023Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-01-24T00:52:03.1944801Z  experiments = {} 2025-01-24T00:52:03.1945281Z  2025-01-24T00:52:03.1945850Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-01-24T00:52:03.1946630Z  if not is_valid_experiment_name(exp_name): 2025-01-24T00:52:03.1947731Z  # 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-01-24T00:52:03.1948777Z  continue 2025-01-24T00:52:03.1949248Z  2025-01-24T00:52:03.1949640Z  valid_settings = {} 2025-01-24T00:52:03.1950191Z  for setting in exp_settings: 2025-01-24T00:52:03.1950798Z  if setting not in Experiment._fields: 2025-01-24T00:52:03.1951385Z  log.warning( 2025-01-24T00:52:03.1952226Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-01-24T00:52:03.1953089Z  ) 2025-01-24T00:52:03.1953562Z  else: 2025-01-24T00:52:03.1954123Z  valid_settings[setting] = exp_settings[setting] 2025-01-24T00:52:03.1954723Z  2025-01-24T00:52:03.1955220Z  experiments[exp_name] = Experiment(**valid_settings) 2025-01-24T00:52:03.1955883Z  return Settings(experiments) 2025-01-24T00:52:03.1956409Z  2025-01-24T00:52:03.1956787Z  except Exception: 2025-01-24T00:52:03.1957323Z  log.exception("Failed to parse settings") 2025-01-24T00:52:03.1957875Z  2025-01-24T00:52:03.1958241Z  return Settings() 2025-01-24T00:52:03.1958684Z  2025-01-24T00:52:03.1959023Z  2025-01-24T00:52:03.1959493Z def parse_settings(rollout_state: str) -> Settings: 2025-01-24T00:52:03.1960088Z  """ 2025-01-24T00:52:03.1960566Z  Parse settings, if any, from the rollout state. 2025-01-24T00:52:03.1961140Z  2025-01-24T00:52:03.1961781Z  If the issue body contains "---" then the text above that is the settings 2025-01-24T00:52:03.1962571Z  and the text below is the list of opted in users. 2025-01-24T00:52:03.1963138Z  2025-01-24T00:52:03.1963745Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-01-24T00:52:03.1964489Z  """ 2025-01-24T00:52:03.1965087Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-01-24T00:52:03.1965879Z  return parse_settings_from_text(settings_text) 2025-01-24T00:52:03.1966451Z  2025-01-24T00:52:03.1966940Z  2025-01-24T00:52:03.1967410Z def parse_users(rollout_state: str) -> UserOptins: 2025-01-24T00:52:03.1967992Z  """ 2025-01-24T00:52:03.1968429Z  Parse users from the rollout state. 2025-01-24T00:52:03.1968949Z  2025-01-24T00:52:03.1969304Z  """ 2025-01-24T00:52:03.1969880Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-01-24T00:52:03.1970661Z  return parse_user_opt_in_from_text(users_text) 2025-01-24T00:52:03.1971226Z  2025-01-24T00:52:03.1971676Z  2025-01-24T00:52:03.1972311Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-01-24T00:52:03.1973079Z  """ 2025-01-24T00:52:03.1973545Z  Check if a user is opted into an experiment 2025-01-24T00:52:03.1974105Z  """ 2025-01-24T00:52:03.1974614Z  return experiment_name in user_optins.get(user, []) 2025-01-24T00:52:03.1975218Z  2025-01-24T00:52:03.1975564Z  2025-01-24T00:52:03.1976198Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-01-24T00:52:03.1976981Z  """ 2025-01-24T00:52:03.1977488Z  Check if a user explicitly opted out of an experiment 2025-01-24T00:52:03.1978085Z  """ 2025-01-24T00:52:03.1978628Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-01-24T00:52:03.1979356Z  experiment_optout = "-" + experiment_name 2025-01-24T00:52:03.1980032Z  if experiment_optout not in user_optins.get(user, []): 2025-01-24T00:52:03.1980656Z  return False 2025-01-24T00:52:03.1981103Z  2025-01-24T00:52:03.1981668Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-01-24T00:52:03.1982294Z  log.warning( 2025-01-24T00:52:03.1983149Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-01-24T00:52:03.1984035Z  ) 2025-01-24T00:52:03.1984549Z  2025-01-24T00:52:03.1984926Z  return True 2025-01-24T00:52:03.1985346Z  2025-01-24T00:52:03.1985700Z  2025-01-24T00:52:03.1986073Z def get_runner_prefix( 2025-01-24T00:52:03.1986552Z  rollout_state: str, 2025-01-24T00:52:03.1987069Z  workflow_requestors: Iterable[str], 2025-01-24T00:52:03.1987617Z  branch: str, 2025-01-24T00:52:03.1988168Z  eligible_experiments: FrozenSet[str] = frozenset(), 2025-01-24T00:52:03.1988794Z  is_canary: bool = False, 2025-01-24T00:52:03.1989292Z ) -> str: 2025-01-24T00:52:03.1989748Z  settings = parse_settings(rollout_state) 2025-01-24T00:52:03.1990362Z  user_optins = parse_users(rollout_state) 2025-01-24T00:52:03.1990912Z  2025-01-24T00:52:03.1991279Z  fleet_prefix = "" 2025-01-24T00:52:03.1991851Z  prefixes = [] 2025-01-24T00:52:03.1992541Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-01-24T00:52:03.1993508Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-01-24T00:52:03.1994247Z  log.info( 2025-01-24T00:52:03.1994993Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-01-24T00:52:03.1995759Z  ) 2025-01-24T00:52:03.1996173Z  continue 2025-01-24T00:52:03.1996609Z  2025-01-24T00:52:03.1996993Z  if eligible_experiments: 2025-01-24T00:52:03.1997607Z  if experiment_name not in eligible_experiments: 2025-01-24T00:52:03.1998274Z  exp_list = ", ".join(eligible_experiments) 2025-01-24T00:52:03.1998968Z  log.info( 2025-01-24T00:52:03.1999796Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-01-24T00:52:03.2000641Z  ) 2025-01-24T00:52:03.2001088Z  continue 2025-01-24T00:52:03.2001707Z  elif not experiment_settings.default: 2025-01-24T00:52:03.2002266Z  log.info( 2025-01-24T00:52:03.2002977Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-01-24T00:52:03.2003714Z  ) 2025-01-24T00:52:03.2004129Z  continue 2025-01-24T00:52:03.2079389Z  2025-01-24T00:52:03.2080141Z  # Is any workflow_requestor opted out to this experiment? 2025-01-24T00:52:03.2080869Z  opted_out_users = [ 2025-01-24T00:52:03.2081447Z  requestor 2025-01-24T00:52:03.2082219Z  for requestor in workflow_requestors 2025-01-24T00:52:03.2082930Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-01-24T00:52:03.2083626Z  ] 2025-01-24T00:52:03.2084014Z  2025-01-24T00:52:03.2084391Z  if opted_out_users: 2025-01-24T00:52:03.2084888Z  log.info( 2025-01-24T00:52:03.2085571Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-01-24T00:52:03.2086298Z  ) 2025-01-24T00:52:03.2086720Z  continue 2025-01-24T00:52:03.2087156Z  2025-01-24T00:52:03.2087644Z  # Is any workflow_requestor opted in to this experiment? 2025-01-24T00:52:03.2088277Z  opted_in_users = [ 2025-01-24T00:52:03.2088760Z  requestor 2025-01-24T00:52:03.2089276Z  for requestor in workflow_requestors 2025-01-24T00:52:03.2089983Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-01-24T00:52:03.2090618Z  ] 2025-01-24T00:52:03.2091308Z  2025-01-24T00:52:03.2091909Z  enabled = False 2025-01-24T00:52:03.2092395Z  if opted_in_users: 2025-01-24T00:52:03.2092877Z  log.info( 2025-01-24T00:52:03.2093542Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-01-24T00:52:03.2094235Z  ) 2025-01-24T00:52:03.2094665Z  enabled = True 2025-01-24T00:52:03.2095144Z  2025-01-24T00:52:03.2095562Z  elif experiment_settings.rollout_perc: 2025-01-24T00:52:03.2096421Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-01-24T00:52:03.2097386Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-01-24T00:52:03.2098058Z  log.info( 2025-01-24T00:52:03.2098962Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-01-24T00:52:03.2099898Z  ) 2025-01-24T00:52:03.2100364Z  enabled = True 2025-01-24T00:52:03.2100855Z  2025-01-24T00:52:03.2101222Z  if enabled: 2025-01-24T00:52:03.2101928Z  label = experiment_name 2025-01-24T00:52:03.2102525Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-01-24T00:52:03.2103367Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-01-24T00:52:03.2104266Z  # - If it's enabled, then we always list it's prefix first 2025-01-24T00:52:03.2105234Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-01-24T00:52:03.2105927Z  if is_canary: 2025-01-24T00:52:03.2106470Z  label += CANARY_FLEET_SUFFIX 2025-01-24T00:52:03.2107046Z  fleet_prefix = label 2025-01-24T00:52:03.2107558Z  else: 2025-01-24T00:52:03.2108047Z  prefixes.append(label) 2025-01-24T00:52:03.2108575Z  2025-01-24T00:52:03.2108946Z  if len(prefixes) > 1: 2025-01-24T00:52:03.2109434Z  log.error( 2025-01-24T00:52:03.2110504Z  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-01-24T00:52:03.2112215Z  ) 2025-01-24T00:52:03.2112664Z  prefixes = prefixes[:1] 2025-01-24T00:52:03.2113171Z  2025-01-24T00:52:03.2113549Z  # Fleet always comes first 2025-01-24T00:52:03.2114080Z  if fleet_prefix: 2025-01-24T00:52:03.2114579Z  prefixes.insert(0, fleet_prefix) 2025-01-24T00:52:03.2115103Z  2025-01-24T00:52:03.2115583Z  return ".".join(prefixes) + "." if prefixes else "" 2025-01-24T00:52:03.2116165Z  2025-01-24T00:52:03.2116509Z  2025-01-24T00:52:03.2117157Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-01-24T00:52:03.2117939Z  """ 2025-01-24T00:52:03.2118549Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-01-24T00:52:03.2119266Z  2025-01-24T00:52:03.2119860Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-01-24T00:52:03.2120570Z  """ 2025-01-24T00:52:03.2120991Z  gh = get_gh_client(github_token) 2025-01-24T00:52:03.2121746Z  issue = get_issue(gh, repo, issue_num) 2025-01-24T00:52:03.2122463Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-01-24T00:52:03.2123076Z  2025-01-24T00:52:03.2123420Z  2025-01-24T00:52:03.2124185Z def download_json(url: str, headers: Dict[str, str], num_retries: int = 3) -> Any: 2025-01-24T00:52:03.2124953Z  for _ in range(num_retries): 2025-01-24T00:52:03.2125452Z  try: 2025-01-24T00:52:03.2125919Z  req = Request(url=url, headers=headers) 2025-01-24T00:52:03.2126602Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-01-24T00:52:03.2127269Z  return json.loads(content) 2025-01-24T00:52:03.2127821Z  except Exception as e: 2025-01-24T00:52:03.2128405Z  log.warning(f"Could not download {url}: {e}") 2025-01-24T00:52:03.2128973Z  2025-01-24T00:52:03.2129565Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-01-24T00:52:03.2130299Z  return {} 2025-01-24T00:52:03.2130713Z  2025-01-24T00:52:03.2131059Z  2025-01-24T00:52:03.2131428Z @lru_cache(maxsize=None) 2025-01-24T00:52:03.2132439Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> Dict[str, Any]: 2025-01-24T00:52:03.2133210Z  """ 2025-01-24T00:52:03.2133634Z  Dynamically get PR information 2025-01-24T00:52:03.2134140Z  """ 2025-01-24T00:52:03.2134680Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-01-24T00:52:03.2135334Z  headers = { 2025-01-24T00:52:03.2135852Z  "Accept": "application/vnd.github.v3+json", 2025-01-24T00:52:03.2136493Z  "Authorization": f"token {github_token}", 2025-01-24T00:52:03.2137044Z  } 2025-01-24T00:52:03.2137522Z  json_response: Dict[str, Any] = download_json( 2025-01-24T00:52:03.2138299Z  url=f"{github_api}/issues/{pr_number}", 2025-01-24T00:52:03.2138869Z  headers=headers, 2025-01-24T00:52:03.2139338Z  ) 2025-01-24T00:52:03.2139716Z  2025-01-24T00:52:03.2140087Z  if not json_response: 2025-01-24T00:52:03.2140715Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-01-24T00:52:03.2141387Z  return {} 2025-01-24T00:52:03.2142056Z  2025-01-24T00:52:03.2142444Z  return json_response 2025-01-24T00:52:03.2142915Z  2025-01-24T00:52:03.2143261Z  2025-01-24T00:52:03.2143865Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> Set[str]: 2025-01-24T00:52:03.2144616Z  """ 2025-01-24T00:52:03.2145193Z  Dynamically get the latest list of labels from the pull request 2025-01-24T00:52:03.2145858Z  """ 2025-01-24T00:52:03.2146382Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-01-24T00:52:03.2147003Z  return { 2025-01-24T00:52:03.2147622Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-01-24T00:52:03.2148332Z  } 2025-01-24T00:52:03.2148706Z  2025-01-24T00:52:03.2149060Z  2025-01-24T00:52:03.2149433Z def main() -> None: 2025-01-24T00:52:03.2149898Z  args = parse_args() 2025-01-24T00:52:03.2150367Z  2025-01-24T00:52:03.2150797Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-01-24T00:52:03.2151349Z  2025-01-24T00:52:03.2151837Z  # Check if the PR is opt-out 2025-01-24T00:52:03.2152360Z  if args.pr_number: 2025-01-24T00:52:03.2153061Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-01-24T00:52:03.2153842Z  if OPT_OUT_LABEL in labels: 2025-01-24T00:52:03.2154368Z  log.info( 2025-01-24T00:52:03.2155114Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-01-24T00:52:03.2155895Z  ) 2025-01-24T00:52:03.2156681Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-01-24T00:52:03.2157374Z  sys.exit() 2025-01-24T00:52:03.2157828Z  2025-01-24T00:52:03.2158185Z  try: 2025-01-24T00:52:03.2158662Z  rollout_state = get_rollout_state_from_issue( 2025-01-24T00:52:03.2159408Z  args.github_token, args.github_issue_repo, args.github_issue 2025-01-24T00:52:03.2160054Z  ) 2025-01-24T00:52:03.2160441Z  2025-01-24T00:52:03.2160852Z  username = get_potential_pr_author( 2025-01-24T00:52:03.2161419Z  args.github_token, 2025-01-24T00:52:03.2162116Z  args.github_repo, 2025-01-24T00:52:03.2162633Z  args.github_actor, 2025-01-24T00:52:03.2163159Z  args.github_ref_type, 2025-01-24T00:52:03.2163693Z  args.github_branch, 2025-01-24T00:52:03.2164191Z  ) 2025-01-24T00:52:03.2164578Z  2025-01-24T00:52:03.2165071Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-01-24T00:52:03.2165694Z  2025-01-24T00:52:03.2166116Z  runner_label_prefix = get_runner_prefix( 2025-01-24T00:52:03.2166682Z  rollout_state, 2025-01-24T00:52:03.2167218Z  (args.github_issue_owner, username), 2025-01-24T00:52:03.2167787Z  args.github_branch, 2025-01-24T00:52:03.2168328Z  args.eligible_experiments, 2025-01-24T00:52:03.2168848Z  is_canary, 2025-01-24T00:52:03.2169297Z  ) 2025-01-24T00:52:03.2169692Z  2025-01-24T00:52:03.2170064Z  except Exception as e: 2025-01-24T00:52:03.2170688Z  log.error( 2025-01-24T00:52:03.2171413Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-01-24T00:52:03.2172279Z  ) 2025-01-24T00:52:03.2172661Z  2025-01-24T00:52:03.2173200Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-01-24T00:52:03.2173862Z  2025-01-24T00:52:03.2174211Z  2025-01-24T00:52:03.2174578Z if __name__ == "__main__": 2025-01-24T00:52:03.2175060Z  main() 2025-01-24T00:52:03.2175453Z  2025-01-24T00:52:03.2175802Z EOF 2025-01-24T00:52:03.2176165Z  2025-01-24T00:52:03.2176552Z cat runner_determinator.py 2025-01-24T00:52:03.2544638Z shell: /usr/bin/bash -e {0} 2025-01-24T00:52:03.2545463Z env: 2025-01-24T00:52:03.2546156Z GITHUB_TOKEN: *** 2025-01-24T00:52:03.2546579Z ISSUE_NUMBER: 5132 2025-01-24T00:52:03.2547037Z TRIGGERING_ACTOR: facebook-github-bot 2025-01-24T00:52:03.2547549Z ISSUE_OWNER: yushangdi 2025-01-24T00:52:03.2547991Z CHECK_EXPERIMENTS: 2025-01-24T00:52:03.2548416Z PR_NUMBER: 145539 2025-01-24T00:52:03.2548816Z ##[endgroup] 2025-01-24T00:52:03.2748378Z # flake8: noqa: G004 2025-01-24T00:52:03.2748705Z 2025-01-24T00:52:03.2749120Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-01-24T00:52:03.2750050Z # must be kept in sync. You can do it easily by running the following command: 2025-01-24T00:52:03.2750827Z # python .github/scripts/update_runner_determinator.py 2025-01-24T00:52:03.2751253Z 2025-01-24T00:52:03.2751397Z """ 2025-01-24T00:52:03.2752230Z This runner determinator is used to determine which set of runners to run a 2025-01-24T00:52:03.2753068Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-01-24T00:52:03.2753942Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-01-24T00:52:03.2754741Z of which runners should be used to run which job. 2025-01-24T00:52:03.2755124Z 2025-01-24T00:52:03.2755495Z The configuration has two parts, the settings and a list of opted-in users, 2025-01-24T00:52:03.2756562Z separated by a line containing "---". If the line is not present, the 2025-01-24T00:52:03.2757402Z settings are considered to be empty with only the second part, the user 2025-01-24T00:52:03.2758079Z list, defined. 2025-01-24T00:52:03.2758298Z 2025-01-24T00:52:03.2758642Z The first part is a YAML block that defines the rollout settings. This can be 2025-01-24T00:52:03.2759508Z used to define any settings that are needed to determine which runners to use. 2025-01-24T00:52:03.2760308Z It's fields are defined by the RolloutSettings class below. 2025-01-24T00:52:03.2760736Z 2025-01-24T00:52:03.2761087Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-01-24T00:52:03.2762179Z The user list is also a comma separated list of additional features or 2025-01-24T00:52:03.2762897Z experiments which the user could be opted in to. 2025-01-24T00:52:03.2763281Z 2025-01-24T00:52:03.2763468Z The user list has the following rules: 2025-01-24T00:52:03.2763812Z 2025-01-24T00:52:03.2764111Z - Users are GitHub usernames, which must start with the @ prefix 2025-01-24T00:52:03.2764928Z - Each user is also a comma-separated list of features/experiments to enable 2025-01-24T00:52:03.2765654Z - A "#" prefix opts the user out of all experiments 2025-01-24T00:52:03.2766040Z 2025-01-24T00:52:03.2766206Z Example config: 2025-01-24T00:52:03.2766657Z # A list of experiments that can be opted into. 2025-01-24T00:52:03.2767307Z # This defines the behavior they'll induce when opted into. 2025-01-24T00:52:03.2767909Z # Expected syntax is: 2025-01-24T00:52:03.2768535Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-01-24T00:52:03.2769476Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-01-24T00:52:03.2770212Z 2025-01-24T00:52:03.2770385Z experiments: 2025-01-24T00:52:03.2770762Z lf: 2025-01-24T00:52:03.2771129Z rollout_percent: 25 2025-01-24T00:52:03.2771808Z all_branches: false 2025-01-24T00:52:03.2772342Z default: true 2025-01-24T00:52:03.2772751Z --- 2025-01-24T00:52:03.2772943Z 2025-01-24T00:52:03.2773100Z # Opt-ins: 2025-01-24T00:52:03.2773661Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-01-24T00:52:03.2774494Z # and specifying experiments to enable in a comma-separated list. 2025-01-24T00:52:03.2775231Z # To always opt out of an experiment, prefix it with a "-". 2025-01-24T00:52:03.2775861Z # Experiments should be from the above list. 2025-01-24T00:52:03.2776236Z 2025-01-24T00:52:03.2776416Z @User1,-lf,split_build 2025-01-24T00:52:03.2776844Z @User2,lf 2025-01-24T00:52:03.2777220Z @User3,split_build 2025-01-24T00:52:03.2777610Z """ 2025-01-24T00:52:03.2777790Z 2025-01-24T00:52:03.2777957Z import json 2025-01-24T00:52:03.2778321Z import logging 2025-01-24T00:52:03.2778688Z import os 2025-01-24T00:52:03.2779034Z import random 2025-01-24T00:52:03.2779404Z import re 2025-01-24T00:52:03.2779746Z import sys 2025-01-24T00:52:03.2780122Z from argparse import ArgumentParser 2025-01-24T00:52:03.2780631Z from functools import lru_cache 2025-01-24T00:52:03.2781100Z from logging import LogRecord 2025-01-24T00:52:03.2782022Z from typing import Any, Dict, FrozenSet, Iterable, List, NamedTuple, Set, Tuple 2025-01-24T00:52:03.2782782Z from urllib.request import Request, urlopen 2025-01-24T00:52:03.2783130Z 2025-01-24T00:52:03.2783288Z import yaml 2025-01-24T00:52:03.2783671Z from github import Auth, Github 2025-01-24T00:52:03.2784144Z from github.Issue import Issue 2025-01-24T00:52:03.2784433Z 2025-01-24T00:52:03.2784440Z 2025-01-24T00:52:03.2784648Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-01-24T00:52:03.2785313Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-01-24T00:52:03.2786137Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-01-24T00:52:03.2786670Z 2025-01-24T00:52:03.2787041Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-01-24T00:52:03.2787584Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-01-24T00:52:03.2788065Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-01-24T00:52:03.2788596Z OPT_OUT_LABEL = "no-runner-experiments" 2025-01-24T00:52:03.2788935Z 2025-01-24T00:52:03.2789121Z SETTING_EXPERIMENTS = "experiments" 2025-01-24T00:52:03.2789444Z 2025-01-24T00:52:03.2789618Z LF_FLEET_EXPERIMENT = "lf" 2025-01-24T00:52:03.2790059Z CANARY_FLEET_SUFFIX = ".c" 2025-01-24T00:52:03.2790330Z 2025-01-24T00:52:03.2790337Z 2025-01-24T00:52:03.2790512Z class Experiment(NamedTuple): 2025-01-24T00:52:03.2790972Z rollout_perc: float = ( 2025-01-24T00:52:03.2791696Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-01-24T00:52:03.2792338Z ) 2025-01-24T00:52:03.2792696Z all_branches: bool = ( 2025-01-24T00:52:03.2793298Z False # If True, the experiment is also enabled on the exception branches 2025-01-24T00:52:03.2793932Z ) 2025-01-24T00:52:03.2794289Z default: bool = ( 2025-01-24T00:52:03.2794830Z True # If True, the experiment is enabled by default for all queries 2025-01-24T00:52:03.2795439Z ) 2025-01-24T00:52:03.2795625Z 2025-01-24T00:52:03.2795798Z # Add more fields as needed 2025-01-24T00:52:03.2796085Z 2025-01-24T00:52:03.2796092Z 2025-01-24T00:52:03.2796272Z class Settings(NamedTuple): 2025-01-24T00:52:03.2796699Z """ 2025-01-24T00:52:03.2797137Z Settings for the experiments that can be opted into. 2025-01-24T00:52:03.2797687Z """ 2025-01-24T00:52:03.2797875Z 2025-01-24T00:52:03.2798070Z experiments: Dict[str, Experiment] = {} 2025-01-24T00:52:03.2798425Z 2025-01-24T00:52:03.2798430Z 2025-01-24T00:52:03.2798628Z class ColorFormatter(logging.Formatter): 2025-01-24T00:52:03.2799352Z """Color codes the log messages based on the log level""" 2025-01-24T00:52:03.2799773Z 2025-01-24T00:52:03.2799927Z COLORS = { 2025-01-24T00:52:03.2800315Z "WARNING": "\033[33m", # Yellow 2025-01-24T00:52:03.2800812Z "ERROR": "\033[31m", # Red 2025-01-24T00:52:03.2801276Z "CRITICAL": "\033[31m", # Red 2025-01-24T00:52:03.2801957Z "INFO": "\033[0m", # Reset 2025-01-24T00:52:03.2802423Z "DEBUG": "\033[0m", # Reset 2025-01-24T00:52:03.2802872Z } 2025-01-24T00:52:03.2803056Z 2025-01-24T00:52:03.2803268Z def format(self, record: LogRecord) -> str: 2025-01-24T00:52:03.2803990Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-01-24T00:52:03.2804724Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-01-24T00:52:03.2805281Z return super().format(record) 2025-01-24T00:52:03.2805602Z 2025-01-24T00:52:03.2805615Z 2025-01-24T00:52:03.2805798Z handler = logging.StreamHandler() 2025-01-24T00:52:03.2806474Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-01-24T00:52:03.2807000Z 2025-01-24T00:52:03.2807237Z log = logging.getLogger(os.path.basename(__file__)) 2025-01-24T00:52:03.2807802Z log.addHandler(handler) 2025-01-24T00:52:03.2808227Z log.setLevel(logging.INFO) 2025-01-24T00:52:03.2808500Z 2025-01-24T00:52:03.2808506Z 2025-01-24T00:52:03.2808746Z def set_github_output(key: str, value: str) -> None: 2025-01-24T00:52:03.2809300Z """ 2025-01-24T00:52:03.2809785Z Defines outputs of the github action that invokes this script 2025-01-24T00:52:03.2810370Z """ 2025-01-24T00:52:03.2810719Z if not GITHUB_OUTPUT: 2025-01-24T00:52:03.2811937Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-01-24T00:52:03.2813006Z log.warning( 2025-01-24T00:52:03.2813817Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-01-24T00:52:03.2814703Z ) 2025-01-24T00:52:03.2825053Z print(f"::set-output name={key}::{value}") 2025-01-24T00:52:03.2825634Z return 2025-01-24T00:52:03.2826047Z 2025-01-24T00:52:03.2826240Z with open(GITHUB_OUTPUT, "a") as f: 2025-01-24T00:52:03.2826790Z log.info(f"Setting output: {key}='{value}'") 2025-01-24T00:52:03.2827334Z f.write(f"{key}={value}\n") 2025-01-24T00:52:03.2827647Z 2025-01-24T00:52:03.2827653Z 2025-01-24T00:52:03.2827949Z def _str_comma_separated_to_set(value: str) -> FrozenSet[str]: 2025-01-24T00:52:03.2828544Z return frozenset( 2025-01-24T00:52:03.2829131Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-01-24T00:52:03.2829780Z ) 2025-01-24T00:52:03.2829969Z 2025-01-24T00:52:03.2829975Z 2025-01-24T00:52:03.2830146Z def parse_args() -> Any: 2025-01-24T00:52:03.2830675Z parser = ArgumentParser("Get dynamic rollout settings") 2025-01-24T00:52:03.2831529Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-01-24T00:52:03.2832458Z parser.add_argument( 2025-01-24T00:52:03.2832902Z "--github-issue-repo", 2025-01-24T00:52:03.2833358Z type=str, 2025-01-24T00:52:03.2833740Z required=False, 2025-01-24T00:52:03.2834180Z default="pytorch/test-infra", 2025-01-24T00:52:03.2834701Z help="GitHub repo to get the issue", 2025-01-24T00:52:03.2835185Z ) 2025-01-24T00:52:03.2835542Z parser.add_argument( 2025-01-24T00:52:03.2835970Z "--github-repo", 2025-01-24T00:52:03.2836373Z type=str, 2025-01-24T00:52:03.2836749Z required=True, 2025-01-24T00:52:03.2837189Z help="GitHub repo where CI is running", 2025-01-24T00:52:03.2837680Z ) 2025-01-24T00:52:03.2838030Z parser.add_argument( 2025-01-24T00:52:03.2838606Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-01-24T00:52:03.2839230Z ) 2025-01-24T00:52:03.2839575Z parser.add_argument( 2025-01-24T00:52:03.2840293Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-01-24T00:52:03.2840941Z ) 2025-01-24T00:52:03.2841280Z parser.add_argument( 2025-01-24T00:52:03.2842000Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-01-24T00:52:03.2842657Z ) 2025-01-24T00:52:03.2843007Z parser.add_argument( 2025-01-24T00:52:03.2843624Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-01-24T00:52:03.2844294Z ) 2025-01-24T00:52:03.2844638Z parser.add_argument( 2025-01-24T00:52:03.2845071Z "--github-ref-type", 2025-01-24T00:52:03.2845499Z type=str, 2025-01-24T00:52:03.2845869Z required=True, 2025-01-24T00:52:03.2846321Z help="Current GitHub ref type, branch or tag", 2025-01-24T00:52:03.2846876Z ) 2025-01-24T00:52:03.2847224Z parser.add_argument( 2025-01-24T00:52:03.2847655Z "--eligible-experiments", 2025-01-24T00:52:03.2848148Z type=_str_comma_separated_to_set, 2025-01-24T00:52:03.2848648Z required=False, 2025-01-24T00:52:03.2849047Z default="", 2025-01-24T00:52:03.2849851Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-01-24T00:52:03.2850735Z ) 2025-01-24T00:52:03.2851074Z parser.add_argument( 2025-01-24T00:52:03.2851491Z "--pr-number", 2025-01-24T00:52:03.2852152Z type=str, 2025-01-24T00:52:03.2852532Z required=False, 2025-01-24T00:52:03.2852930Z default="", 2025-01-24T00:52:03.2853374Z help="the optional PR number where this is run", 2025-01-24T00:52:03.2853899Z ) 2025-01-24T00:52:03.2854086Z 2025-01-24T00:52:03.2854263Z return parser.parse_args() 2025-01-24T00:52:03.2854557Z 2025-01-24T00:52:03.2854564Z 2025-01-24T00:52:03.2854789Z def get_gh_client(github_token: str) -> Github: 2025-01-24T00:52:03.2855335Z auth = Auth.Token(github_token) 2025-01-24T00:52:03.2855829Z return Github(auth=auth) 2025-01-24T00:52:03.2856111Z 2025-01-24T00:52:03.2856117Z 2025-01-24T00:52:03.2856418Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: 2025-01-24T00:52:03.2857193Z repo = gh.get_repo(repo) 2025-01-24T00:52:03.2857679Z return repo.get_issue(number=issue_num) 2025-01-24T00:52:03.2858022Z 2025-01-24T00:52:03.2858033Z 2025-01-24T00:52:03.2858208Z def get_potential_pr_author( 2025-01-24T00:52:03.2858827Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-01-24T00:52:03.2859474Z ) -> str: 2025-01-24T00:52:03.2859974Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-01-24T00:52:03.2860741Z # Fetch the actual username from the original PR. The PR number is 2025-01-24T00:52:03.2861449Z # embedded in the tag name: ciflow// 2025-01-24T00:52:03.2862105Z 2025-01-24T00:52:03.2862292Z gh = get_gh_client(github_token) 2025-01-24T00:52:03.2862608Z 2025-01-24T00:52:03.2862880Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-01-24T00:52:03.2863473Z split_tag = ref_name.split("/") 2025-01-24T00:52:03.2863954Z if ( 2025-01-24T00:52:03.2864331Z len(split_tag) == 3 2025-01-24T00:52:03.2864792Z and split_tag[0] == "ciflow" 2025-01-24T00:52:03.2865294Z and split_tag[2].isnumeric() 2025-01-24T00:52:03.2865767Z ): 2025-01-24T00:52:03.2866130Z pr_number = split_tag[2] 2025-01-24T00:52:03.2866594Z try: 2025-01-24T00:52:03.2867005Z repository = gh.get_repo(repo) 2025-01-24T00:52:03.2867591Z pull = repository.get_pull(number=int(pr_number)) 2025-01-24T00:52:03.2868168Z except Exception as e: 2025-01-24T00:52:03.2868672Z raise Exception( # noqa: TRY002 2025-01-24T00:52:03.2869301Z f"issue with pull request {pr_number} from repo {repository}" 2025-01-24T00:52:03.2869903Z ) from e 2025-01-24T00:52:03.2870460Z return pull.user.login 2025-01-24T00:52:03.2871012Z # In all other cases, return the original input username 2025-01-24T00:52:03.2871760Z return username 2025-01-24T00:52:03.2872008Z 2025-01-24T00:52:03.2872014Z 2025-01-24T00:52:03.2872231Z def is_exception_branch(branch: str) -> bool: 2025-01-24T00:52:03.2872731Z """ 2025-01-24T00:52:03.2873345Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-01-24T00:52:03.2874080Z """ 2025-01-24T00:52:03.2874589Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-01-24T00:52:03.2875088Z 2025-01-24T00:52:03.2875094Z 2025-01-24T00:52:03.2875280Z def load_yaml(yaml_text: str) -> Any: 2025-01-24T00:52:03.2875754Z try: 2025-01-24T00:52:03.2876116Z data = yaml.safe_load(yaml_text) 2025-01-24T00:52:03.2876607Z return data 2025-01-24T00:52:03.2877000Z except yaml.YAMLError: 2025-01-24T00:52:03.2877452Z log.exception("Error loading YAML") 2025-01-24T00:52:03.2877961Z raise 2025-01-24T00:52:03.2878167Z 2025-01-24T00:52:03.2878172Z 2025-01-24T00:52:03.2878581Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> Tuple[str, str]: 2025-01-24T00:52:03.2879281Z """ 2025-01-24T00:52:03.2879885Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-01-24T00:52:03.2880448Z 2025-01-24T00:52:03.2880783Z If the issue body contains "---" then the text above that is the settings 2025-01-24T00:52:03.2881498Z and the text below is the list of opted in users. 2025-01-24T00:52:03.2881988Z 2025-01-24T00:52:03.2882349Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-01-24T00:52:03.2883019Z """ 2025-01-24T00:52:03.2883435Z rollout_state_parts = rollout_state.split("---") 2025-01-24T00:52:03.2884000Z if len(rollout_state_parts) >= 2: 2025-01-24T00:52:03.2884575Z return rollout_state_parts[0], rollout_state_parts[1] 2025-01-24T00:52:03.2885129Z else: 2025-01-24T00:52:03.2885492Z return "", rollout_state 2025-01-24T00:52:03.2885786Z 2025-01-24T00:52:03.2885798Z 2025-01-24T00:52:03.2886126Z class UserOptins(Dict[str, List[str]]): 2025-01-24T00:52:03.2886605Z """ 2025-01-24T00:52:03.2887096Z Dictionary of users with a list of features they have opted into 2025-01-24T00:52:03.2887720Z """ 2025-01-24T00:52:03.2887906Z 2025-01-24T00:52:03.2887913Z 2025-01-24T00:52:03.2888234Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-01-24T00:52:03.2888848Z """ 2025-01-24T00:52:03.2889517Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-01-24T00:52:03.2890177Z 2025-01-24T00:52:03.2890763Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-01-24T00:52:03.2891929Z - Example line: "@User1,lf,split_build" 2025-01-24T00:52:03.2892603Z - A "#" prefix indicates the user is opted out of all experiments 2025-01-24T00:52:03.2893057Z 2025-01-24T00:52:03.2893064Z 2025-01-24T00:52:03.2893223Z """ 2025-01-24T00:52:03.2893581Z optins = UserOptins() 2025-01-24T00:52:03.2894043Z for user in user_optin_text.split("\n"): 2025-01-24T00:52:03.2894571Z user = user.strip("\r\n\t -") 2025-01-24T00:52:03.2895085Z if not user or not user.startswith("@"): 2025-01-24T00:52:03.2895612Z # Not a valid user. Skip 2025-01-24T00:52:03.2896066Z continue 2025-01-24T00:52:03.2896294Z 2025-01-24T00:52:03.2896447Z if user: 2025-01-24T00:52:03.2896857Z usr_name = user.split(",")[0].strip("@") 2025-01-24T00:52:03.2897510Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-01-24T00:52:03.2897988Z 2025-01-24T00:52:03.2898148Z return optins 2025-01-24T00:52:03.2898385Z 2025-01-24T00:52:03.2898391Z 2025-01-24T00:52:03.2898797Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-01-24T00:52:03.2899375Z """ 2025-01-24T00:52:03.2899740Z Check if the experiment name is valid. 2025-01-24T00:52:03.2900242Z A valid name: 2025-01-24T00:52:03.2900851Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-01-24T00:52:03.2901872Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-01-24T00:52:03.2902555Z - Cannot contain spaces 2025-01-24T00:52:03.2902989Z """ 2025-01-24T00:52:03.2903178Z 2025-01-24T00:52:03.2903439Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-01-24T00:52:03.2904107Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-01-24T00:52:03.2904674Z 2025-01-24T00:52:03.2904913Z if valid: 2025-01-24T00:52:03.2905282Z return True 2025-01-24T00:52:03.2905508Z 2025-01-24T00:52:03.2905661Z log.error( 2025-01-24T00:52:03.2907050Z 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-01-24T00:52:03.2908522Z ) 2025-01-24T00:52:03.2908856Z return False 2025-01-24T00:52:03.2909084Z 2025-01-24T00:52:03.2909091Z 2025-01-24T00:52:03.2909381Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-01-24T00:52:03.2909972Z """ 2025-01-24T00:52:03.2910519Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-01-24T00:52:03.2911194Z """ 2025-01-24T00:52:03.2911529Z try: 2025-01-24T00:52:03.2911993Z if settings_text: 2025-01-24T00:52:03.2912683Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-01-24T00:52:03.2913440Z # for easy reading 2025-01-24T00:52:03.2914179Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-01-24T00:52:03.2915026Z # the backtick character in shell commands. 2025-01-24T00:52:03.2915602Z backtick = chr(96) # backtick character 2025-01-24T00:52:03.2916411Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-01-24T00:52:03.2917044Z settings = load_yaml(settings_text) 2025-01-24T00:52:03.2917393Z 2025-01-24T00:52:03.2917780Z # For now we just load experiments. We can expand this if/when we add more settings 2025-01-24T00:52:03.2918487Z experiments = {} 2025-01-24T00:52:03.2918771Z 2025-01-24T00:52:03.2919108Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-01-24T00:52:03.2919822Z if not is_valid_experiment_name(exp_name): 2025-01-24T00:52:03.2920873Z # 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-01-24T00:52:03.2922023Z continue 2025-01-24T00:52:03.2922305Z 2025-01-24T00:52:03.2922477Z valid_settings = {} 2025-01-24T00:52:03.2922968Z for setting in exp_settings: 2025-01-24T00:52:03.2923515Z if setting not in Experiment._fields: 2025-01-24T00:52:03.2924044Z log.warning( 2025-01-24T00:52:03.2924720Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-01-24T00:52:03.2925388Z ) 2025-01-24T00:52:03.2925788Z else: 2025-01-24T00:52:03.2926274Z valid_settings[setting] = exp_settings[setting] 2025-01-24T00:52:03.2926676Z 2025-01-24T00:52:03.2926938Z experiments[exp_name] = Experiment(**valid_settings) 2025-01-24T00:52:03.2927542Z return Settings(experiments) 2025-01-24T00:52:03.2927869Z 2025-01-24T00:52:03.2928037Z except Exception: 2025-01-24T00:52:03.2928483Z log.exception("Failed to parse settings") 2025-01-24T00:52:03.2928981Z 2025-01-24T00:52:03.2929145Z return Settings() 2025-01-24T00:52:03.2929390Z 2025-01-24T00:52:03.2929401Z 2025-01-24T00:52:03.2929635Z def parse_settings(rollout_state: str) -> Settings: 2025-01-24T00:52:03.2930170Z """ 2025-01-24T00:52:03.2930564Z Parse settings, if any, from the rollout state. 2025-01-24T00:52:03.2930951Z 2025-01-24T00:52:03.2931283Z If the issue body contains "---" then the text above that is the settings 2025-01-24T00:52:03.2932110Z and the text below is the list of opted in users. 2025-01-24T00:52:03.2932497Z 2025-01-24T00:52:03.2932877Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-01-24T00:52:03.2933571Z """ 2025-01-24T00:52:03.2934123Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-01-24T00:52:03.2934839Z return parse_settings_from_text(settings_text) 2025-01-24T00:52:03.2935222Z 2025-01-24T00:52:03.2935228Z 2025-01-24T00:52:03.2935461Z def parse_users(rollout_state: str) -> UserOptins: 2025-01-24T00:52:03.2935997Z """ 2025-01-24T00:52:03.2936360Z Parse users from the rollout state. 2025-01-24T00:52:03.2936701Z 2025-01-24T00:52:03.2936852Z """ 2025-01-24T00:52:03.2937345Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-01-24T00:52:03.2938031Z return parse_user_opt_in_from_text(users_text) 2025-01-24T00:52:03.2938401Z 2025-01-24T00:52:03.2938406Z 2025-01-24T00:52:03.2938792Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-01-24T00:52:03.2939490Z """ 2025-01-24T00:52:03.2939872Z Check if a user is opted into an experiment 2025-01-24T00:52:03.2940378Z """ 2025-01-24T00:52:03.2940801Z return experiment_name in user_optins.get(user, []) 2025-01-24T00:52:03.2941194Z 2025-01-24T00:52:03.2941200Z 2025-01-24T00:52:03.2941695Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-01-24T00:52:03.2942389Z """ 2025-01-24T00:52:03.2942824Z Check if a user explicitly opted out of an experiment 2025-01-24T00:52:03.2943371Z """ 2025-01-24T00:52:03.2943833Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-01-24T00:52:03.2944606Z experiment_optout = "-" + experiment_name 2025-01-24T00:52:03.2945213Z if experiment_optout not in user_optins.get(user, []): 2025-01-24T00:52:03.2945768Z return False 2025-01-24T00:52:03.2946008Z 2025-01-24T00:52:03.2946263Z if is_user_opted_in(user, user_optins, experiment_name): 2025-01-24T00:52:03.2946840Z log.warning( 2025-01-24T00:52:03.2947613Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-01-24T00:52:03.2948443Z ) 2025-01-24T00:52:03.2948633Z 2025-01-24T00:52:03.2948797Z return True 2025-01-24T00:52:03.2949013Z 2025-01-24T00:52:03.2949019Z 2025-01-24T00:52:03.2949179Z def get_runner_prefix( 2025-01-24T00:52:03.2949601Z rollout_state: str, 2025-01-24T00:52:03.2950032Z workflow_requestors: Iterable[str], 2025-01-24T00:52:03.2950520Z branch: str, 2025-01-24T00:52:03.2950981Z eligible_experiments: FrozenSet[str] = frozenset(), 2025-01-24T00:52:03.2951638Z is_canary: bool = False, 2025-01-24T00:52:03.2952066Z ) -> str: 2025-01-24T00:52:03.2952460Z settings = parse_settings(rollout_state) 2025-01-24T00:52:03.2953001Z user_optins = parse_users(rollout_state) 2025-01-24T00:52:03.2953345Z 2025-01-24T00:52:03.2953507Z fleet_prefix = "" 2025-01-24T00:52:03.2953902Z prefixes = [] 2025-01-24T00:52:03.2954486Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-01-24T00:52:03.2955365Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-01-24T00:52:03.2956034Z log.info( 2025-01-24T00:52:03.2956669Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-01-24T00:52:03.2957381Z ) 2025-01-24T00:52:03.2957853Z continue 2025-01-24T00:52:03.2958092Z 2025-01-24T00:52:03.2958276Z if eligible_experiments: 2025-01-24T00:52:03.2958793Z if experiment_name not in eligible_experiments: 2025-01-24T00:52:03.2959387Z exp_list = ", ".join(eligible_experiments) 2025-01-24T00:52:03.2959922Z log.info( 2025-01-24T00:52:03.2960654Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-01-24T00:52:03.2961459Z ) 2025-01-24T00:52:03.2961927Z continue 2025-01-24T00:52:03.2962358Z elif not experiment_settings.default: 2025-01-24T00:52:03.2962859Z log.info( 2025-01-24T00:52:03.2963482Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-01-24T00:52:03.2964179Z ) 2025-01-24T00:52:03.2964531Z continue 2025-01-24T00:52:03.2964757Z 2025-01-24T00:52:03.2965030Z # Is any workflow_requestor opted out to this experiment? 2025-01-24T00:52:03.2965610Z opted_out_users = [ 2025-01-24T00:52:03.2966035Z requestor 2025-01-24T00:52:03.2966468Z for requestor in workflow_requestors 2025-01-24T00:52:03.2967112Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-01-24T00:52:03.2967712Z ] 2025-01-24T00:52:03.2967906Z 2025-01-24T00:52:03.2968085Z if opted_out_users: 2025-01-24T00:52:03.2968502Z log.info( 2025-01-24T00:52:03.2969086Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-01-24T00:52:03.2969749Z ) 2025-01-24T00:52:03.2970103Z continue 2025-01-24T00:52:03.2970340Z 2025-01-24T00:52:03.2970593Z # Is any workflow_requestor opted in to this experiment? 2025-01-24T00:52:03.2971177Z opted_in_users = [ 2025-01-24T00:52:03.2971684Z requestor 2025-01-24T00:52:03.2972125Z for requestor in workflow_requestors 2025-01-24T00:52:03.2972754Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-01-24T00:52:03.2973337Z ] 2025-01-24T00:52:03.2973663Z 2025-01-24T00:52:03.2973827Z enabled = False 2025-01-24T00:52:03.2974244Z if opted_in_users: 2025-01-24T00:52:03.2974665Z log.info( 2025-01-24T00:52:03.2975233Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-01-24T00:52:03.2975888Z ) 2025-01-24T00:52:03.2976255Z enabled = True 2025-01-24T00:52:03.2976524Z 2025-01-24T00:52:03.2976728Z elif experiment_settings.rollout_perc: 2025-01-24T00:52:03.2977508Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-01-24T00:52:03.2978392Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-01-24T00:52:03.2978998Z log.info( 2025-01-24T00:52:03.2979824Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-01-24T00:52:03.2980690Z ) 2025-01-24T00:52:03.2981074Z enabled = True 2025-01-24T00:52:03.2981353Z 2025-01-24T00:52:03.2981518Z if enabled: 2025-01-24T00:52:03.2982013Z label = experiment_name 2025-01-24T00:52:03.2982532Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-01-24T00:52:03.2983313Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-01-24T00:52:03.2984136Z # - If it's enabled, then we always list it's prefix first 2025-01-24T00:52:03.2984845Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-01-24T00:52:03.2985471Z if is_canary: 2025-01-24T00:52:03.2985937Z label += CANARY_FLEET_SUFFIX 2025-01-24T00:52:03.2986460Z fleet_prefix = label 2025-01-24T00:52:03.2987049Z else: 2025-01-24T00:52:03.2987453Z prefixes.append(label) 2025-01-24T00:52:03.2987785Z 2025-01-24T00:52:03.2987960Z if len(prefixes) > 1: 2025-01-24T00:52:03.2988383Z log.error( 2025-01-24T00:52:03.2989353Z 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-01-24T00:52:03.2990416Z ) 2025-01-24T00:52:03.2990780Z prefixes = prefixes[:1] 2025-01-24T00:52:03.2991078Z 2025-01-24T00:52:03.2991265Z # Fleet always comes first 2025-01-24T00:52:03.2991804Z if fleet_prefix: 2025-01-24T00:52:03.2992234Z prefixes.insert(0, fleet_prefix) 2025-01-24T00:52:03.2992571Z 2025-01-24T00:52:03.2992811Z return ".".join(prefixes) + "." if prefixes else "" 2025-01-24T00:52:03.2993196Z 2025-01-24T00:52:03.2993202Z 2025-01-24T00:52:03.2993625Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-01-24T00:52:03.2994355Z """ 2025-01-24T00:52:03.2994906Z Gets the first comment of the issue, which contains the desired rollout state. 2025-01-24T00:52:03.2995433Z 2025-01-24T00:52:03.2995797Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-01-24T00:52:03.2996462Z """ 2025-01-24T00:52:03.2996829Z gh = get_gh_client(github_token) 2025-01-24T00:52:03.2997327Z issue = get_issue(gh, repo, issue_num) 2025-01-24T00:52:03.2997927Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-01-24T00:52:03.2998340Z 2025-01-24T00:52:03.2998345Z 2025-01-24T00:52:03.2998728Z def download_json(url: str, headers: Dict[str, str], num_retries: int = 3) -> Any: 2025-01-24T00:52:03.2999434Z for _ in range(num_retries): 2025-01-24T00:52:03.2999884Z try: 2025-01-24T00:52:03.3000286Z req = Request(url=url, headers=headers) 2025-01-24T00:52:03.3000911Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-01-24T00:52:03.3001514Z return json.loads(content) 2025-01-24T00:52:03.3002113Z except Exception as e: 2025-01-24T00:52:03.3002615Z log.warning(f"Could not download {url}: {e}") 2025-01-24T00:52:03.3003133Z 2025-01-24T00:52:03.3003490Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-01-24T00:52:03.3004167Z return {} 2025-01-24T00:52:03.3004375Z 2025-01-24T00:52:03.3004381Z 2025-01-24T00:52:03.3004554Z @lru_cache(maxsize=None) 2025-01-24T00:52:03.3005209Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> Dict[str, Any]: 2025-01-24T00:52:03.3005918Z """ 2025-01-24T00:52:03.3006291Z Dynamically get PR information 2025-01-24T00:52:03.3006746Z """ 2025-01-24T00:52:03.3007212Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-01-24T00:52:03.3007799Z headers = { 2025-01-24T00:52:03.3008233Z "Accept": "application/vnd.github.v3+json", 2025-01-24T00:52:03.3008809Z "Authorization": f"token {github_token}", 2025-01-24T00:52:03.3009309Z } 2025-01-24T00:52:03.3009707Z json_response: Dict[str, Any] = download_json( 2025-01-24T00:52:03.3010290Z url=f"{github_api}/issues/{pr_number}", 2025-01-24T00:52:03.3010805Z headers=headers, 2025-01-24T00:52:03.3011246Z ) 2025-01-24T00:52:03.3011431Z 2025-01-24T00:52:03.3011711Z if not json_response: 2025-01-24T00:52:03.3012253Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-01-24T00:52:03.3012838Z return {} 2025-01-24T00:52:03.3013062Z 2025-01-24T00:52:03.3013234Z return json_response 2025-01-24T00:52:03.3013491Z 2025-01-24T00:52:03.3013498Z 2025-01-24T00:52:03.3013876Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> Set[str]: 2025-01-24T00:52:03.3014562Z """ 2025-01-24T00:52:03.3015066Z Dynamically get the latest list of labels from the pull request 2025-01-24T00:52:03.3015688Z """ 2025-01-24T00:52:03.3016274Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-01-24T00:52:03.3016861Z return { 2025-01-24T00:52:03.3017404Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-01-24T00:52:03.3018078Z } 2025-01-24T00:52:03.3018271Z 2025-01-24T00:52:03.3018277Z 2025-01-24T00:52:03.3018448Z def main() -> None: 2025-01-24T00:52:03.3018845Z args = parse_args() 2025-01-24T00:52:03.3019096Z 2025-01-24T00:52:03.3019307Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-01-24T00:52:03.3019671Z 2025-01-24T00:52:03.3019855Z # Check if the PR is opt-out 2025-01-24T00:52:03.3020320Z if args.pr_number: 2025-01-24T00:52:03.3020926Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-01-24T00:52:03.3021724Z if OPT_OUT_LABEL in labels: 2025-01-24T00:52:03.3022201Z log.info( 2025-01-24T00:52:03.3022844Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-01-24T00:52:03.3023584Z ) 2025-01-24T00:52:03.3024097Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-01-24T00:52:03.3024727Z sys.exit() 2025-01-24T00:52:03.3024976Z 2025-01-24T00:52:03.3025127Z try: 2025-01-24T00:52:03.3025540Z rollout_state = get_rollout_state_from_issue( 2025-01-24T00:52:03.3026199Z args.github_token, args.github_issue_repo, args.github_issue 2025-01-24T00:52:03.3026812Z ) 2025-01-24T00:52:03.3027009Z 2025-01-24T00:52:03.3027222Z username = get_potential_pr_author( 2025-01-24T00:52:03.3027753Z args.github_token, 2025-01-24T00:52:03.3028205Z args.github_repo, 2025-01-24T00:52:03.3028655Z args.github_actor, 2025-01-24T00:52:03.3029103Z args.github_ref_type, 2025-01-24T00:52:03.3029572Z args.github_branch, 2025-01-24T00:52:03.3030007Z ) 2025-01-24T00:52:03.3030203Z 2025-01-24T00:52:03.3030474Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-01-24T00:52:03.3030899Z 2025-01-24T00:52:03.3031101Z runner_label_prefix = get_runner_prefix( 2025-01-24T00:52:03.3031712Z rollout_state, 2025-01-24T00:52:03.3032299Z (args.github_issue_owner, username), 2025-01-24T00:52:03.3032813Z args.github_branch, 2025-01-24T00:52:03.3033277Z args.eligible_experiments, 2025-01-24T00:52:03.3033749Z is_canary, 2025-01-24T00:52:03.3034142Z ) 2025-01-24T00:52:03.3034338Z 2025-01-24T00:52:03.3034515Z except Exception as e: 2025-01-24T00:52:03.3034944Z log.error( 2025-01-24T00:52:03.3035569Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-01-24T00:52:03.3036284Z ) 2025-01-24T00:52:03.3036473Z 2025-01-24T00:52:03.3036775Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-01-24T00:52:03.3037243Z 2025-01-24T00:52:03.3037249Z 2025-01-24T00:52:03.3037417Z if __name__ == "__main__": 2025-01-24T00:52:03.3037834Z main() 2025-01-24T00:52:03.3038028Z 2025-01-24T00:52:03.3132367Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-01-24T00:52:03.3133241Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-01-24T00:52:03.3161391Z shell: /usr/bin/bash -e {0} 2025-01-24T00:52:03.3162145Z env: 2025-01-24T00:52:03.3162758Z GITHUB_TOKEN: *** 2025-01-24T00:52:03.3163155Z ISSUE_NUMBER: 5132 2025-01-24T00:52:03.3163585Z TRIGGERING_ACTOR: facebook-github-bot 2025-01-24T00:52:03.3164091Z ISSUE_OWNER: yushangdi 2025-01-24T00:52:03.3164514Z CHECK_EXPERIMENTS: 2025-01-24T00:52:03.3164932Z PR_NUMBER: 145539 2025-01-24T00:52:03.3165305Z ##[endgroup] 2025-01-24T00:52:05.1667145Z Defaulting to user installation because normal site-packages is not writeable 2025-01-24T00:52:06.8632027Z Collecting urllib3==1.26.18 2025-01-24T00:52:06.9477553Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-01-24T00:52:06.9807622Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 1.9 MB/s eta 0:00:00 2025-01-24T00:52:07.0046914Z Collecting PyGithub==2.3.0 2025-01-24T00:52:07.0249944Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-01-24T00:52:07.0715642Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-01-24T00:52:07.0922612Z 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-01-24T00:52:07.0979844Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-01-24T00:52:07.1000135Z 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-01-24T00:52:07.1015327Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-01-24T00:52:07.1316295Z Collecting Deprecated (from PyGithub==2.3.0) 2025-01-24T00:52:07.1518567Z Downloading Deprecated-1.2.15-py2.py3-none-any.whl.metadata (5.5 kB) 2025-01-24T00:52:07.1769056Z 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-01-24T00:52:07.2880414Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-01-24T00:52:07.3085713Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-01-24T00:52:07.4209268Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-01-24T00:52:07.4413613Z 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-01-24T00:52:07.4630774Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-01-24T00:52:07.4831405Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-01-24T00:52:07.5247726Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-01-24T00:52:07.5504254Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 5.7 MB/s eta 0:00:00 2025-01-24T00:52:07.5705472Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-01-24T00:52:07.5964472Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 14.4 MB/s eta 0:00:00 2025-01-24T00:52:07.6169335Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-01-24T00:52:07.6431791Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 35.0 MB/s eta 0:00:00 2025-01-24T00:52:07.6632972Z Downloading Deprecated-1.2.15-py2.py3-none-any.whl (9.9 kB) 2025-01-24T00:52:07.6863265Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-01-24T00:52:07.6944797Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 75.6 MB/s eta 0:00:00 2025-01-24T00:52:07.7152969Z 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-01-24T00:52:07.7200279Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 27.6 MB/s eta 0:00:00 2025-01-24T00:52:07.7404568Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-01-24T00:52:07.7453912Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 35.5 MB/s eta 0:00:00 2025-01-24T00:52:08.0714179Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-01-24T00:52:08.6125679Z Successfully installed Deprecated-1.2.15 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.2 2025-01-24T00:52:08.7031830Z ##[group]Run curr_branch="export-D68294638" 2025-01-24T00:52:08.7032214Z curr_branch="export-D68294638" 2025-01-24T00:52:08.7032478Z curr_ref_type="branch" 2025-01-24T00:52:08.7032736Z echo "Current branch is '$curr_branch'" 2025-01-24T00:52:08.7032982Z  2025-01-24T00:52:08.7033178Z python3 runner_determinator.py \ 2025-01-24T00:52:08.7033467Z  --github-token "$GITHUB_TOKEN" \ 2025-01-24T00:52:08.7033744Z  --github-issue "$ISSUE_NUMBER" \ 2025-01-24T00:52:08.7034004Z  --github-branch "$curr_branch" \ 2025-01-24T00:52:08.7034316Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-01-24T00:52:08.7034593Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-01-24T00:52:08.7034906Z  --github-ref-type "$curr_ref_type" \ 2025-01-24T00:52:08.7035190Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-01-24T00:52:08.7035519Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-01-24T00:52:08.7035817Z  --pr-number "${PR_NUMBER}" 2025-01-24T00:52:08.7064413Z shell: /usr/bin/bash -e {0} 2025-01-24T00:52:08.7064638Z env: 2025-01-24T00:52:08.7065191Z GITHUB_TOKEN: *** 2025-01-24T00:52:08.7065391Z ISSUE_NUMBER: 5132 2025-01-24T00:52:08.7065603Z TRIGGERING_ACTOR: facebook-github-bot 2025-01-24T00:52:08.7065850Z ISSUE_OWNER: yushangdi 2025-01-24T00:52:08.7066049Z CHECK_EXPERIMENTS: 2025-01-24T00:52:08.7066246Z PR_NUMBER: 145539 2025-01-24T00:52:08.7066428Z ##[endgroup] 2025-01-24T00:52:08.7114624Z Current branch is 'export-D68294638' 2025-01-24T00:52:10.6730341Z INFO : Based on rollout percentage of 55%, enabling experiment lf. 2025-01-24T00:52:10.6731407Z INFO : Skipping experiment 'awsa100', as it is not a default experiment 2025-01-24T00:52:10.6732473Z INFO : Setting output: label-type='lf.' 2025-01-24T00:52:10.7112037Z Evaluate and set job outputs 2025-01-24T00:52:10.7119450Z Set output 'label-type' 2025-01-24T00:52:10.7121251Z Cleaning up orphan processes