2025-03-14T03:51:43.0072094Z Current runner version: '2.322.0' 2025-03-14T03:51:43.0108346Z ##[group]Operating System 2025-03-14T03:51:43.0109629Z Ubuntu 2025-03-14T03:51:43.0110503Z 24.04.2 2025-03-14T03:51:43.0111499Z LTS 2025-03-14T03:51:43.0112244Z ##[endgroup] 2025-03-14T03:51:43.0113113Z ##[group]Runner Image 2025-03-14T03:51:43.0114180Z Image: ubuntu-24.04 2025-03-14T03:51:43.0115046Z Version: 20250309.1.0 2025-03-14T03:51:43.0117192Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250309.1/images/ubuntu/Ubuntu2404-Readme.md 2025-03-14T03:51:43.0119643Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250309.1 2025-03-14T03:51:43.0121166Z ##[endgroup] 2025-03-14T03:51:43.0122145Z ##[group]Runner Image Provisioner 2025-03-14T03:51:43.0123230Z 2.0.422.1 2025-03-14T03:51:43.0124042Z ##[endgroup] 2025-03-14T03:51:43.0128126Z ##[group]GITHUB_TOKEN Permissions 2025-03-14T03:51:43.0130920Z Actions: read 2025-03-14T03:51:43.0132230Z Attestations: read 2025-03-14T03:51:43.0133265Z Checks: read 2025-03-14T03:51:43.0134222Z Contents: read 2025-03-14T03:51:43.0135164Z Deployments: read 2025-03-14T03:51:43.0136351Z Discussions: read 2025-03-14T03:51:43.0137459Z Issues: read 2025-03-14T03:51:43.0138411Z Metadata: read 2025-03-14T03:51:43.0139225Z Packages: read 2025-03-14T03:51:43.0140249Z Pages: read 2025-03-14T03:51:43.0141189Z PullRequests: read 2025-03-14T03:51:43.0142266Z RepositoryProjects: read 2025-03-14T03:51:43.0143344Z SecurityEvents: read 2025-03-14T03:51:43.0144224Z Statuses: read 2025-03-14T03:51:43.0145162Z ##[endgroup] 2025-03-14T03:51:43.0149881Z Secret source: Actions 2025-03-14T03:51:43.0151153Z Prepare workflow directory 2025-03-14T03:51:43.0819540Z Prepare all required actions 2025-03-14T03:51:43.0877699Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (aed0b7a742a2d7b7901790622829cbd2135049a4) 2025-03-14T03:51:43.0882740Z ##[group] Inputs 2025-03-14T03:51:43.0883492Z check_experiments: 2025-03-14T03:51:43.0884158Z triggering_actor: pytorchmergebot 2025-03-14T03:51:43.0884802Z issue_owner: 2025-03-14T03:51:43.0885400Z curr_branch: main 2025-03-14T03:51:43.0886105Z curr_ref_type: branch 2025-03-14T03:51:43.0886659Z issue_number: 5132 2025-03-14T03:51:43.0887287Z ##[endgroup] 2025-03-14T03:51:43.0887901Z Complete job name: get-label-type / runner-determinator 2025-03-14T03:51:43.1626419Z ##[group]Run cat < runner_determinator.py 2025-03-14T03:51:43.1628277Z cat < runner_determinator.py 2025-03-14T03:51:43.1628861Z # flake8: noqa: G004 2025-03-14T03:51:43.1629330Z  2025-03-14T03:51:43.1629995Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-03-14T03:51:43.1630976Z # must be kept in sync. You can do it easily by running the following command: 2025-03-14T03:51:43.1631806Z # python .github/scripts/update_runner_determinator.py 2025-03-14T03:51:43.1632421Z  2025-03-14T03:51:43.1632782Z """ 2025-03-14T03:51:43.1633428Z This runner determinator is used to determine which set of runners to run a 2025-03-14T03:51:43.1634344Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-03-14T03:51:43.1635331Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-03-14T03:51:43.1636388Z of which runners should be used to run which job. 2025-03-14T03:51:43.1636968Z  2025-03-14T03:51:43.1637568Z The configuration has two parts, the settings and a list of opted-in users, 2025-03-14T03:51:43.1638506Z separated by a line containing "---". If the line is not present, the 2025-03-14T03:51:43.1639425Z settings are considered to be empty with only the second part, the user 2025-03-14T03:51:43.1640142Z list, defined. 2025-03-14T03:51:43.1640562Z  2025-03-14T03:51:43.1641161Z The first part is a YAML block that defines the rollout settings. This can be 2025-03-14T03:51:43.1642459Z used to define any settings that are needed to determine which runners to use. 2025-03-14T03:51:43.1643346Z It's fields are defined by the RolloutSettings class below. 2025-03-14T03:51:43.1643983Z  2025-03-14T03:51:43.1644606Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-03-14T03:51:43.1645538Z The user list is also a comma separated list of additional features or 2025-03-14T03:51:43.1646472Z experiments which the user could be opted in to. 2025-03-14T03:51:43.1647077Z  2025-03-14T03:51:43.1647516Z The user list has the following rules: 2025-03-14T03:51:43.1648060Z  2025-03-14T03:51:43.1648616Z - Users are GitHub usernames, which must start with the @ prefix 2025-03-14T03:51:43.1649510Z - Each user is also a comma-separated list of features/experiments to enable 2025-03-14T03:51:43.1650337Z - A "#" prefix opts the user out of all experiments 2025-03-14T03:51:43.1650922Z  2025-03-14T03:51:43.1651304Z Example config: 2025-03-14T03:51:43.1651833Z  # A list of experiments that can be opted into. 2025-03-14T03:51:43.1652549Z  # This defines the behavior they'll induce when opted into. 2025-03-14T03:51:43.1653216Z  # Expected syntax is: 2025-03-14T03:51:43.1653934Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-03-14T03:51:43.1654944Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-03-14T03:51:43.1655815Z  2025-03-14T03:51:43.1656200Z  experiments: 2025-03-14T03:51:43.1656636Z  lf: 2025-03-14T03:51:43.1657072Z  rollout_percent: 25 2025-03-14T03:51:43.1657591Z  all_branches: false 2025-03-14T03:51:43.1658092Z  default: true 2025-03-14T03:51:43.1658568Z  --- 2025-03-14T03:51:43.1658952Z  2025-03-14T03:51:43.1659327Z  # Opt-ins: 2025-03-14T03:51:43.1659979Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-03-14T03:51:43.1661052Z  # and specifying experiments to enable in a comma-separated list. 2025-03-14T03:51:43.1661873Z  # To always opt out of an experiment, prefix it with a "-". 2025-03-14T03:51:43.1662580Z  # Experiments should be from the above list. 2025-03-14T03:51:43.1663136Z  2025-03-14T03:51:43.1663589Z  @User1,-lf,split_build 2025-03-14T03:51:43.1664084Z  @User2,lf 2025-03-14T03:51:43.1664529Z  @User3,split_build 2025-03-14T03:51:43.1664994Z """ 2025-03-14T03:51:43.1665363Z  2025-03-14T03:51:43.1665959Z import json 2025-03-14T03:51:43.1666392Z import logging 2025-03-14T03:51:43.1666831Z import os 2025-03-14T03:51:43.1667250Z import random 2025-03-14T03:51:43.1667680Z import re 2025-03-14T03:51:43.1668088Z import sys 2025-03-14T03:51:43.1668551Z from argparse import ArgumentParser 2025-03-14T03:51:43.1669140Z from collections.abc import Iterable 2025-03-14T03:51:43.1669711Z from functools import cache 2025-03-14T03:51:43.1670239Z from logging import LogRecord 2025-03-14T03:51:43.1670791Z from typing import Any, NamedTuple 2025-03-14T03:51:43.1671406Z from urllib.request import Request, urlopen 2025-03-14T03:51:43.1671969Z  2025-03-14T03:51:43.1672352Z import yaml 2025-03-14T03:51:43.1672798Z from github import Auth, Github 2025-03-14T03:51:43.1673344Z from github.Issue import Issue 2025-03-14T03:51:43.1673849Z  2025-03-14T03:51:43.1674222Z  2025-03-14T03:51:43.1674676Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-03-14T03:51:43.1675697Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-03-14T03:51:43.1676618Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-03-14T03:51:43.1677346Z  2025-03-14T03:51:43.1677816Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-03-14T03:51:43.1678428Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-03-14T03:51:43.1679006Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-03-14T03:51:43.1679617Z OPT_OUT_LABEL = "no-runner-experiments" 2025-03-14T03:51:43.1680159Z  2025-03-14T03:51:43.1680573Z SETTING_EXPERIMENTS = "experiments" 2025-03-14T03:51:43.1681087Z  2025-03-14T03:51:43.1681476Z LF_FLEET_EXPERIMENT = "lf" 2025-03-14T03:51:43.1681998Z CANARY_FLEET_SUFFIX = ".c" 2025-03-14T03:51:43.1682479Z  2025-03-14T03:51:43.1682835Z  2025-03-14T03:51:43.1683234Z class Experiment(NamedTuple): 2025-03-14T03:51:43.1683768Z  rollout_perc: float = ( 2025-03-14T03:51:43.1684482Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-03-14T03:51:43.1685187Z  ) 2025-03-14T03:51:43.1685688Z  all_branches: bool = ( 2025-03-14T03:51:43.1686569Z  False # If True, the experiment is also enabled on the exception branches 2025-03-14T03:51:43.1687464Z  ) 2025-03-14T03:51:43.1687930Z  default: bool = ( 2025-03-14T03:51:43.1688583Z  True # If True, the experiment is enabled by default for all queries 2025-03-14T03:51:43.1689252Z  ) 2025-03-14T03:51:43.1689630Z  2025-03-14T03:51:43.1690021Z  # Add more fields as needed 2025-03-14T03:51:43.1690528Z  2025-03-14T03:51:43.1690885Z  2025-03-14T03:51:43.1691278Z class Settings(NamedTuple): 2025-03-14T03:51:43.1691774Z  """ 2025-03-14T03:51:43.1692296Z  Settings for the experiments that can be opted into. 2025-03-14T03:51:43.1692936Z  """ 2025-03-14T03:51:43.1693321Z  2025-03-14T03:51:43.1693753Z  experiments: dict[str, Experiment] = {} 2025-03-14T03:51:43.1694300Z  2025-03-14T03:51:43.1694794Z  2025-03-14T03:51:43.1695250Z class ColorFormatter(logging.Formatter): 2025-03-14T03:51:43.1696043Z  """Color codes the log messages based on the log level""" 2025-03-14T03:51:43.1696662Z  2025-03-14T03:51:43.1697033Z  COLORS = { 2025-03-14T03:51:43.1697501Z  "WARNING": "\033[33m", # Yellow 2025-03-14T03:51:43.1698057Z  "ERROR": "\033[31m", # Red 2025-03-14T03:51:43.1698601Z  "CRITICAL": "\033[31m", # Red 2025-03-14T03:51:43.1699151Z  "INFO": "\033[0m", # Reset 2025-03-14T03:51:43.1699691Z  "DEBUG": "\033[0m", # Reset 2025-03-14T03:51:43.1700204Z  } 2025-03-14T03:51:43.1700579Z  2025-03-14T03:51:43.1701046Z  def format(self, record: LogRecord) -> str: 2025-03-14T03:51:43.1701847Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-03-14T03:51:43.1702666Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-03-14T03:51:43.1703293Z  return super().format(record) 2025-03-14T03:51:43.1703805Z  2025-03-14T03:51:43.1704164Z  2025-03-14T03:51:43.1704573Z handler = logging.StreamHandler() 2025-03-14T03:51:43.1705350Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-03-14T03:51:43.1706207Z  2025-03-14T03:51:43.1706696Z log = logging.getLogger(os.path.basename(__file__)) 2025-03-14T03:51:43.1707329Z log.addHandler(handler) 2025-03-14T03:51:43.1707843Z log.setLevel(logging.INFO) 2025-03-14T03:51:43.1708469Z  2025-03-14T03:51:43.1708880Z  2025-03-14T03:51:43.1709390Z def set_github_output(key: str, value: str) -> None: 2025-03-14T03:51:43.1709979Z  """ 2025-03-14T03:51:43.1710546Z  Defines outputs of the github action that invokes this script 2025-03-14T03:51:43.1711203Z  """ 2025-03-14T03:51:43.1711610Z  if not GITHUB_OUTPUT: 2025-03-14T03:51:43.1712724Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-03-14T03:51:43.1713825Z  log.warning( 2025-03-14T03:51:43.1714731Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-03-14T03:51:43.1715752Z  ) 2025-03-14T03:51:43.1716240Z  print(f"::set-output name={key}::{value}") 2025-03-14T03:51:43.1716813Z  return 2025-03-14T03:51:43.1717240Z  2025-03-14T03:51:43.1717700Z  with open(GITHUB_OUTPUT, "a") as f: 2025-03-14T03:51:43.1718322Z  log.info(f"Setting output: {key}='{value}'") 2025-03-14T03:51:43.1718934Z  f.write(f"{key}={value}\n") 2025-03-14T03:51:43.1719448Z  2025-03-14T03:51:43.1719811Z  2025-03-14T03:51:43.1720340Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-03-14T03:51:43.1721018Z  return frozenset( 2025-03-14T03:51:43.1721693Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-03-14T03:51:43.1722390Z  ) 2025-03-14T03:51:43.1722774Z  2025-03-14T03:51:43.1723130Z  2025-03-14T03:51:43.1723509Z def parse_args() -> Any: 2025-03-14T03:51:43.1724128Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-03-14T03:51:43.1725026Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-03-14T03:51:43.1725910Z  parser.add_argument( 2025-03-14T03:51:43.1726431Z  "--github-issue-repo", 2025-03-14T03:51:43.1726941Z  type=str, 2025-03-14T03:51:43.1727402Z  required=False, 2025-03-14T03:51:43.1728049Z  default="pytorch/test-infra", 2025-03-14T03:51:43.1728642Z  help="GitHub repo to get the issue", 2025-03-14T03:51:43.1729180Z  ) 2025-03-14T03:51:43.1729576Z  parser.add_argument( 2025-03-14T03:51:43.1730076Z  "--github-repo", 2025-03-14T03:51:43.1730560Z  type=str, 2025-03-14T03:51:43.1731014Z  required=True, 2025-03-14T03:51:43.1731579Z  help="GitHub repo where CI is running", 2025-03-14T03:51:43.1732127Z  ) 2025-03-14T03:51:43.1732524Z  parser.add_argument( 2025-03-14T03:51:43.1733198Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-03-14T03:51:43.1733892Z  ) 2025-03-14T03:51:43.1734296Z  parser.add_argument( 2025-03-14T03:51:43.1735001Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-03-14T03:51:43.1735795Z  ) 2025-03-14T03:51:43.1736196Z  parser.add_argument( 2025-03-14T03:51:43.1736897Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-03-14T03:51:43.1737596Z  ) 2025-03-14T03:51:43.1738000Z  parser.add_argument( 2025-03-14T03:51:43.1738716Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-03-14T03:51:43.1739434Z  ) 2025-03-14T03:51:43.1739837Z  parser.add_argument( 2025-03-14T03:51:43.1740331Z  "--github-ref-type", 2025-03-14T03:51:43.1740835Z  type=str, 2025-03-14T03:51:43.1741429Z  required=True, 2025-03-14T03:51:43.1741989Z  help="Current GitHub ref type, branch or tag", 2025-03-14T03:51:43.1742564Z  ) 2025-03-14T03:51:43.1742968Z  parser.add_argument( 2025-03-14T03:51:43.1743480Z  "--eligible-experiments", 2025-03-14T03:51:43.1744057Z  type=_str_comma_separated_to_set, 2025-03-14T03:51:43.1744617Z  required=False, 2025-03-14T03:51:43.1745102Z  default="", 2025-03-14T03:51:43.1746162Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-03-14T03:51:43.1747084Z  ) 2025-03-14T03:51:43.1747488Z  parser.add_argument( 2025-03-14T03:51:43.1747987Z  "--pr-number", 2025-03-14T03:51:43.1748465Z  type=str, 2025-03-14T03:51:43.1748925Z  required=False, 2025-03-14T03:51:43.1749400Z  default="", 2025-03-14T03:51:43.1749946Z  help="the optional PR number where this is run", 2025-03-14T03:51:43.1750524Z  ) 2025-03-14T03:51:43.1750898Z  2025-03-14T03:51:43.1751293Z  return parser.parse_args() 2025-03-14T03:51:43.1751798Z  2025-03-14T03:51:43.1752160Z  2025-03-14T03:51:43.1752798Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-03-14T03:51:43.1753590Z  auth = Auth.Token(github_token) 2025-03-14T03:51:43.1754135Z  return Github(auth=auth) 2025-03-14T03:51:43.1754621Z  2025-03-14T03:51:43.1754969Z  2025-03-14T03:51:43.1755726Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-03-14T03:51:43.1756548Z  repo = gh.get_repo(repo) 2025-03-14T03:51:43.1757116Z  return repo.get_issue(number=issue_num) 2025-03-14T03:51:43.1757662Z  2025-03-14T03:51:43.1758015Z  2025-03-14T03:51:43.1758411Z def get_potential_pr_author( 2025-03-14T03:51:43.1759116Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-03-14T03:51:43.1759810Z ) -> str: 2025-03-14T03:51:43.1760507Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-03-14T03:51:43.1761355Z  # Fetch the actual username from the original PR. The PR number is 2025-03-14T03:51:43.1762141Z  # embedded in the tag name: ciflow// 2025-03-14T03:51:43.1762734Z  2025-03-14T03:51:43.1763138Z  gh = get_gh_client(github_token) 2025-03-14T03:51:43.1763648Z  2025-03-14T03:51:43.1764145Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-03-14T03:51:43.1764791Z  split_tag = ref_name.split("/") 2025-03-14T03:51:43.1765321Z  if ( 2025-03-14T03:51:43.1765863Z  len(split_tag) == 3 2025-03-14T03:51:43.1766411Z  and split_tag[0] == "ciflow" 2025-03-14T03:51:43.1766974Z  and split_tag[2].isnumeric() 2025-03-14T03:51:43.1767493Z  ): 2025-03-14T03:51:43.1767935Z  pr_number = split_tag[2] 2025-03-14T03:51:43.1768455Z  try: 2025-03-14T03:51:43.1768943Z  repository = gh.get_repo(repo) 2025-03-14T03:51:43.1769598Z  pull = repository.get_pull(number=int(pr_number)) 2025-03-14T03:51:43.1770231Z  except Exception as e: 2025-03-14T03:51:43.1770792Z  raise Exception( # noqa: TRY002 2025-03-14T03:51:43.1771492Z  f"issue with pull request {pr_number} from repo {repository}" 2025-03-14T03:51:43.1772150Z  ) from e 2025-03-14T03:51:43.1772751Z  return pull.user.login # type: ignore[no-any-return] 2025-03-14T03:51:43.1773614Z  # In all other cases, return the original input username 2025-03-14T03:51:43.1774224Z  return username 2025-03-14T03:51:43.1774655Z  2025-03-14T03:51:43.1775001Z  2025-03-14T03:51:43.1775438Z def is_exception_branch(branch: str) -> bool: 2025-03-14T03:51:43.1776085Z  """ 2025-03-14T03:51:43.1776788Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-03-14T03:51:43.1777569Z  """ 2025-03-14T03:51:43.1778150Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-03-14T03:51:43.1778825Z  2025-03-14T03:51:43.1779187Z  2025-03-14T03:51:43.1779597Z def load_yaml(yaml_text: str) -> Any: 2025-03-14T03:51:43.1780118Z  try: 2025-03-14T03:51:43.1780592Z  data = yaml.safe_load(yaml_text) 2025-03-14T03:51:43.1781128Z  return data 2025-03-14T03:51:43.1781597Z  except yaml.YAMLError: 2025-03-14T03:51:43.1782140Z  log.exception("Error loading YAML") 2025-03-14T03:51:43.1782681Z  raise 2025-03-14T03:51:43.1783078Z  2025-03-14T03:51:43.1783424Z  2025-03-14T03:51:43.1784063Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-03-14T03:51:43.1784813Z  """ 2025-03-14T03:51:43.1785470Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-03-14T03:51:43.1786308Z  2025-03-14T03:51:43.1786872Z  If the issue body contains "---" then the text above that is the settings 2025-03-14T03:51:43.1787657Z  and the text below is the list of opted in users. 2025-03-14T03:51:43.1788227Z  2025-03-14T03:51:43.1788804Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-03-14T03:51:43.1789515Z  """ 2025-03-14T03:51:43.1790027Z  rollout_state_parts = rollout_state.split("---") 2025-03-14T03:51:43.1790649Z  if len(rollout_state_parts) >= 2: 2025-03-14T03:51:43.1791449Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-03-14T03:51:43.1792072Z  else: 2025-03-14T03:51:43.1792497Z  return "", rollout_state 2025-03-14T03:51:43.1793015Z  2025-03-14T03:51:43.1793370Z  2025-03-14T03:51:43.1793787Z class UserOptins(dict[str, list[str]]): 2025-03-14T03:51:43.1794318Z  """ 2025-03-14T03:51:43.1794881Z  Dictionary of users with a list of features they have opted into 2025-03-14T03:51:43.1795535Z  """ 2025-03-14T03:51:43.1796016Z  2025-03-14T03:51:43.1796366Z  2025-03-14T03:51:43.1796916Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-03-14T03:51:43.1797600Z  """ 2025-03-14T03:51:43.1798374Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-03-14T03:51:43.1799193Z  2025-03-14T03:51:43.1800005Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-03-14T03:51:43.1801004Z  - Example line: "@User1,lf,split_build" 2025-03-14T03:51:43.1801720Z  - A "#" prefix indicates the user is opted out of all experiments 2025-03-14T03:51:43.1802360Z  2025-03-14T03:51:43.1802707Z  2025-03-14T03:51:43.1803049Z  """ 2025-03-14T03:51:43.1803456Z  optins = UserOptins() 2025-03-14T03:51:43.1804001Z  for user in user_optin_text.split("\n"): 2025-03-14T03:51:43.1804593Z  user = user.strip("\r\n\t -") 2025-03-14T03:51:43.1805180Z  if not user or not user.startswith("@"): 2025-03-14T03:51:43.1805989Z  # Not a valid user. Skip 2025-03-14T03:51:43.1806512Z  continue 2025-03-14T03:51:43.1806949Z  2025-03-14T03:51:43.1807301Z  if user: 2025-03-14T03:51:43.1807816Z  usr_name = user.split(",")[0].strip("@") 2025-03-14T03:51:43.1808543Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-03-14T03:51:43.1809192Z  2025-03-14T03:51:43.1809557Z  return optins 2025-03-14T03:51:43.1810009Z  2025-03-14T03:51:43.1810349Z  2025-03-14T03:51:43.1810868Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-03-14T03:51:43.1811494Z  """ 2025-03-14T03:51:43.1811927Z  Check if the experiment name is valid. 2025-03-14T03:51:43.1812472Z  A valid name: 2025-03-14T03:51:43.1813162Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-03-14T03:51:43.1814105Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-03-14T03:51:43.1814823Z  - Cannot contain spaces 2025-03-14T03:51:43.1815314Z  """ 2025-03-14T03:51:43.1815889Z  2025-03-14T03:51:43.1816377Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-03-14T03:51:43.1817111Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-03-14T03:51:43.1817726Z  2025-03-14T03:51:43.1818085Z  if valid: 2025-03-14T03:51:43.1818514Z  return True 2025-03-14T03:51:43.1818945Z  2025-03-14T03:51:43.1819303Z  log.error( 2025-03-14T03:51:43.1820744Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-03-14T03:51:43.1822239Z  ) 2025-03-14T03:51:43.1822620Z  return False 2025-03-14T03:51:43.1823042Z  2025-03-14T03:51:43.1823390Z  2025-03-14T03:51:43.1824069Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-03-14T03:51:43.1824722Z  """ 2025-03-14T03:51:43.1825347Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-03-14T03:51:43.1826165Z  """ 2025-03-14T03:51:43.1826543Z  try: 2025-03-14T03:51:43.1826938Z  if settings_text: 2025-03-14T03:51:43.1827705Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-03-14T03:51:43.1828495Z  # for easy reading 2025-03-14T03:51:43.1829331Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-03-14T03:51:43.1830257Z  # the backtick character in shell commands. 2025-03-14T03:51:43.1830893Z  backtick = chr(96) # backtick character 2025-03-14T03:51:43.1831596Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-03-14T03:51:43.1832283Z  settings = load_yaml(settings_text) 2025-03-14T03:51:43.1832804Z  2025-03-14T03:51:43.1833410Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-03-14T03:51:43.1834158Z  experiments = {} 2025-03-14T03:51:43.1834640Z  2025-03-14T03:51:43.1835212Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-03-14T03:51:43.1836086Z  if not is_valid_experiment_name(exp_name): 2025-03-14T03:51:43.1837193Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-03-14T03:51:43.1838356Z  continue 2025-03-14T03:51:43.1838830Z  2025-03-14T03:51:43.1839221Z  valid_settings = {} 2025-03-14T03:51:43.1839780Z  for setting in exp_settings: 2025-03-14T03:51:43.1840385Z  if setting not in Experiment._fields: 2025-03-14T03:51:43.1840974Z  log.warning( 2025-03-14T03:51:43.1841716Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-03-14T03:51:43.1842436Z  ) 2025-03-14T03:51:43.1842897Z  else: 2025-03-14T03:51:43.1843463Z  valid_settings[setting] = exp_settings[setting] 2025-03-14T03:51:43.1844042Z  2025-03-14T03:51:43.1844528Z  experiments[exp_name] = Experiment(**valid_settings) 2025-03-14T03:51:43.1845189Z  return Settings(experiments) 2025-03-14T03:51:43.1845833Z  2025-03-14T03:51:43.1846209Z  except Exception: 2025-03-14T03:51:43.1846755Z  log.exception("Failed to parse settings") 2025-03-14T03:51:43.1847305Z  2025-03-14T03:51:43.1847691Z  return Settings() 2025-03-14T03:51:43.1848149Z  2025-03-14T03:51:43.1848498Z  2025-03-14T03:51:43.1848968Z def parse_settings(rollout_state: str) -> Settings: 2025-03-14T03:51:43.1849553Z  """ 2025-03-14T03:51:43.1850036Z  Parse settings, if any, from the rollout state. 2025-03-14T03:51:43.1850604Z  2025-03-14T03:51:43.1851165Z  If the issue body contains "---" then the text above that is the settings 2025-03-14T03:51:43.1851952Z  and the text below is the list of opted in users. 2025-03-14T03:51:43.1852525Z  2025-03-14T03:51:43.1853135Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-03-14T03:51:43.1853870Z  """ 2025-03-14T03:51:43.1854467Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-14T03:51:43.1855388Z  return parse_settings_from_text(settings_text) 2025-03-14T03:51:43.1856063Z  2025-03-14T03:51:43.1856400Z  2025-03-14T03:51:43.1856867Z def parse_users(rollout_state: str) -> UserOptins: 2025-03-14T03:51:43.1857444Z  """ 2025-03-14T03:51:43.1857880Z  Parse users from the rollout state. 2025-03-14T03:51:43.1858399Z  2025-03-14T03:51:43.1858748Z  """ 2025-03-14T03:51:43.1859315Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-14T03:51:43.1860084Z  return parse_user_opt_in_from_text(users_text) 2025-03-14T03:51:43.1860649Z  2025-03-14T03:51:43.1860994Z  2025-03-14T03:51:43.1861630Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-14T03:51:43.1862376Z  """ 2025-03-14T03:51:43.1862842Z  Check if a user is opted into an experiment 2025-03-14T03:51:43.1863392Z  """ 2025-03-14T03:51:43.1863895Z  return experiment_name in user_optins.get(user, []) 2025-03-14T03:51:43.1864481Z  2025-03-14T03:51:43.1864818Z  2025-03-14T03:51:43.1865447Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-14T03:51:43.1866298Z  """ 2025-03-14T03:51:43.1866792Z  Check if a user explicitly opted out of an experiment 2025-03-14T03:51:43.1867531Z  """ 2025-03-14T03:51:43.1868177Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-03-14T03:51:43.1868891Z  experiment_optout = "-" + experiment_name 2025-03-14T03:51:43.1869716Z  if experiment_optout not in user_optins.get(user, []): 2025-03-14T03:51:43.1870329Z  return False 2025-03-14T03:51:43.1870766Z  2025-03-14T03:51:43.1871252Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-03-14T03:51:43.1871867Z  log.warning( 2025-03-14T03:51:43.1872704Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-03-14T03:51:43.1873562Z  ) 2025-03-14T03:51:43.1873944Z  2025-03-14T03:51:43.1874304Z  return True 2025-03-14T03:51:43.1874721Z  2025-03-14T03:51:43.1875059Z  2025-03-14T03:51:43.1875465Z def get_runner_prefix( 2025-03-14T03:51:43.1876184Z  rollout_state: str, 2025-03-14T03:51:43.1876710Z  workflow_requestors: Iterable[str], 2025-03-14T03:51:43.1877253Z  branch: str, 2025-03-14T03:51:43.1877804Z  eligible_experiments: frozenset[str] = frozenset(), 2025-03-14T03:51:43.1878428Z  is_canary: bool = False, 2025-03-14T03:51:43.1878909Z ) -> str: 2025-03-14T03:51:43.1879370Z  settings = parse_settings(rollout_state) 2025-03-14T03:51:43.1879976Z  user_optins = parse_users(rollout_state) 2025-03-14T03:51:43.1880506Z  2025-03-14T03:51:43.1880880Z  fleet_prefix = "" 2025-03-14T03:51:43.1881340Z  prefixes = [] 2025-03-14T03:51:43.1882019Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-03-14T03:51:43.1882978Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-03-14T03:51:43.1883692Z  log.info( 2025-03-14T03:51:43.1884405Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-03-14T03:51:43.1885201Z  ) 2025-03-14T03:51:43.1885724Z  continue 2025-03-14T03:51:43.1886162Z  2025-03-14T03:51:43.1886552Z  if eligible_experiments: 2025-03-14T03:51:43.1887279Z  if experiment_name not in eligible_experiments: 2025-03-14T03:51:43.1887957Z  exp_list = ", ".join(eligible_experiments) 2025-03-14T03:51:43.1888538Z  log.info( 2025-03-14T03:51:43.1889364Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-03-14T03:51:43.1890189Z  ) 2025-03-14T03:51:43.1890628Z  continue 2025-03-14T03:51:43.1891148Z  elif not experiment_settings.default: 2025-03-14T03:51:43.1891697Z  log.info( 2025-03-14T03:51:43.1892425Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-03-14T03:51:43.1893245Z  ) 2025-03-14T03:51:43.1893675Z  continue 2025-03-14T03:51:43.1894141Z  2025-03-14T03:51:43.1894638Z  # Is any workflow_requestor opted out to this experiment? 2025-03-14T03:51:43.1895272Z  opted_out_users = [ 2025-03-14T03:51:43.1895873Z  requestor 2025-03-14T03:51:43.1896390Z  for requestor in workflow_requestors 2025-03-14T03:51:43.1897107Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-03-14T03:51:43.1898199Z  ] 2025-03-14T03:51:43.1898690Z  2025-03-14T03:51:43.1899065Z  if opted_out_users: 2025-03-14T03:51:43.1899558Z  log.info( 2025-03-14T03:51:43.1900255Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-03-14T03:51:43.1901144Z  ) 2025-03-14T03:51:43.1901552Z  continue 2025-03-14T03:51:43.1901982Z  2025-03-14T03:51:43.1902462Z  # Is any workflow_requestor opted in to this experiment? 2025-03-14T03:51:43.1903088Z  opted_in_users = [ 2025-03-14T03:51:43.1903579Z  requestor 2025-03-14T03:51:43.1904089Z  for requestor in workflow_requestors 2025-03-14T03:51:43.1904785Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-03-14T03:51:43.1905413Z  ] 2025-03-14T03:51:43.1905931Z  2025-03-14T03:51:43.1906303Z  enabled = False 2025-03-14T03:51:43.1906779Z  if opted_in_users: 2025-03-14T03:51:43.1907265Z  log.info( 2025-03-14T03:51:43.1907920Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-03-14T03:51:43.1908653Z  ) 2025-03-14T03:51:43.1909103Z  enabled = True 2025-03-14T03:51:43.1909594Z  2025-03-14T03:51:43.1910014Z  elif experiment_settings.rollout_perc: 2025-03-14T03:51:43.1910864Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-03-14T03:51:43.1911811Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-03-14T03:51:43.1912488Z  log.info( 2025-03-14T03:51:43.1913422Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-03-14T03:51:43.1914371Z  ) 2025-03-14T03:51:43.1914837Z  enabled = True 2025-03-14T03:51:43.1915332Z  2025-03-14T03:51:43.1915899Z  if enabled: 2025-03-14T03:51:43.1916407Z  label = experiment_name 2025-03-14T03:51:43.1917001Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-03-14T03:51:43.1917870Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-03-14T03:51:43.1918891Z  # - If it's enabled, then we always list it's prefix first 2025-03-14T03:51:43.1919681Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-03-14T03:51:43.1920356Z  if is_canary: 2025-03-14T03:51:43.1920893Z  label += CANARY_FLEET_SUFFIX 2025-03-14T03:51:43.1921466Z  fleet_prefix = label 2025-03-14T03:51:43.1921985Z  else: 2025-03-14T03:51:43.1922479Z  prefixes.append(label) 2025-03-14T03:51:43.1923001Z  2025-03-14T03:51:43.1923380Z  if len(prefixes) > 1: 2025-03-14T03:51:43.1923893Z  log.error( 2025-03-14T03:51:43.1924955Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-03-14T03:51:43.1926145Z  ) 2025-03-14T03:51:43.1926574Z  prefixes = prefixes[:1] 2025-03-14T03:51:43.1927078Z  2025-03-14T03:51:43.1927463Z  # Fleet always comes first 2025-03-14T03:51:43.1928005Z  if fleet_prefix: 2025-03-14T03:51:43.1928500Z  prefixes.insert(0, fleet_prefix) 2025-03-14T03:51:43.1929016Z  2025-03-14T03:51:43.1929491Z  return ".".join(prefixes) + "." if prefixes else "" 2025-03-14T03:51:43.1930072Z  2025-03-14T03:51:43.1930474Z  2025-03-14T03:51:43.1931154Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-03-14T03:51:43.1931916Z  """ 2025-03-14T03:51:43.1932531Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-03-14T03:51:43.1933371Z  2025-03-14T03:51:43.1933998Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-03-14T03:51:43.1934726Z  """ 2025-03-14T03:51:43.1935149Z  gh = get_gh_client(github_token) 2025-03-14T03:51:43.1935844Z  issue = get_issue(gh, repo, issue_num) 2025-03-14T03:51:43.1936551Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-03-14T03:51:43.1937153Z  2025-03-14T03:51:43.1937513Z  2025-03-14T03:51:43.1938158Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-03-14T03:51:43.1938951Z  for _ in range(num_retries): 2025-03-14T03:51:43.1939454Z  try: 2025-03-14T03:51:43.1939933Z  req = Request(url=url, headers=headers) 2025-03-14T03:51:43.1940893Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-03-14T03:51:43.1942010Z  return json.loads(content) 2025-03-14T03:51:43.1942700Z  except Exception as e: 2025-03-14T03:51:43.1943661Z  log.warning(f"Could not download {url}: {e}") 2025-03-14T03:51:43.1944618Z  2025-03-14T03:51:43.1945256Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-03-14T03:51:43.1946144Z  return {} 2025-03-14T03:51:43.1946567Z  2025-03-14T03:51:43.1946915Z  2025-03-14T03:51:43.1947265Z @cache 2025-03-14T03:51:43.1947939Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-03-14T03:51:43.1948739Z  """ 2025-03-14T03:51:43.1949212Z  Dynamically get PR information 2025-03-14T03:51:43.1949730Z  """ 2025-03-14T03:51:43.1950280Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-03-14T03:51:43.1951065Z  headers = { 2025-03-14T03:51:43.1951576Z  "Accept": "application/vnd.github.v3+json", 2025-03-14T03:51:43.1952213Z  "Authorization": f"token {github_token}", 2025-03-14T03:51:43.1952758Z  } 2025-03-14T03:51:43.1953419Z  json_response: dict[str, Any] = download_json( 2025-03-14T03:51:43.1954070Z  url=f"{github_api}/issues/{pr_number}", 2025-03-14T03:51:43.1954634Z  headers=headers, 2025-03-14T03:51:43.1955104Z  ) 2025-03-14T03:51:43.1955472Z  2025-03-14T03:51:43.1956075Z  if not json_response: 2025-03-14T03:51:43.1956712Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-03-14T03:51:43.1957358Z  return {} 2025-03-14T03:51:43.1957793Z  2025-03-14T03:51:43.1958169Z  return json_response 2025-03-14T03:51:43.1958643Z  2025-03-14T03:51:43.1958990Z  2025-03-14T03:51:43.1959599Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-03-14T03:51:43.1960335Z  """ 2025-03-14T03:51:43.1961014Z  Dynamically get the latest list of labels from the pull request 2025-03-14T03:51:43.1961683Z  """ 2025-03-14T03:51:43.1962353Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-03-14T03:51:43.1963004Z  return { 2025-03-14T03:51:43.1963675Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-03-14T03:51:43.1964449Z  } 2025-03-14T03:51:43.1964818Z  2025-03-14T03:51:43.1965165Z  2025-03-14T03:51:43.1965535Z def main() -> None: 2025-03-14T03:51:43.1966184Z  args = parse_args() 2025-03-14T03:51:43.1966657Z  2025-03-14T03:51:43.1967099Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-03-14T03:51:43.1967810Z  2025-03-14T03:51:43.1968208Z  # Check if the PR is opt-out 2025-03-14T03:51:43.1968733Z  if args.pr_number: 2025-03-14T03:51:43.1969446Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-03-14T03:51:43.1970219Z  if OPT_OUT_LABEL in labels: 2025-03-14T03:51:43.1970742Z  log.info( 2025-03-14T03:51:43.1971478Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-03-14T03:51:43.1972243Z  ) 2025-03-14T03:51:43.1972851Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-14T03:51:43.1973536Z  sys.exit() 2025-03-14T03:51:43.1973981Z  2025-03-14T03:51:43.1974326Z  try: 2025-03-14T03:51:43.1974802Z  rollout_state = get_rollout_state_from_issue( 2025-03-14T03:51:43.1975873Z  args.github_token, args.github_issue_repo, args.github_issue 2025-03-14T03:51:43.1976779Z  ) 2025-03-14T03:51:43.1977423Z  2025-03-14T03:51:43.1978117Z  username = get_potential_pr_author( 2025-03-14T03:51:43.1978829Z  args.github_token, 2025-03-14T03:51:43.1979384Z  args.github_repo, 2025-03-14T03:51:43.1979974Z  args.github_actor, 2025-03-14T03:51:43.1980500Z  args.github_ref_type, 2025-03-14T03:51:43.1981040Z  args.github_branch, 2025-03-14T03:51:43.1981534Z  ) 2025-03-14T03:51:43.1981928Z  2025-03-14T03:51:43.1982431Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-03-14T03:51:43.1983097Z  2025-03-14T03:51:43.1983518Z  runner_label_prefix = get_runner_prefix( 2025-03-14T03:51:43.1984096Z  rollout_state, 2025-03-14T03:51:43.1984645Z  (args.github_issue_owner, username), 2025-03-14T03:51:43.1985213Z  args.github_branch, 2025-03-14T03:51:43.1985952Z  args.eligible_experiments, 2025-03-14T03:51:43.1986497Z  is_canary, 2025-03-14T03:51:43.1987133Z  ) 2025-03-14T03:51:43.1987529Z  2025-03-14T03:51:43.1987913Z  except Exception as e: 2025-03-14T03:51:43.1988416Z  log.error( 2025-03-14T03:51:43.1989148Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-03-14T03:51:43.1989909Z  ) 2025-03-14T03:51:43.1990286Z  2025-03-14T03:51:43.1990836Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-14T03:51:43.1991489Z  2025-03-14T03:51:43.1991839Z  2025-03-14T03:51:43.2054487Z if __name__ == "__main__": 2025-03-14T03:51:43.2055405Z  main() 2025-03-14T03:51:43.2056301Z  2025-03-14T03:51:43.2057013Z EOF 2025-03-14T03:51:43.2057602Z  2025-03-14T03:51:43.2058239Z cat runner_determinator.py 2025-03-14T03:51:43.2493494Z shell: /usr/bin/bash -e {0} 2025-03-14T03:51:43.2494302Z env: 2025-03-14T03:51:43.2495006Z GITHUB_TOKEN: *** 2025-03-14T03:51:43.2495413Z ISSUE_NUMBER: 5132 2025-03-14T03:51:43.2496111Z TRIGGERING_ACTOR: pytorchmergebot 2025-03-14T03:51:43.2496608Z ISSUE_OWNER: 2025-03-14T03:51:43.2497006Z CHECK_EXPERIMENTS: 2025-03-14T03:51:43.2497411Z PR_NUMBER: 2025-03-14T03:51:43.2497778Z ##[endgroup] 2025-03-14T03:51:43.2723234Z # flake8: noqa: G004 2025-03-14T03:51:43.2723564Z 2025-03-14T03:51:43.2724036Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-03-14T03:51:43.2724957Z # must be kept in sync. You can do it easily by running the following command: 2025-03-14T03:51:43.2725956Z # python .github/scripts/update_runner_determinator.py 2025-03-14T03:51:43.2726667Z 2025-03-14T03:51:43.2726825Z """ 2025-03-14T03:51:43.2727386Z This runner determinator is used to determine which set of runners to run a 2025-03-14T03:51:43.2728220Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-03-14T03:51:43.2729101Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-03-14T03:51:43.2729900Z of which runners should be used to run which job. 2025-03-14T03:51:43.2730289Z 2025-03-14T03:51:43.2730661Z The configuration has two parts, the settings and a list of opted-in users, 2025-03-14T03:51:43.2731525Z separated by a line containing "---". If the line is not present, the 2025-03-14T03:51:43.2732350Z settings are considered to be empty with only the second part, the user 2025-03-14T03:51:43.2733011Z list, defined. 2025-03-14T03:51:43.2733226Z 2025-03-14T03:51:43.2733574Z The first part is a YAML block that defines the rollout settings. This can be 2025-03-14T03:51:43.2734538Z used to define any settings that are needed to determine which runners to use. 2025-03-14T03:51:43.2735317Z It's fields are defined by the RolloutSettings class below. 2025-03-14T03:51:43.2735963Z 2025-03-14T03:51:43.2736322Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-03-14T03:51:43.2737159Z The user list is also a comma separated list of additional features or 2025-03-14T03:51:43.2737862Z experiments which the user could be opted in to. 2025-03-14T03:51:43.2738246Z 2025-03-14T03:51:43.2738433Z The user list has the following rules: 2025-03-14T03:51:43.2738772Z 2025-03-14T03:51:43.2739074Z - Users are GitHub usernames, which must start with the @ prefix 2025-03-14T03:51:43.2739912Z - Each user is also a comma-separated list of features/experiments to enable 2025-03-14T03:51:43.2740654Z - A "#" prefix opts the user out of all experiments 2025-03-14T03:51:43.2741038Z 2025-03-14T03:51:43.2741205Z Example config: 2025-03-14T03:51:43.2741634Z # A list of experiments that can be opted into. 2025-03-14T03:51:43.2742273Z # This defines the behavior they'll induce when opted into. 2025-03-14T03:51:43.2742870Z # Expected syntax is: 2025-03-14T03:51:43.2743480Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-03-14T03:51:43.2744597Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-03-14T03:51:43.2745198Z 2025-03-14T03:51:43.2745366Z experiments: 2025-03-14T03:51:43.2745896Z lf: 2025-03-14T03:51:43.2746267Z rollout_percent: 25 2025-03-14T03:51:43.2746710Z all_branches: false 2025-03-14T03:51:43.2747136Z default: true 2025-03-14T03:51:43.2747525Z --- 2025-03-14T03:51:43.2747712Z 2025-03-14T03:51:43.2747868Z # Opt-ins: 2025-03-14T03:51:43.2748427Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-03-14T03:51:43.2749256Z # and specifying experiments to enable in a comma-separated list. 2025-03-14T03:51:43.2750003Z # To always opt out of an experiment, prefix it with a "-". 2025-03-14T03:51:43.2750629Z # Experiments should be from the above list. 2025-03-14T03:51:43.2750991Z 2025-03-14T03:51:43.2751165Z @User1,-lf,split_build 2025-03-14T03:51:43.2751572Z @User2,lf 2025-03-14T03:51:43.2751934Z @User3,split_build 2025-03-14T03:51:43.2752325Z """ 2025-03-14T03:51:43.2752506Z 2025-03-14T03:51:43.2752663Z import json 2025-03-14T03:51:43.2753012Z import logging 2025-03-14T03:51:43.2753368Z import os 2025-03-14T03:51:43.2753706Z import random 2025-03-14T03:51:43.2754057Z import re 2025-03-14T03:51:43.2754400Z import sys 2025-03-14T03:51:43.2754770Z from argparse import ArgumentParser 2025-03-14T03:51:43.2755279Z from collections.abc import Iterable 2025-03-14T03:51:43.2756022Z from functools import cache 2025-03-14T03:51:43.2756486Z from logging import LogRecord 2025-03-14T03:51:43.2756952Z from typing import Any, NamedTuple 2025-03-14T03:51:43.2757454Z from urllib.request import Request, urlopen 2025-03-14T03:51:43.2757958Z 2025-03-14T03:51:43.2758111Z import yaml 2025-03-14T03:51:43.2758483Z from github import Auth, Github 2025-03-14T03:51:43.2758952Z from github.Issue import Issue 2025-03-14T03:51:43.2759239Z 2025-03-14T03:51:43.2759245Z 2025-03-14T03:51:43.2759458Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-03-14T03:51:43.2760126Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-03-14T03:51:43.2760942Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-03-14T03:51:43.2761479Z 2025-03-14T03:51:43.2761690Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-03-14T03:51:43.2762233Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-03-14T03:51:43.2762718Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-03-14T03:51:43.2763253Z OPT_OUT_LABEL = "no-runner-experiments" 2025-03-14T03:51:43.2763588Z 2025-03-14T03:51:43.2763770Z SETTING_EXPERIMENTS = "experiments" 2025-03-14T03:51:43.2764091Z 2025-03-14T03:51:43.2764277Z LF_FLEET_EXPERIMENT = "lf" 2025-03-14T03:51:43.2764721Z CANARY_FLEET_SUFFIX = ".c" 2025-03-14T03:51:43.2764998Z 2025-03-14T03:51:43.2765004Z 2025-03-14T03:51:43.2765183Z class Experiment(NamedTuple): 2025-03-14T03:51:43.2765779Z rollout_perc: float = ( 2025-03-14T03:51:43.2766413Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-03-14T03:51:43.2767046Z ) 2025-03-14T03:51:43.2767400Z all_branches: bool = ( 2025-03-14T03:51:43.2767999Z False # If True, the experiment is also enabled on the exception branches 2025-03-14T03:51:43.2768648Z ) 2025-03-14T03:51:43.2768993Z default: bool = ( 2025-03-14T03:51:43.2769540Z True # If True, the experiment is enabled by default for all queries 2025-03-14T03:51:43.2770164Z ) 2025-03-14T03:51:43.2770353Z 2025-03-14T03:51:43.2770525Z # Add more fields as needed 2025-03-14T03:51:43.2770812Z 2025-03-14T03:51:43.2770818Z 2025-03-14T03:51:43.2770999Z class Settings(NamedTuple): 2025-03-14T03:51:43.2771434Z """ 2025-03-14T03:51:43.2771866Z Settings for the experiments that can be opted into. 2025-03-14T03:51:43.2772417Z """ 2025-03-14T03:51:43.2772612Z 2025-03-14T03:51:43.2772813Z experiments: dict[str, Experiment] = {} 2025-03-14T03:51:43.2773167Z 2025-03-14T03:51:43.2773173Z 2025-03-14T03:51:43.2773490Z class ColorFormatter(logging.Formatter): 2025-03-14T03:51:43.2774098Z """Color codes the log messages based on the log level""" 2025-03-14T03:51:43.2774510Z 2025-03-14T03:51:43.2774670Z COLORS = { 2025-03-14T03:51:43.2775045Z "WARNING": "\033[33m", # Yellow 2025-03-14T03:51:43.2775535Z "ERROR": "\033[31m", # Red 2025-03-14T03:51:43.2776113Z "CRITICAL": "\033[31m", # Red 2025-03-14T03:51:43.2776595Z "INFO": "\033[0m", # Reset 2025-03-14T03:51:43.2777064Z "DEBUG": "\033[0m", # Reset 2025-03-14T03:51:43.2777506Z } 2025-03-14T03:51:43.2777698Z 2025-03-14T03:51:43.2777913Z def format(self, record: LogRecord) -> str: 2025-03-14T03:51:43.2778650Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-03-14T03:51:43.2779449Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-03-14T03:51:43.2780018Z return super().format(record) 2025-03-14T03:51:43.2780341Z 2025-03-14T03:51:43.2780347Z 2025-03-14T03:51:43.2780545Z handler = logging.StreamHandler() 2025-03-14T03:51:43.2781228Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-03-14T03:51:43.2781764Z 2025-03-14T03:51:43.2781995Z log = logging.getLogger(os.path.basename(__file__)) 2025-03-14T03:51:43.2782561Z log.addHandler(handler) 2025-03-14T03:51:43.2782991Z log.setLevel(logging.INFO) 2025-03-14T03:51:43.2783270Z 2025-03-14T03:51:43.2783275Z 2025-03-14T03:51:43.2783519Z def set_github_output(key: str, value: str) -> None: 2025-03-14T03:51:43.2784054Z """ 2025-03-14T03:51:43.2784532Z Defines outputs of the github action that invokes this script 2025-03-14T03:51:43.2785142Z """ 2025-03-14T03:51:43.2785729Z if not GITHUB_OUTPUT: 2025-03-14T03:51:43.2786931Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-03-14T03:51:43.2787994Z log.warning( 2025-03-14T03:51:43.2788806Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-03-14T03:51:43.2789689Z ) 2025-03-14T03:51:43.2800174Z print(f"::set-output name={key}::{value}") 2025-03-14T03:51:43.2800778Z return 2025-03-14T03:51:43.2800999Z 2025-03-14T03:51:43.2801200Z with open(GITHUB_OUTPUT, "a") as f: 2025-03-14T03:51:43.2801778Z log.info(f"Setting output: {key}='{value}'") 2025-03-14T03:51:43.2802354Z f.write(f"{key}={value}\n") 2025-03-14T03:51:43.2802671Z 2025-03-14T03:51:43.2802677Z 2025-03-14T03:51:43.2802982Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-03-14T03:51:43.2803585Z return frozenset( 2025-03-14T03:51:43.2804192Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-03-14T03:51:43.2804846Z ) 2025-03-14T03:51:43.2805035Z 2025-03-14T03:51:43.2805041Z 2025-03-14T03:51:43.2805215Z def parse_args() -> Any: 2025-03-14T03:51:43.2805957Z parser = ArgumentParser("Get dynamic rollout settings") 2025-03-14T03:51:43.2806803Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-03-14T03:51:43.2807543Z parser.add_argument( 2025-03-14T03:51:43.2807980Z "--github-issue-repo", 2025-03-14T03:51:43.2808425Z type=str, 2025-03-14T03:51:43.2808807Z required=False, 2025-03-14T03:51:43.2809233Z default="pytorch/test-infra", 2025-03-14T03:51:43.2809734Z help="GitHub repo to get the issue", 2025-03-14T03:51:43.2810264Z ) 2025-03-14T03:51:43.2810632Z parser.add_argument( 2025-03-14T03:51:43.2811054Z "--github-repo", 2025-03-14T03:51:43.2811455Z type=str, 2025-03-14T03:51:43.2811829Z required=True, 2025-03-14T03:51:43.2812263Z help="GitHub repo where CI is running", 2025-03-14T03:51:43.2812768Z ) 2025-03-14T03:51:43.2813119Z parser.add_argument( 2025-03-14T03:51:43.2813695Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-03-14T03:51:43.2814511Z ) 2025-03-14T03:51:43.2814872Z parser.add_argument( 2025-03-14T03:51:43.2815461Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-03-14T03:51:43.2816211Z ) 2025-03-14T03:51:43.2816556Z parser.add_argument( 2025-03-14T03:51:43.2817171Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-03-14T03:51:43.2817828Z ) 2025-03-14T03:51:43.2818181Z parser.add_argument( 2025-03-14T03:51:43.2818807Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-03-14T03:51:43.2819488Z ) 2025-03-14T03:51:43.2819832Z parser.add_argument( 2025-03-14T03:51:43.2820275Z "--github-ref-type", 2025-03-14T03:51:43.2820713Z type=str, 2025-03-14T03:51:43.2821091Z required=True, 2025-03-14T03:51:43.2821547Z help="Current GitHub ref type, branch or tag", 2025-03-14T03:51:43.2822069Z ) 2025-03-14T03:51:43.2822414Z parser.add_argument( 2025-03-14T03:51:43.2822859Z "--eligible-experiments", 2025-03-14T03:51:43.2823348Z type=_str_comma_separated_to_set, 2025-03-14T03:51:43.2823869Z required=False, 2025-03-14T03:51:43.2824273Z default="", 2025-03-14T03:51:43.2825079Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-03-14T03:51:43.2826076Z ) 2025-03-14T03:51:43.2826427Z parser.add_argument( 2025-03-14T03:51:43.2826844Z "--pr-number", 2025-03-14T03:51:43.2827239Z type=str, 2025-03-14T03:51:43.2827642Z required=False, 2025-03-14T03:51:43.2828044Z default="", 2025-03-14T03:51:43.2828635Z help="the optional PR number where this is run", 2025-03-14T03:51:43.2829156Z ) 2025-03-14T03:51:43.2829351Z 2025-03-14T03:51:43.2829539Z return parser.parse_args() 2025-03-14T03:51:43.2829837Z 2025-03-14T03:51:43.2829843Z 2025-03-14T03:51:43.2830224Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-03-14T03:51:43.2830942Z auth = Auth.Token(github_token) 2025-03-14T03:51:43.2831427Z return Github(auth=auth) 2025-03-14T03:51:43.2831711Z 2025-03-14T03:51:43.2831717Z 2025-03-14T03:51:43.2832170Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-03-14T03:51:43.2832914Z repo = gh.get_repo(repo) 2025-03-14T03:51:43.2833388Z return repo.get_issue(number=issue_num) 2025-03-14T03:51:43.2833740Z 2025-03-14T03:51:43.2833746Z 2025-03-14T03:51:43.2833920Z def get_potential_pr_author( 2025-03-14T03:51:43.2834537Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-03-14T03:51:43.2835184Z ) -> str: 2025-03-14T03:51:43.2835803Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-03-14T03:51:43.2836571Z # Fetch the actual username from the original PR. The PR number is 2025-03-14T03:51:43.2837284Z # embedded in the tag name: ciflow// 2025-03-14T03:51:43.2837696Z 2025-03-14T03:51:43.2837874Z gh = get_gh_client(github_token) 2025-03-14T03:51:43.2838193Z 2025-03-14T03:51:43.2838453Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-03-14T03:51:43.2839046Z split_tag = ref_name.split("/") 2025-03-14T03:51:43.2839514Z if ( 2025-03-14T03:51:43.2839884Z len(split_tag) == 3 2025-03-14T03:51:43.2840345Z and split_tag[0] == "ciflow" 2025-03-14T03:51:43.2840847Z and split_tag[2].isnumeric() 2025-03-14T03:51:43.2841319Z ): 2025-03-14T03:51:43.2841677Z pr_number = split_tag[2] 2025-03-14T03:51:43.2842137Z try: 2025-03-14T03:51:43.2842551Z repository = gh.get_repo(repo) 2025-03-14T03:51:43.2843130Z pull = repository.get_pull(number=int(pr_number)) 2025-03-14T03:51:43.2843709Z except Exception as e: 2025-03-14T03:51:43.2844202Z raise Exception( # noqa: TRY002 2025-03-14T03:51:43.2844971Z f"issue with pull request {pr_number} from repo {repository}" 2025-03-14T03:51:43.2845728Z ) from e 2025-03-14T03:51:43.2846250Z return pull.user.login # type: ignore[no-any-return] 2025-03-14T03:51:43.2846913Z # In all other cases, return the original input username 2025-03-14T03:51:43.2847478Z return username 2025-03-14T03:51:43.2847702Z 2025-03-14T03:51:43.2847709Z 2025-03-14T03:51:43.2847919Z def is_exception_branch(branch: str) -> bool: 2025-03-14T03:51:43.2848431Z """ 2025-03-14T03:51:43.2849043Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-03-14T03:51:43.2849777Z """ 2025-03-14T03:51:43.2850303Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-03-14T03:51:43.2850791Z 2025-03-14T03:51:43.2850798Z 2025-03-14T03:51:43.2850979Z def load_yaml(yaml_text: str) -> Any: 2025-03-14T03:51:43.2851454Z try: 2025-03-14T03:51:43.2851831Z data = yaml.safe_load(yaml_text) 2025-03-14T03:51:43.2852318Z return data 2025-03-14T03:51:43.2852712Z except yaml.YAMLError: 2025-03-14T03:51:43.2853166Z log.exception("Error loading YAML") 2025-03-14T03:51:43.2853665Z raise 2025-03-14T03:51:43.2853875Z 2025-03-14T03:51:43.2853880Z 2025-03-14T03:51:43.2854268Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-03-14T03:51:43.2854969Z """ 2025-03-14T03:51:43.2855558Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-03-14T03:51:43.2856222Z 2025-03-14T03:51:43.2856558Z If the issue body contains "---" then the text above that is the settings 2025-03-14T03:51:43.2857407Z and the text below is the list of opted in users. 2025-03-14T03:51:43.2857796Z 2025-03-14T03:51:43.2858149Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-03-14T03:51:43.2858809Z """ 2025-03-14T03:51:43.2859228Z rollout_state_parts = rollout_state.split("---") 2025-03-14T03:51:43.2859801Z if len(rollout_state_parts) >= 2: 2025-03-14T03:51:43.2860373Z return rollout_state_parts[0], rollout_state_parts[1] 2025-03-14T03:51:43.2860925Z else: 2025-03-14T03:51:43.2861289Z return "", rollout_state 2025-03-14T03:51:43.2861586Z 2025-03-14T03:51:43.2861592Z 2025-03-14T03:51:43.2861776Z class UserOptins(dict[str, list[str]]): 2025-03-14T03:51:43.2862256Z """ 2025-03-14T03:51:43.2862749Z Dictionary of users with a list of features they have opted into 2025-03-14T03:51:43.2863364Z """ 2025-03-14T03:51:43.2863558Z 2025-03-14T03:51:43.2863564Z 2025-03-14T03:51:43.2863894Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-03-14T03:51:43.2864515Z """ 2025-03-14T03:51:43.2865215Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-03-14T03:51:43.2865971Z 2025-03-14T03:51:43.2866565Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-03-14T03:51:43.2867497Z - Example line: "@User1,lf,split_build" 2025-03-14T03:51:43.2868152Z - A "#" prefix indicates the user is opted out of all experiments 2025-03-14T03:51:43.2868612Z 2025-03-14T03:51:43.2868619Z 2025-03-14T03:51:43.2868764Z """ 2025-03-14T03:51:43.2869124Z optins = UserOptins() 2025-03-14T03:51:43.2869588Z for user in user_optin_text.split("\n"): 2025-03-14T03:51:43.2870117Z user = user.strip("\r\n\t -") 2025-03-14T03:51:43.2870632Z if not user or not user.startswith("@"): 2025-03-14T03:51:43.2871173Z # Not a valid user. Skip 2025-03-14T03:51:43.2871641Z continue 2025-03-14T03:51:43.2871878Z 2025-03-14T03:51:43.2872029Z if user: 2025-03-14T03:51:43.2872446Z usr_name = user.split(",")[0].strip("@") 2025-03-14T03:51:43.2873115Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-03-14T03:51:43.2873705Z 2025-03-14T03:51:43.2873868Z return optins 2025-03-14T03:51:43.2874100Z 2025-03-14T03:51:43.2874106Z 2025-03-14T03:51:43.2874381Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-03-14T03:51:43.2874949Z """ 2025-03-14T03:51:43.2875324Z Check if the experiment name is valid. 2025-03-14T03:51:43.2875953Z A valid name: 2025-03-14T03:51:43.2876548Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-03-14T03:51:43.2877433Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-03-14T03:51:43.2878115Z - Cannot contain spaces 2025-03-14T03:51:43.2878557Z """ 2025-03-14T03:51:43.2878743Z 2025-03-14T03:51:43.2878996Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-03-14T03:51:43.2879660Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-03-14T03:51:43.2880077Z 2025-03-14T03:51:43.2880232Z if valid: 2025-03-14T03:51:43.2880600Z return True 2025-03-14T03:51:43.2880834Z 2025-03-14T03:51:43.2880991Z log.error( 2025-03-14T03:51:43.2882578Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-03-14T03:51:43.2884134Z ) 2025-03-14T03:51:43.2884482Z return False 2025-03-14T03:51:43.2884707Z 2025-03-14T03:51:43.2884713Z 2025-03-14T03:51:43.2885011Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-03-14T03:51:43.2885712Z """ 2025-03-14T03:51:43.2886275Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-03-14T03:51:43.2887119Z """ 2025-03-14T03:51:43.2887446Z try: 2025-03-14T03:51:43.2887796Z if settings_text: 2025-03-14T03:51:43.2888478Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-03-14T03:51:43.2889236Z # for easy reading 2025-03-14T03:51:43.2889983Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-03-14T03:51:43.2890820Z # the backtick character in shell commands. 2025-03-14T03:51:43.2891405Z backtick = chr(96) # backtick character 2025-03-14T03:51:43.2892038Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-03-14T03:51:43.2892660Z settings = load_yaml(settings_text) 2025-03-14T03:51:43.2893037Z 2025-03-14T03:51:43.2893420Z # For now we just load experiments. We can expand this if/when we add more settings 2025-03-14T03:51:43.2894131Z experiments = {} 2025-03-14T03:51:43.2894413Z 2025-03-14T03:51:43.2894758Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-03-14T03:51:43.2895479Z if not is_valid_experiment_name(exp_name): 2025-03-14T03:51:43.2896633Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-03-14T03:51:43.2897660Z continue 2025-03-14T03:51:43.2897946Z 2025-03-14T03:51:43.2898121Z valid_settings = {} 2025-03-14T03:51:43.2898618Z for setting in exp_settings: 2025-03-14T03:51:43.2899152Z if setting not in Experiment._fields: 2025-03-14T03:51:43.2899681Z log.warning( 2025-03-14T03:51:43.2900350Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-03-14T03:51:43.2901024Z ) 2025-03-14T03:51:43.2901492Z else: 2025-03-14T03:51:43.2901984Z valid_settings[setting] = exp_settings[setting] 2025-03-14T03:51:43.2902407Z 2025-03-14T03:51:43.2902673Z experiments[exp_name] = Experiment(**valid_settings) 2025-03-14T03:51:43.2903410Z return Settings(experiments) 2025-03-14T03:51:43.2903754Z 2025-03-14T03:51:43.2903915Z except Exception: 2025-03-14T03:51:43.2904366Z log.exception("Failed to parse settings") 2025-03-14T03:51:43.2904738Z 2025-03-14T03:51:43.2904899Z return Settings() 2025-03-14T03:51:43.2905136Z 2025-03-14T03:51:43.2905142Z 2025-03-14T03:51:43.2905382Z def parse_settings(rollout_state: str) -> Settings: 2025-03-14T03:51:43.2906017Z """ 2025-03-14T03:51:43.2906429Z Parse settings, if any, from the rollout state. 2025-03-14T03:51:43.2906814Z 2025-03-14T03:51:43.2907151Z If the issue body contains "---" then the text above that is the settings 2025-03-14T03:51:43.2907876Z and the text below is the list of opted in users. 2025-03-14T03:51:43.2908264Z 2025-03-14T03:51:43.2908670Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-03-14T03:51:43.2909389Z """ 2025-03-14T03:51:43.2909920Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-14T03:51:43.2910631Z return parse_settings_from_text(settings_text) 2025-03-14T03:51:43.2911015Z 2025-03-14T03:51:43.2911021Z 2025-03-14T03:51:43.2911250Z def parse_users(rollout_state: str) -> UserOptins: 2025-03-14T03:51:43.2911780Z """ 2025-03-14T03:51:43.2912151Z Parse users from the rollout state. 2025-03-14T03:51:43.2912490Z 2025-03-14T03:51:43.2912646Z """ 2025-03-14T03:51:43.2913143Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-14T03:51:43.2913826Z return parse_user_opt_in_from_text(users_text) 2025-03-14T03:51:43.2914205Z 2025-03-14T03:51:43.2914211Z 2025-03-14T03:51:43.2914724Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-14T03:51:43.2915478Z """ 2025-03-14T03:51:43.2915981Z Check if a user is opted into an experiment 2025-03-14T03:51:43.2916490Z """ 2025-03-14T03:51:43.2916911Z return experiment_name in user_optins.get(user, []) 2025-03-14T03:51:43.2917324Z 2025-03-14T03:51:43.2917330Z 2025-03-14T03:51:43.2917723Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-14T03:51:43.2918429Z """ 2025-03-14T03:51:43.2918853Z Check if a user explicitly opted out of an experiment 2025-03-14T03:51:43.2919407Z """ 2025-03-14T03:51:43.2919882Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-03-14T03:51:43.2920533Z experiment_optout = "-" + experiment_name 2025-03-14T03:51:43.2921135Z if experiment_optout not in user_optins.get(user, []): 2025-03-14T03:51:43.2921754Z return False 2025-03-14T03:51:43.2921985Z 2025-03-14T03:51:43.2922251Z if is_user_opted_in(user, user_optins, experiment_name): 2025-03-14T03:51:43.2922815Z log.warning( 2025-03-14T03:51:43.2923573Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-03-14T03:51:43.2924420Z ) 2025-03-14T03:51:43.2924622Z 2025-03-14T03:51:43.2924775Z return True 2025-03-14T03:51:43.2924997Z 2025-03-14T03:51:43.2925003Z 2025-03-14T03:51:43.2925168Z def get_runner_prefix( 2025-03-14T03:51:43.2925579Z rollout_state: str, 2025-03-14T03:51:43.2926107Z workflow_requestors: Iterable[str], 2025-03-14T03:51:43.2926586Z branch: str, 2025-03-14T03:51:43.2927046Z eligible_experiments: frozenset[str] = frozenset(), 2025-03-14T03:51:43.2927617Z is_canary: bool = False, 2025-03-14T03:51:43.2928046Z ) -> str: 2025-03-14T03:51:43.2928435Z settings = parse_settings(rollout_state) 2025-03-14T03:51:43.2928978Z user_optins = parse_users(rollout_state) 2025-03-14T03:51:43.2929342Z 2025-03-14T03:51:43.2929504Z fleet_prefix = "" 2025-03-14T03:51:43.2929912Z prefixes = [] 2025-03-14T03:51:43.2930500Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-03-14T03:51:43.2931384Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-03-14T03:51:43.2932197Z log.info( 2025-03-14T03:51:43.2932853Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-03-14T03:51:43.2933571Z ) 2025-03-14T03:51:43.2933923Z continue 2025-03-14T03:51:43.2934155Z 2025-03-14T03:51:43.2934344Z if eligible_experiments: 2025-03-14T03:51:43.2934869Z if experiment_name not in eligible_experiments: 2025-03-14T03:51:43.2935454Z exp_list = ", ".join(eligible_experiments) 2025-03-14T03:51:43.2936089Z log.info( 2025-03-14T03:51:43.2936825Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-03-14T03:51:43.2937625Z ) 2025-03-14T03:51:43.2938004Z continue 2025-03-14T03:51:43.2938447Z elif not experiment_settings.default: 2025-03-14T03:51:43.2938949Z log.info( 2025-03-14T03:51:43.2939572Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-03-14T03:51:43.2940261Z ) 2025-03-14T03:51:43.2940608Z continue 2025-03-14T03:51:43.2940847Z 2025-03-14T03:51:43.2941108Z # Is any workflow_requestor opted out to this experiment? 2025-03-14T03:51:43.2941701Z opted_out_users = [ 2025-03-14T03:51:43.2942124Z requestor 2025-03-14T03:51:43.2942551Z for requestor in workflow_requestors 2025-03-14T03:51:43.2943211Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-03-14T03:51:43.2943798Z ] 2025-03-14T03:51:43.2943996Z 2025-03-14T03:51:43.2944163Z if opted_out_users: 2025-03-14T03:51:43.2944716Z log.info( 2025-03-14T03:51:43.2945302Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-03-14T03:51:43.2946049Z ) 2025-03-14T03:51:43.2946394Z continue 2025-03-14T03:51:43.2946632Z 2025-03-14T03:51:43.2946896Z # Is any workflow_requestor opted in to this experiment? 2025-03-14T03:51:43.2947471Z opted_in_users = [ 2025-03-14T03:51:43.2947905Z requestor 2025-03-14T03:51:43.2948341Z for requestor in workflow_requestors 2025-03-14T03:51:43.2948972Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-03-14T03:51:43.2949553Z ] 2025-03-14T03:51:43.2949749Z 2025-03-14T03:51:43.2949911Z enabled = False 2025-03-14T03:51:43.2950318Z if opted_in_users: 2025-03-14T03:51:43.2950737Z log.info( 2025-03-14T03:51:43.2951308Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-03-14T03:51:43.2951946Z ) 2025-03-14T03:51:43.2952312Z enabled = True 2025-03-14T03:51:43.2952582Z 2025-03-14T03:51:43.2952785Z elif experiment_settings.rollout_perc: 2025-03-14T03:51:43.2953569Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-03-14T03:51:43.2954446Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-03-14T03:51:43.2955064Z log.info( 2025-03-14T03:51:43.2955975Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-03-14T03:51:43.2956833Z ) 2025-03-14T03:51:43.2957208Z enabled = True 2025-03-14T03:51:43.2957492Z 2025-03-14T03:51:43.2957653Z if enabled: 2025-03-14T03:51:43.2958053Z label = experiment_name 2025-03-14T03:51:43.2958569Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-03-14T03:51:43.2959356Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-03-14T03:51:43.2960173Z # - If it's enabled, then we always list it's prefix first 2025-03-14T03:51:43.2961079Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-03-14T03:51:43.2961715Z if is_canary: 2025-03-14T03:51:43.2962172Z label += CANARY_FLEET_SUFFIX 2025-03-14T03:51:43.2962743Z fleet_prefix = label 2025-03-14T03:51:43.2963209Z else: 2025-03-14T03:51:43.2963608Z prefixes.append(label) 2025-03-14T03:51:43.2963938Z 2025-03-14T03:51:43.2964108Z if len(prefixes) > 1: 2025-03-14T03:51:43.2964517Z log.error( 2025-03-14T03:51:43.2965481Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-03-14T03:51:43.2966826Z ) 2025-03-14T03:51:43.2967264Z prefixes = prefixes[:1] 2025-03-14T03:51:43.2967553Z 2025-03-14T03:51:43.2967732Z # Fleet always comes first 2025-03-14T03:51:43.2968197Z if fleet_prefix: 2025-03-14T03:51:43.2968620Z prefixes.insert(0, fleet_prefix) 2025-03-14T03:51:43.2968962Z 2025-03-14T03:51:43.2969203Z return ".".join(prefixes) + "." if prefixes else "" 2025-03-14T03:51:43.2969594Z 2025-03-14T03:51:43.2969600Z 2025-03-14T03:51:43.2970008Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-03-14T03:51:43.2970738Z """ 2025-03-14T03:51:43.2971292Z Gets the first comment of the issue, which contains the desired rollout state. 2025-03-14T03:51:43.2971819Z 2025-03-14T03:51:43.2972194Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-03-14T03:51:43.2972849Z """ 2025-03-14T03:51:43.2973214Z gh = get_gh_client(github_token) 2025-03-14T03:51:43.2973723Z issue = get_issue(gh, repo, issue_num) 2025-03-14T03:51:43.2974477Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-03-14T03:51:43.2974894Z 2025-03-14T03:51:43.2974901Z 2025-03-14T03:51:43.2975289Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-03-14T03:51:43.2976109Z for _ in range(num_retries): 2025-03-14T03:51:43.2976557Z try: 2025-03-14T03:51:43.2976958Z req = Request(url=url, headers=headers) 2025-03-14T03:51:43.2977586Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-03-14T03:51:43.2978192Z return json.loads(content) 2025-03-14T03:51:43.2978688Z except Exception as e: 2025-03-14T03:51:43.2979198Z log.warning(f"Could not download {url}: {e}") 2025-03-14T03:51:43.2979579Z 2025-03-14T03:51:43.2979932Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-03-14T03:51:43.2980596Z return {} 2025-03-14T03:51:43.2980807Z 2025-03-14T03:51:43.2980813Z 2025-03-14T03:51:43.2980969Z @cache 2025-03-14T03:51:43.2981547Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-03-14T03:51:43.2982246Z """ 2025-03-14T03:51:43.2982614Z Dynamically get PR information 2025-03-14T03:51:43.2983072Z """ 2025-03-14T03:51:43.2983537Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-03-14T03:51:43.2984127Z headers = { 2025-03-14T03:51:43.2984545Z "Accept": "application/vnd.github.v3+json", 2025-03-14T03:51:43.2985116Z "Authorization": f"token {github_token}", 2025-03-14T03:51:43.2985721Z } 2025-03-14T03:51:43.2986122Z json_response: dict[str, Any] = download_json( 2025-03-14T03:51:43.2986697Z url=f"{github_api}/issues/{pr_number}", 2025-03-14T03:51:43.2987208Z headers=headers, 2025-03-14T03:51:43.2987610Z ) 2025-03-14T03:51:43.2987799Z 2025-03-14T03:51:43.2987971Z if not json_response: 2025-03-14T03:51:43.2988508Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-03-14T03:51:43.2989089Z return {} 2025-03-14T03:51:43.2989326Z 2025-03-14T03:51:43.2989499Z return json_response 2025-03-14T03:51:43.2989759Z 2025-03-14T03:51:43.2989764Z 2025-03-14T03:51:43.2990142Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-03-14T03:51:43.2990945Z """ 2025-03-14T03:51:43.2991446Z Dynamically get the latest list of labels from the pull request 2025-03-14T03:51:43.2992051Z """ 2025-03-14T03:51:43.2992500Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-03-14T03:51:43.2993062Z return { 2025-03-14T03:51:43.2993602Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-03-14T03:51:43.2994248Z } 2025-03-14T03:51:43.2994439Z 2025-03-14T03:51:43.2994445Z 2025-03-14T03:51:43.2994612Z def main() -> None: 2025-03-14T03:51:43.2995005Z args = parse_args() 2025-03-14T03:51:43.2995252Z 2025-03-14T03:51:43.2995463Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-03-14T03:51:43.2995927Z 2025-03-14T03:51:43.2996103Z # Check if the PR is opt-out 2025-03-14T03:51:43.2996557Z if args.pr_number: 2025-03-14T03:51:43.2997165Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-03-14T03:51:43.2997873Z if OPT_OUT_LABEL in labels: 2025-03-14T03:51:43.2998336Z log.info( 2025-03-14T03:51:43.2998971Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-03-14T03:51:43.2999686Z ) 2025-03-14T03:51:43.3000197Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-14T03:51:43.3000821Z sys.exit() 2025-03-14T03:51:43.3001058Z 2025-03-14T03:51:43.3001215Z try: 2025-03-14T03:51:43.3001620Z rollout_state = get_rollout_state_from_issue( 2025-03-14T03:51:43.3002288Z args.github_token, args.github_issue_repo, args.github_issue 2025-03-14T03:51:43.3002894Z ) 2025-03-14T03:51:43.3003214Z 2025-03-14T03:51:43.3003416Z username = get_potential_pr_author( 2025-03-14T03:51:43.3003920Z args.github_token, 2025-03-14T03:51:43.3004365Z args.github_repo, 2025-03-14T03:51:43.3004821Z args.github_actor, 2025-03-14T03:51:43.3005279Z args.github_ref_type, 2025-03-14T03:51:43.3005854Z args.github_branch, 2025-03-14T03:51:43.3006288Z ) 2025-03-14T03:51:43.3006476Z 2025-03-14T03:51:43.3006748Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-03-14T03:51:43.3007181Z 2025-03-14T03:51:43.3007381Z runner_label_prefix = get_runner_prefix( 2025-03-14T03:51:43.3007902Z rollout_state, 2025-03-14T03:51:43.3008359Z (args.github_issue_owner, username), 2025-03-14T03:51:43.3008874Z args.github_branch, 2025-03-14T03:51:43.3009353Z args.eligible_experiments, 2025-03-14T03:51:43.3009827Z is_canary, 2025-03-14T03:51:43.3010214Z ) 2025-03-14T03:51:43.3010414Z 2025-03-14T03:51:43.3010586Z except Exception as e: 2025-03-14T03:51:43.3011013Z log.error( 2025-03-14T03:51:43.3011665Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-03-14T03:51:43.3012373Z ) 2025-03-14T03:51:43.3012569Z 2025-03-14T03:51:43.3012880Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-14T03:51:43.3013350Z 2025-03-14T03:51:43.3013356Z 2025-03-14T03:51:43.3013527Z if __name__ == "__main__": 2025-03-14T03:51:43.3013940Z main() 2025-03-14T03:51:43.3014136Z 2025-03-14T03:51:43.3104038Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-03-14T03:51:43.3104884Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-03-14T03:51:43.3151052Z shell: /usr/bin/bash -e {0} 2025-03-14T03:51:43.3151512Z env: 2025-03-14T03:51:43.3152104Z GITHUB_TOKEN: *** 2025-03-14T03:51:43.3152498Z ISSUE_NUMBER: 5132 2025-03-14T03:51:43.3152941Z TRIGGERING_ACTOR: pytorchmergebot 2025-03-14T03:51:43.3153433Z ISSUE_OWNER: 2025-03-14T03:51:43.3153818Z CHECK_EXPERIMENTS: 2025-03-14T03:51:43.3154212Z PR_NUMBER: 2025-03-14T03:51:43.3154563Z ##[endgroup] 2025-03-14T03:51:45.2683232Z Defaulting to user installation because normal site-packages is not writeable 2025-03-14T03:51:47.2824569Z Collecting urllib3==1.26.18 2025-03-14T03:51:47.3284715Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-03-14T03:51:47.3501598Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.8 MB/s eta 0:00:00 2025-03-14T03:51:47.3764379Z Collecting PyGithub==2.3.0 2025-03-14T03:51:47.3836035Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-03-14T03:51:47.4306565Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-03-14T03:51:47.4376803Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB) 2025-03-14T03:51:47.4422925Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-03-14T03:51:47.4440034Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-03-14T03:51:47.4455137Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-03-14T03:51:47.4749607Z Collecting Deprecated (from PyGithub==2.3.0) 2025-03-14T03:51:47.4820128Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-03-14T03:51:47.5058264Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-03-14T03:51:47.6202014Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-03-14T03:51:47.6276329Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-03-14T03:51:47.7376552Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-03-14T03:51:47.7453120Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.4 kB) 2025-03-14T03:51:47.7679138Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-03-14T03:51:47.7749432Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-03-14T03:51:47.8024046Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-03-14T03:51:47.8121996Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 16.8 MB/s eta 0:00:00 2025-03-14T03:51:47.8318121Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-03-14T03:51:47.8416742Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 42.1 MB/s eta 0:00:00 2025-03-14T03:51:47.8486272Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-03-14T03:51:47.8601353Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 86.9 MB/s eta 0:00:00 2025-03-14T03:51:47.8672387Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-03-14T03:51:47.8764661Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-03-14T03:51:47.8833182Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 89.9 MB/s eta 0:00:00 2025-03-14T03:51:47.8907304Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (89 kB) 2025-03-14T03:51:47.8963835Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 24.1 MB/s eta 0:00:00 2025-03-14T03:51:47.9041695Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-03-14T03:51:47.9100681Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 29.8 MB/s eta 0:00:00 2025-03-14T03:51:48.2167456Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-03-14T03:51:48.7525301Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.2 2025-03-14T03:51:48.8279368Z ##[group]Run curr_branch="main" 2025-03-14T03:51:48.8279699Z curr_branch="main" 2025-03-14T03:51:48.8279928Z curr_ref_type="branch" 2025-03-14T03:51:48.8280202Z echo "Current branch is '$curr_branch'" 2025-03-14T03:51:48.8280477Z  2025-03-14T03:51:48.8280673Z python3 runner_determinator.py \ 2025-03-14T03:51:48.8280962Z  --github-token "$GITHUB_TOKEN" \ 2025-03-14T03:51:48.8281236Z  --github-issue "$ISSUE_NUMBER" \ 2025-03-14T03:51:48.8281507Z  --github-branch "$curr_branch" \ 2025-03-14T03:51:48.8281778Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-03-14T03:51:48.8282066Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-03-14T03:51:48.8282360Z  --github-ref-type "$curr_ref_type" \ 2025-03-14T03:51:48.8282635Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-03-14T03:51:48.8282944Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-03-14T03:51:48.8283296Z  --pr-number "${PR_NUMBER}" 2025-03-14T03:51:48.8330001Z shell: /usr/bin/bash -e {0} 2025-03-14T03:51:48.8330235Z env: 2025-03-14T03:51:48.8330798Z GITHUB_TOKEN: *** 2025-03-14T03:51:48.8331008Z ISSUE_NUMBER: 5132 2025-03-14T03:51:48.8331232Z TRIGGERING_ACTOR: pytorchmergebot 2025-03-14T03:51:48.8331470Z ISSUE_OWNER: 2025-03-14T03:51:48.8331658Z CHECK_EXPERIMENTS: 2025-03-14T03:51:48.8331843Z PR_NUMBER: 2025-03-14T03:51:48.8332016Z ##[endgroup] 2025-03-14T03:51:48.8396127Z Current branch is 'main' 2025-03-14T03:51:50.4285491Z INFO : Based on rollout percentage of 50%, enabling experiment lf. 2025-03-14T03:51:50.4287273Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-03-14T03:51:50.4288440Z INFO : Setting output: label-type='lf.' 2025-03-14T03:51:50.4619772Z Evaluate and set job outputs 2025-03-14T03:51:50.4626654Z Set output 'label-type' 2025-03-14T03:51:50.4629098Z Cleaning up orphan processes