2025-01-24T00:45:43.5145911Z Current runner version: '2.321.0' 2025-01-24T00:45:43.5174875Z ##[group]Operating System 2025-01-24T00:45:43.5175868Z Ubuntu 2025-01-24T00:45:43.5176369Z 24.04.1 2025-01-24T00:45:43.5177006Z LTS 2025-01-24T00:45:43.5177500Z ##[endgroup] 2025-01-24T00:45:43.5178053Z ##[group]Runner Image 2025-01-24T00:45:43.5178749Z Image: ubuntu-24.04 2025-01-24T00:45:43.5179252Z Version: 20250120.5.0 2025-01-24T00:45:43.5180277Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250120.5/images/ubuntu/Ubuntu2404-Readme.md 2025-01-24T00:45:43.5181725Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250120.5 2025-01-24T00:45:43.5182584Z ##[endgroup] 2025-01-24T00:45:43.5183271Z ##[group]Runner Image Provisioner 2025-01-24T00:45:43.5184002Z 2.0.417.1 2025-01-24T00:45:43.5184500Z ##[endgroup] 2025-01-24T00:45:43.5186658Z ##[group]GITHUB_TOKEN Permissions 2025-01-24T00:45:43.5188839Z Actions: read 2025-01-24T00:45:43.5189668Z Attestations: read 2025-01-24T00:45:43.5190272Z Checks: read 2025-01-24T00:45:43.5190756Z Contents: read 2025-01-24T00:45:43.5191358Z Deployments: read 2025-01-24T00:45:43.5191842Z Discussions: read 2025-01-24T00:45:43.5192363Z Issues: read 2025-01-24T00:45:43.5192965Z Metadata: read 2025-01-24T00:45:43.5193694Z Packages: read 2025-01-24T00:45:43.5194217Z Pages: read 2025-01-24T00:45:43.5194824Z PullRequests: read 2025-01-24T00:45:43.5195330Z RepositoryProjects: read 2025-01-24T00:45:43.5195902Z SecurityEvents: read 2025-01-24T00:45:43.5196519Z Statuses: read 2025-01-24T00:45:43.5196999Z ##[endgroup] 2025-01-24T00:45:43.5199936Z Secret source: Actions 2025-01-24T00:45:43.5200801Z Prepare workflow directory 2025-01-24T00:45:43.5689511Z Prepare all required actions 2025-01-24T00:45:43.5744325Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (b2c89bc115123aea8e075e882ee121537ec92f89) 2025-01-24T00:45:43.5749546Z ##[group] Inputs 2025-01-24T00:45:43.5750163Z check_experiments: 2025-01-24T00:45:43.5750935Z triggering_actor: pytorch-bot[bot] 2025-01-24T00:45:43.5751579Z issue_owner: 2025-01-24T00:45:43.5752134Z curr_branch: ciflow/inductor/145539 2025-01-24T00:45:43.5752866Z curr_ref_type: tag 2025-01-24T00:45:43.5753594Z issue_number: 5132 2025-01-24T00:45:43.5754152Z ##[endgroup] 2025-01-24T00:45:43.5754855Z Complete job name: get-label-type / runner-determinator 2025-01-24T00:45:43.6528244Z ##[group]Run cat < runner_determinator.py 2025-01-24T00:45:43.6530628Z cat < runner_determinator.py 2025-01-24T00:45:43.6531568Z # flake8: noqa: G004 2025-01-24T00:45:43.6532301Z  2025-01-24T00:45:43.6533543Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-01-24T00:45:43.6535137Z # must be kept in sync. You can do it easily by running the following command: 2025-01-24T00:45:43.6536589Z # python .github/scripts/update_runner_determinator.py 2025-01-24T00:45:43.6537518Z  2025-01-24T00:45:43.6538104Z """ 2025-01-24T00:45:43.6539091Z This runner determinator is used to determine which set of runners to run a 2025-01-24T00:45:43.6540559Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-01-24T00:45:43.6541680Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-01-24T00:45:43.6542547Z of which runners should be used to run which job. 2025-01-24T00:45:43.6543384Z  2025-01-24T00:45:43.6544020Z The configuration has two parts, the settings and a list of opted-in users, 2025-01-24T00:45:43.6544951Z separated by a line containing "---". If the line is not present, the 2025-01-24T00:45:43.6545855Z settings are considered to be empty with only the second part, the user 2025-01-24T00:45:43.6546575Z list, defined. 2025-01-24T00:45:43.6547006Z  2025-01-24T00:45:43.6547600Z The first part is a YAML block that defines the rollout settings. This can be 2025-01-24T00:45:43.6548983Z used to define any settings that are needed to determine which runners to use. 2025-01-24T00:45:43.6549867Z It's fields are defined by the RolloutSettings class below. 2025-01-24T00:45:43.6550499Z  2025-01-24T00:45:43.6551106Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-01-24T00:45:43.6552037Z The user list is also a comma separated list of additional features or 2025-01-24T00:45:43.6552828Z experiments which the user could be opted in to. 2025-01-24T00:45:43.6553612Z  2025-01-24T00:45:43.6554047Z The user list has the following rules: 2025-01-24T00:45:43.6554590Z  2025-01-24T00:45:43.6555154Z - Users are GitHub usernames, which must start with the @ prefix 2025-01-24T00:45:43.6556055Z - Each user is also a comma-separated list of features/experiments to enable 2025-01-24T00:45:43.6556859Z - A "#" prefix opts the user out of all experiments 2025-01-24T00:45:43.6557438Z  2025-01-24T00:45:43.6557842Z Example config: 2025-01-24T00:45:43.6558375Z  # A list of experiments that can be opted into. 2025-01-24T00:45:43.6559107Z  # This defines the behavior they'll induce when opted into. 2025-01-24T00:45:43.6559792Z  # Expected syntax is: 2025-01-24T00:45:43.6560837Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-01-24T00:45:43.6562364Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-01-24T00:45:43.6563433Z  2025-01-24T00:45:43.6563841Z  experiments: 2025-01-24T00:45:43.6564290Z  lf: 2025-01-24T00:45:43.6564731Z  rollout_percent: 25 2025-01-24T00:45:43.6565252Z  all_branches: false 2025-01-24T00:45:43.6565761Z  default: true 2025-01-24T00:45:43.6566258Z  --- 2025-01-24T00:45:43.6566660Z  2025-01-24T00:45:43.6567040Z  # Opt-ins: 2025-01-24T00:45:43.6567695Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-01-24T00:45:43.6568831Z  # and specifying experiments to enable in a comma-separated list. 2025-01-24T00:45:43.6569656Z  # To always opt out of an experiment, prefix it with a "-". 2025-01-24T00:45:43.6570368Z  # Experiments should be from the above list. 2025-01-24T00:45:43.6570943Z  2025-01-24T00:45:43.6571412Z  @User1,-lf,split_build 2025-01-24T00:45:43.6571910Z  @User2,lf 2025-01-24T00:45:43.6572368Z  @User3,split_build 2025-01-24T00:45:43.6572849Z """ 2025-01-24T00:45:43.6573509Z  2025-01-24T00:45:43.6574073Z import json 2025-01-24T00:45:43.6574777Z import logging 2025-01-24T00:45:43.6575540Z import os 2025-01-24T00:45:43.6576147Z import random 2025-01-24T00:45:43.6576630Z import re 2025-01-24T00:45:43.6577044Z import sys 2025-01-24T00:45:43.6577526Z from argparse import ArgumentParser 2025-01-24T00:45:43.6578100Z from functools import lru_cache 2025-01-24T00:45:43.6578662Z from logging import LogRecord 2025-01-24T00:45:43.6579419Z from typing import Any, Dict, FrozenSet, Iterable, List, NamedTuple, Set, Tuple 2025-01-24T00:45:43.6580243Z from urllib.request import Request, urlopen 2025-01-24T00:45:43.6580805Z  2025-01-24T00:45:43.6581179Z import yaml 2025-01-24T00:45:43.6581639Z from github import Auth, Github 2025-01-24T00:45:43.6582185Z from github.Issue import Issue 2025-01-24T00:45:43.6582698Z  2025-01-24T00:45:43.6583265Z  2025-01-24T00:45:43.6583759Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-01-24T00:45:43.6584697Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-01-24T00:45:43.6585602Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-01-24T00:45:43.6586327Z  2025-01-24T00:45:43.6586785Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-01-24T00:45:43.6587403Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-01-24T00:45:43.6587987Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-01-24T00:45:43.6588595Z OPT_OUT_LABEL = "no-runner-experiments" 2025-01-24T00:45:43.6589145Z  2025-01-24T00:45:43.6589572Z SETTING_EXPERIMENTS = "experiments" 2025-01-24T00:45:43.6590096Z  2025-01-24T00:45:43.6590494Z LF_FLEET_EXPERIMENT = "lf" 2025-01-24T00:45:43.6591010Z CANARY_FLEET_SUFFIX = ".c" 2025-01-24T00:45:43.6591491Z  2025-01-24T00:45:43.6591857Z  2025-01-24T00:45:43.6592260Z class Experiment(NamedTuple): 2025-01-24T00:45:43.6592795Z  rollout_perc: float = ( 2025-01-24T00:45:43.6593716Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-01-24T00:45:43.6594416Z  ) 2025-01-24T00:45:43.6594828Z  all_branches: bool = ( 2025-01-24T00:45:43.6595527Z  False # If True, the experiment is also enabled on the exception branches 2025-01-24T00:45:43.6596217Z  ) 2025-01-24T00:45:43.6596616Z  default: bool = ( 2025-01-24T00:45:43.6597264Z  True # If True, the experiment is enabled by default for all queries 2025-01-24T00:45:43.6597936Z  ) 2025-01-24T00:45:43.6598415Z  2025-01-24T00:45:43.6598988Z  # Add more fields as needed 2025-01-24T00:45:43.6599713Z  2025-01-24T00:45:43.6600234Z  2025-01-24T00:45:43.6600818Z class Settings(NamedTuple): 2025-01-24T00:45:43.6601620Z  """ 2025-01-24T00:45:43.6602413Z  Settings for the experiments that can be opted into. 2025-01-24T00:45:43.6603612Z  """ 2025-01-24T00:45:43.6604076Z  2025-01-24T00:45:43.6604516Z  experiments: Dict[str, Experiment] = {} 2025-01-24T00:45:43.6605060Z  2025-01-24T00:45:43.6605428Z  2025-01-24T00:45:43.6606106Z class ColorFormatter(logging.Formatter): 2025-01-24T00:45:43.6606806Z  """Color codes the log messages based on the log level""" 2025-01-24T00:45:43.6607434Z  2025-01-24T00:45:43.6607809Z  COLORS = { 2025-01-24T00:45:43.6608279Z  "WARNING": "\033[33m", # Yellow 2025-01-24T00:45:43.6608840Z  "ERROR": "\033[31m", # Red 2025-01-24T00:45:43.6609383Z  "CRITICAL": "\033[31m", # Red 2025-01-24T00:45:43.6609933Z  "INFO": "\033[0m", # Reset 2025-01-24T00:45:43.6610471Z  "DEBUG": "\033[0m", # Reset 2025-01-24T00:45:43.6611024Z  } 2025-01-24T00:45:43.6611414Z  2025-01-24T00:45:43.6611862Z  def format(self, record: LogRecord) -> str: 2025-01-24T00:45:43.6612651Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-01-24T00:45:43.6613664Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-01-24T00:45:43.6614317Z  return super().format(record) 2025-01-24T00:45:43.6614840Z  2025-01-24T00:45:43.6615205Z  2025-01-24T00:45:43.6615618Z handler = logging.StreamHandler() 2025-01-24T00:45:43.6616391Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-01-24T00:45:43.6617138Z  2025-01-24T00:45:43.6617651Z log = logging.getLogger(os.path.basename(__file__)) 2025-01-24T00:45:43.6618269Z log.addHandler(handler) 2025-01-24T00:45:43.6618794Z log.setLevel(logging.INFO) 2025-01-24T00:45:43.6619281Z  2025-01-24T00:45:43.6619783Z  2025-01-24T00:45:43.6620261Z def set_github_output(key: str, value: str) -> None: 2025-01-24T00:45:43.6620872Z  """ 2025-01-24T00:45:43.6621437Z  Defines outputs of the github action that invokes this script 2025-01-24T00:45:43.6622088Z  """ 2025-01-24T00:45:43.6622510Z  if not GITHUB_OUTPUT: 2025-01-24T00:45:43.6623897Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-01-24T00:45:43.6625006Z  log.warning( 2025-01-24T00:45:43.6625904Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-01-24T00:45:43.6626860Z  ) 2025-01-24T00:45:43.6627408Z  print(f"::set-output name={key}::{value}") 2025-01-24T00:45:43.6628318Z  return 2025-01-24T00:45:43.6629025Z  2025-01-24T00:45:43.6629655Z  with open(GITHUB_OUTPUT, "a") as f: 2025-01-24T00:45:43.6630667Z  log.info(f"Setting output: {key}='{value}'") 2025-01-24T00:45:43.6631351Z  f.write(f"{key}={value}\n") 2025-01-24T00:45:43.6631857Z  2025-01-24T00:45:43.6632240Z  2025-01-24T00:45:43.6632785Z def _str_comma_separated_to_set(value: str) -> FrozenSet[str]: 2025-01-24T00:45:43.6633652Z  return frozenset( 2025-01-24T00:45:43.6634330Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-01-24T00:45:43.6635029Z  ) 2025-01-24T00:45:43.6635411Z  2025-01-24T00:45:43.6635782Z  2025-01-24T00:45:43.6636179Z def parse_args() -> Any: 2025-01-24T00:45:43.6636798Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-01-24T00:45:43.6637714Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-01-24T00:45:43.6638511Z  parser.add_argument( 2025-01-24T00:45:43.6639033Z  "--github-issue-repo", 2025-01-24T00:45:43.6639541Z  type=str, 2025-01-24T00:45:43.6640003Z  required=False, 2025-01-24T00:45:43.6640691Z  default="pytorch/test-infra", 2025-01-24T00:45:43.6641285Z  help="GitHub repo to get the issue", 2025-01-24T00:45:43.6641823Z  ) 2025-01-24T00:45:43.6642225Z  parser.add_argument( 2025-01-24T00:45:43.6642713Z  "--github-repo", 2025-01-24T00:45:43.6643306Z  type=str, 2025-01-24T00:45:43.6643764Z  required=True, 2025-01-24T00:45:43.6644292Z  help="GitHub repo where CI is running", 2025-01-24T00:45:43.6644839Z  ) 2025-01-24T00:45:43.6645239Z  parser.add_argument( 2025-01-24T00:45:43.6645909Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-01-24T00:45:43.6646585Z  ) 2025-01-24T00:45:43.6646987Z  parser.add_argument( 2025-01-24T00:45:43.6647671Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-01-24T00:45:43.6648377Z  ) 2025-01-24T00:45:43.6648798Z  parser.add_argument( 2025-01-24T00:45:43.6649497Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-01-24T00:45:43.6650202Z  ) 2025-01-24T00:45:43.6650615Z  parser.add_argument( 2025-01-24T00:45:43.6651335Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-01-24T00:45:43.6652061Z  ) 2025-01-24T00:45:43.6652460Z  parser.add_argument( 2025-01-24T00:45:43.6652966Z  "--github-ref-type", 2025-01-24T00:45:43.6653566Z  type=str, 2025-01-24T00:45:43.6654170Z  required=True, 2025-01-24T00:45:43.6654728Z  help="Current GitHub ref type, branch or tag", 2025-01-24T00:45:43.6655305Z  ) 2025-01-24T00:45:43.6655705Z  parser.add_argument( 2025-01-24T00:45:43.6656227Z  "--eligible-experiments", 2025-01-24T00:45:43.6656797Z  type=_str_comma_separated_to_set, 2025-01-24T00:45:43.6657342Z  required=False, 2025-01-24T00:45:43.6657824Z  default="", 2025-01-24T00:45:43.6658731Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-01-24T00:45:43.6659656Z  ) 2025-01-24T00:45:43.6660068Z  parser.add_argument( 2025-01-24T00:45:43.6660557Z  "--pr-number", 2025-01-24T00:45:43.6661033Z  type=str, 2025-01-24T00:45:43.6661490Z  required=False, 2025-01-24T00:45:43.6661971Z  default="", 2025-01-24T00:45:43.6662520Z  help="the optional PR number where this is run", 2025-01-24T00:45:43.6663225Z  ) 2025-01-24T00:45:43.6663620Z  2025-01-24T00:45:43.6664040Z  return parser.parse_args() 2025-01-24T00:45:43.6664555Z  2025-01-24T00:45:43.6664922Z  2025-01-24T00:45:43.6665371Z def get_gh_client(github_token: str) -> Github: 2025-01-24T00:45:43.6665991Z  auth = Auth.Token(github_token) 2025-01-24T00:45:43.6666531Z  return Github(auth=auth) 2025-01-24T00:45:43.6667013Z  2025-01-24T00:45:43.6667379Z  2025-01-24T00:45:43.6667908Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: 2025-01-24T00:45:43.6668579Z  repo = gh.get_repo(repo) 2025-01-24T00:45:43.6669135Z  return repo.get_issue(number=issue_num) 2025-01-24T00:45:43.6669854Z  2025-01-24T00:45:43.6670412Z  2025-01-24T00:45:43.6671008Z def get_potential_pr_author( 2025-01-24T00:45:43.6672051Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-01-24T00:45:43.6673403Z ) -> str: 2025-01-24T00:45:43.6674348Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-01-24T00:45:43.6675969Z  # Fetch the actual username from the original PR. The PR number is 2025-01-24T00:45:43.6677307Z  # embedded in the tag name: ciflow// 2025-01-24T00:45:43.6678306Z  2025-01-24T00:45:43.6678966Z  gh = get_gh_client(github_token) 2025-01-24T00:45:43.6679786Z  2025-01-24T00:45:43.6680641Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-01-24T00:45:43.6681740Z  split_tag = ref_name.split("/") 2025-01-24T00:45:43.6682619Z  if ( 2025-01-24T00:45:43.6683606Z  len(split_tag) == 3 2025-01-24T00:45:43.6684446Z  and split_tag[0] == "ciflow" 2025-01-24T00:45:43.6685340Z  and split_tag[2].isnumeric() 2025-01-24T00:45:43.6686190Z  ): 2025-01-24T00:45:43.6686902Z  pr_number = split_tag[2] 2025-01-24T00:45:43.6687747Z  try: 2025-01-24T00:45:43.6688550Z  repository = gh.get_repo(repo) 2025-01-24T00:45:43.6689627Z  pull = repository.get_pull(number=int(pr_number)) 2025-01-24T00:45:43.6690674Z  except Exception as e: 2025-01-24T00:45:43.6691578Z  raise Exception( # noqa: TRY002 2025-01-24T00:45:43.6692746Z  f"issue with pull request {pr_number} from repo {repository}" 2025-01-24T00:45:43.6694069Z  ) from e 2025-01-24T00:45:43.6694869Z  return pull.user.login 2025-01-24T00:45:43.6695837Z  # In all other cases, return the original input username 2025-01-24T00:45:43.6697062Z  return username 2025-01-24T00:45:43.6697801Z  2025-01-24T00:45:43.6698373Z  2025-01-24T00:45:43.6698900Z def is_exception_branch(branch: str) -> bool: 2025-01-24T00:45:43.6699456Z  """ 2025-01-24T00:45:43.6700177Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-01-24T00:45:43.6700963Z  """ 2025-01-24T00:45:43.6701552Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-01-24T00:45:43.6702237Z  2025-01-24T00:45:43.6702605Z  2025-01-24T00:45:43.6703006Z def load_yaml(yaml_text: str) -> Any: 2025-01-24T00:45:43.6703742Z  try: 2025-01-24T00:45:43.6704180Z  data = yaml.safe_load(yaml_text) 2025-01-24T00:45:43.6704714Z  return data 2025-01-24T00:45:43.6705188Z  except yaml.YAMLError: 2025-01-24T00:45:43.6705748Z  log.exception("Error loading YAML") 2025-01-24T00:45:43.6706286Z  raise 2025-01-24T00:45:43.6706696Z  2025-01-24T00:45:43.6707051Z  2025-01-24T00:45:43.6707674Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> Tuple[str, str]: 2025-01-24T00:45:43.6708452Z  """ 2025-01-24T00:45:43.6709119Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-01-24T00:45:43.6710276Z  2025-01-24T00:45:43.6711272Z  If the issue body contains "---" then the text above that is the settings 2025-01-24T00:45:43.6712524Z  and the text below is the list of opted in users. 2025-01-24T00:45:43.6713227Z  2025-01-24T00:45:43.6713821Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-01-24T00:45:43.6714534Z  """ 2025-01-24T00:45:43.6715036Z  rollout_state_parts = rollout_state.split("---") 2025-01-24T00:45:43.6715651Z  if len(rollout_state_parts) >= 2: 2025-01-24T00:45:43.6716290Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-01-24T00:45:43.6716900Z  else: 2025-01-24T00:45:43.6717500Z  return "", rollout_state 2025-01-24T00:45:43.6718004Z  2025-01-24T00:45:43.6718378Z  2025-01-24T00:45:43.6718800Z class UserOptins(Dict[str, List[str]]): 2025-01-24T00:45:43.6719337Z  """ 2025-01-24T00:45:43.6719911Z  Dictionary of users with a list of features they have opted into 2025-01-24T00:45:43.6720582Z  """ 2025-01-24T00:45:43.6720964Z  2025-01-24T00:45:43.6721333Z  2025-01-24T00:45:43.6721895Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-01-24T00:45:43.6722635Z  """ 2025-01-24T00:45:43.6723940Z  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:45:43.6725304Z  2025-01-24T00:45:43.6726647Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-01-24T00:45:43.6728295Z  - Example line: "@User1,lf,split_build" 2025-01-24T00:45:43.6729410Z  - A "#" prefix indicates the user is opted out of all experiments 2025-01-24T00:45:43.6730450Z  2025-01-24T00:45:43.6731018Z  2025-01-24T00:45:43.6731584Z  """ 2025-01-24T00:45:43.6732208Z  optins = UserOptins() 2025-01-24T00:45:43.6733247Z  for user in user_optin_text.split("\n"): 2025-01-24T00:45:43.6733934Z  user = user.strip("\r\n\t -") 2025-01-24T00:45:43.6734523Z  if not user or not user.startswith("@"): 2025-01-24T00:45:43.6735110Z  # Not a valid user. Skip 2025-01-24T00:45:43.6735856Z  continue 2025-01-24T00:45:43.6736372Z  2025-01-24T00:45:43.6736737Z  if user: 2025-01-24T00:45:43.6737236Z  usr_name = user.split(",")[0].strip("@") 2025-01-24T00:45:43.6737976Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-01-24T00:45:43.6738646Z  2025-01-24T00:45:43.6739023Z  return optins 2025-01-24T00:45:43.6739460Z  2025-01-24T00:45:43.6739804Z  2025-01-24T00:45:43.6740330Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-01-24T00:45:43.6740972Z  """ 2025-01-24T00:45:43.6741418Z  Check if the experiment name is valid. 2025-01-24T00:45:43.6741972Z  A valid name: 2025-01-24T00:45:43.6742664Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-01-24T00:45:43.6743858Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-01-24T00:45:43.6744601Z  - Cannot contain spaces 2025-01-24T00:45:43.6745099Z  """ 2025-01-24T00:45:43.6745477Z  2025-01-24T00:45:43.6745963Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-01-24T00:45:43.6746716Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-01-24T00:45:43.6747326Z  2025-01-24T00:45:43.6747690Z  if valid: 2025-01-24T00:45:43.6748115Z  return True 2025-01-24T00:45:43.6748794Z  2025-01-24T00:45:43.6749170Z  log.error( 2025-01-24T00:45:43.6750613Z  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:45:43.6752112Z  ) 2025-01-24T00:45:43.6752518Z  return False 2025-01-24T00:45:43.6752946Z  2025-01-24T00:45:43.6753488Z  2025-01-24T00:45:43.6754033Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-01-24T00:45:43.6754692Z  """ 2025-01-24T00:45:43.6755457Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-01-24T00:45:43.6756195Z  """ 2025-01-24T00:45:43.6756595Z  try: 2025-01-24T00:45:43.6757022Z  if settings_text: 2025-01-24T00:45:43.6757779Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-01-24T00:45:43.6758577Z  # for easy reading 2025-01-24T00:45:43.6759417Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-01-24T00:45:43.6760322Z  # the backtick character in shell commands. 2025-01-24T00:45:43.6760971Z  backtick = chr(96) # backtick character 2025-01-24T00:45:43.6761680Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-01-24T00:45:43.6762357Z  settings = load_yaml(settings_text) 2025-01-24T00:45:43.6762894Z  2025-01-24T00:45:43.6763785Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-01-24T00:45:43.6764534Z  experiments = {} 2025-01-24T00:45:43.6765021Z  2025-01-24T00:45:43.6765603Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-01-24T00:45:43.6766377Z  if not is_valid_experiment_name(exp_name): 2025-01-24T00:45:43.6767489Z  # 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:45:43.6768775Z  continue 2025-01-24T00:45:43.6769537Z  2025-01-24T00:45:43.6769994Z  valid_settings = {} 2025-01-24T00:45:43.6770889Z  for setting in exp_settings: 2025-01-24T00:45:43.6771885Z  if setting not in Experiment._fields: 2025-01-24T00:45:43.6772501Z  log.warning( 2025-01-24T00:45:43.6773438Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-01-24T00:45:43.6774164Z  ) 2025-01-24T00:45:43.6774630Z  else: 2025-01-24T00:45:43.6775204Z  valid_settings[setting] = exp_settings[setting] 2025-01-24T00:45:43.6775798Z  2025-01-24T00:45:43.6776289Z  experiments[exp_name] = Experiment(**valid_settings) 2025-01-24T00:45:43.6776947Z  return Settings(experiments) 2025-01-24T00:45:43.6777473Z  2025-01-24T00:45:43.6777849Z  except Exception: 2025-01-24T00:45:43.6778388Z  log.exception("Failed to parse settings") 2025-01-24T00:45:43.6778943Z  2025-01-24T00:45:43.6779310Z  return Settings() 2025-01-24T00:45:43.6779772Z  2025-01-24T00:45:43.6780150Z  2025-01-24T00:45:43.6780629Z def parse_settings(rollout_state: str) -> Settings: 2025-01-24T00:45:43.6781231Z  """ 2025-01-24T00:45:43.6781722Z  Parse settings, if any, from the rollout state. 2025-01-24T00:45:43.6782293Z  2025-01-24T00:45:43.6782850Z  If the issue body contains "---" then the text above that is the settings 2025-01-24T00:45:43.6783963Z  and the text below is the list of opted in users. 2025-01-24T00:45:43.6784538Z  2025-01-24T00:45:43.6785148Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-01-24T00:45:43.6785898Z  """ 2025-01-24T00:45:43.6786493Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-01-24T00:45:43.6787340Z  return parse_settings_from_text(settings_text) 2025-01-24T00:45:43.6787909Z  2025-01-24T00:45:43.6788440Z  2025-01-24T00:45:43.6788920Z def parse_users(rollout_state: str) -> UserOptins: 2025-01-24T00:45:43.6789499Z  """ 2025-01-24T00:45:43.6789933Z  Parse users from the rollout state. 2025-01-24T00:45:43.6790446Z  2025-01-24T00:45:43.6790805Z  """ 2025-01-24T00:45:43.6791377Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-01-24T00:45:43.6792142Z  return parse_user_opt_in_from_text(users_text) 2025-01-24T00:45:43.6792705Z  2025-01-24T00:45:43.6793237Z  2025-01-24T00:45:43.6793899Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-01-24T00:45:43.6794660Z  """ 2025-01-24T00:45:43.6795120Z  Check if a user is opted into an experiment 2025-01-24T00:45:43.6795664Z  """ 2025-01-24T00:45:43.6796170Z  return experiment_name in user_optins.get(user, []) 2025-01-24T00:45:43.6796777Z  2025-01-24T00:45:43.6797133Z  2025-01-24T00:45:43.6797778Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-01-24T00:45:43.6798543Z  """ 2025-01-24T00:45:43.6799045Z  Check if a user explicitly opted out of an experiment 2025-01-24T00:45:43.6799644Z  """ 2025-01-24T00:45:43.6800192Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-01-24T00:45:43.6800899Z  experiment_optout = "-" + experiment_name 2025-01-24T00:45:43.6801577Z  if experiment_optout not in user_optins.get(user, []): 2025-01-24T00:45:43.6802367Z  return False 2025-01-24T00:45:43.6802847Z  2025-01-24T00:45:43.6803557Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-01-24T00:45:43.6804184Z  log.warning( 2025-01-24T00:45:43.6805025Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-01-24T00:45:43.6805893Z  ) 2025-01-24T00:45:43.6806287Z  2025-01-24T00:45:43.6806652Z  return True 2025-01-24T00:45:43.6807079Z  2025-01-24T00:45:43.6807439Z  2025-01-24T00:45:43.6807816Z def get_runner_prefix( 2025-01-24T00:45:43.6808301Z  rollout_state: str, 2025-01-24T00:45:43.6808827Z  workflow_requestors: Iterable[str], 2025-01-24T00:45:43.6809354Z  branch: str, 2025-01-24T00:45:43.6809909Z  eligible_experiments: FrozenSet[str] = frozenset(), 2025-01-24T00:45:43.6810540Z  is_canary: bool = False, 2025-01-24T00:45:43.6811055Z ) -> str: 2025-01-24T00:45:43.6811523Z  settings = parse_settings(rollout_state) 2025-01-24T00:45:43.6812134Z  user_optins = parse_users(rollout_state) 2025-01-24T00:45:43.6812669Z  2025-01-24T00:45:43.6813049Z  fleet_prefix = "" 2025-01-24T00:45:43.6813772Z  prefixes = [] 2025-01-24T00:45:43.6814451Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-01-24T00:45:43.6815404Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-01-24T00:45:43.6816147Z  log.info( 2025-01-24T00:45:43.6816875Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-01-24T00:45:43.6817621Z  ) 2025-01-24T00:45:43.6818064Z  continue 2025-01-24T00:45:43.6818512Z  2025-01-24T00:45:43.6818907Z  if eligible_experiments: 2025-01-24T00:45:43.6819503Z  if experiment_name not in eligible_experiments: 2025-01-24T00:45:43.6820162Z  exp_list = ", ".join(eligible_experiments) 2025-01-24T00:45:43.6820864Z  log.info( 2025-01-24T00:45:43.6821685Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-01-24T00:45:43.6822514Z  ) 2025-01-24T00:45:43.6822945Z  continue 2025-01-24T00:45:43.6823745Z  elif not experiment_settings.default: 2025-01-24T00:45:43.6824304Z  log.info( 2025-01-24T00:45:43.6825015Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-01-24T00:45:43.6825741Z  ) 2025-01-24T00:45:43.6826169Z  continue 2025-01-24T00:45:43.6826611Z  2025-01-24T00:45:43.6827094Z  # Is any workflow_requestor opted out to this experiment? 2025-01-24T00:45:43.6827726Z  opted_out_users = [ 2025-01-24T00:45:43.6828216Z  requestor 2025-01-24T00:45:43.6828729Z  for requestor in workflow_requestors 2025-01-24T00:45:43.6829422Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-01-24T00:45:43.6830057Z  ] 2025-01-24T00:45:43.6830440Z  2025-01-24T00:45:43.6830821Z  if opted_out_users: 2025-01-24T00:45:43.6831318Z  log.info( 2025-01-24T00:45:43.6831979Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-01-24T00:45:43.6832678Z  ) 2025-01-24T00:45:43.6833230Z  continue 2025-01-24T00:45:43.6833828Z  2025-01-24T00:45:43.6834315Z  # Is any workflow_requestor opted in to this experiment? 2025-01-24T00:45:43.6834943Z  opted_in_users = [ 2025-01-24T00:45:43.6835424Z  requestor 2025-01-24T00:45:43.6835945Z  for requestor in workflow_requestors 2025-01-24T00:45:43.6836638Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-01-24T00:45:43.6837280Z  ] 2025-01-24T00:45:43.6837673Z  2025-01-24T00:45:43.6838047Z  enabled = False 2025-01-24T00:45:43.6838519Z  if opted_in_users: 2025-01-24T00:45:43.6839001Z  log.info( 2025-01-24T00:45:43.6839660Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-01-24T00:45:43.6840335Z  ) 2025-01-24T00:45:43.6840761Z  enabled = True 2025-01-24T00:45:43.6841231Z  2025-01-24T00:45:43.6841651Z  elif experiment_settings.rollout_perc: 2025-01-24T00:45:43.6842493Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-01-24T00:45:43.6843585Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-01-24T00:45:43.6844314Z  log.info( 2025-01-24T00:45:43.6845639Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-01-24T00:45:43.6847056Z  ) 2025-01-24T00:45:43.6847732Z  enabled = True 2025-01-24T00:45:43.6848502Z  2025-01-24T00:45:43.6849057Z  if enabled: 2025-01-24T00:45:43.6849831Z  label = experiment_name 2025-01-24T00:45:43.6850595Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-01-24T00:45:43.6851454Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-01-24T00:45:43.6852327Z  # - If it's enabled, then we always list it's prefix first 2025-01-24T00:45:43.6853499Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-01-24T00:45:43.6854236Z  if is_canary: 2025-01-24T00:45:43.6854773Z  label += CANARY_FLEET_SUFFIX 2025-01-24T00:45:43.6855333Z  fleet_prefix = label 2025-01-24T00:45:43.6855838Z  else: 2025-01-24T00:45:43.6856319Z  prefixes.append(label) 2025-01-24T00:45:43.6856842Z  2025-01-24T00:45:43.6857214Z  if len(prefixes) > 1: 2025-01-24T00:45:43.6857695Z  log.error( 2025-01-24T00:45:43.6858755Z  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:45:43.6859835Z  ) 2025-01-24T00:45:43.6860259Z  prefixes = prefixes[:1] 2025-01-24T00:45:43.6860755Z  2025-01-24T00:45:43.6861133Z  # Fleet always comes first 2025-01-24T00:45:43.6861648Z  if fleet_prefix: 2025-01-24T00:45:43.6862145Z  prefixes.insert(0, fleet_prefix) 2025-01-24T00:45:43.6862659Z  2025-01-24T00:45:43.6863277Z  return ".".join(prefixes) + "." if prefixes else "" 2025-01-24T00:45:43.6863988Z  2025-01-24T00:45:43.6864338Z  2025-01-24T00:45:43.6864986Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-01-24T00:45:43.6865749Z  """ 2025-01-24T00:45:43.6866359Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-01-24T00:45:43.6867070Z  2025-01-24T00:45:43.6867807Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-01-24T00:45:43.6868506Z  """ 2025-01-24T00:45:43.6868931Z  gh = get_gh_client(github_token) 2025-01-24T00:45:43.6869504Z  issue = get_issue(gh, repo, issue_num) 2025-01-24T00:45:43.6870172Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-01-24T00:45:43.6870781Z  2025-01-24T00:45:43.6871143Z  2025-01-24T00:45:43.6871742Z def download_json(url: str, headers: Dict[str, str], num_retries: int = 3) -> Any: 2025-01-24T00:45:43.6872500Z  for _ in range(num_retries): 2025-01-24T00:45:43.6873006Z  try: 2025-01-24T00:45:43.6873593Z  req = Request(url=url, headers=headers) 2025-01-24T00:45:43.6874269Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-01-24T00:45:43.6874927Z  return json.loads(content) 2025-01-24T00:45:43.6875482Z  except Exception as e: 2025-01-24T00:45:43.6876058Z  log.warning(f"Could not download {url}: {e}") 2025-01-24T00:45:43.6876633Z  2025-01-24T00:45:43.6877216Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-01-24T00:45:43.6877931Z  return {} 2025-01-24T00:45:43.6878343Z  2025-01-24T00:45:43.6878700Z  2025-01-24T00:45:43.6879070Z @lru_cache(maxsize=None) 2025-01-24T00:45:43.6879818Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> Dict[str, Any]: 2025-01-24T00:45:43.6880568Z  """ 2025-01-24T00:45:43.6880983Z  Dynamically get PR information 2025-01-24T00:45:43.6881493Z  """ 2025-01-24T00:45:43.6882028Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-01-24T00:45:43.6882657Z  headers = { 2025-01-24T00:45:43.6883281Z  "Accept": "application/vnd.github.v3+json", 2025-01-24T00:45:43.6883914Z  "Authorization": f"token {github_token}", 2025-01-24T00:45:43.6884448Z  } 2025-01-24T00:45:43.6884921Z  json_response: Dict[str, Any] = download_json( 2025-01-24T00:45:43.6885688Z  url=f"{github_api}/issues/{pr_number}", 2025-01-24T00:45:43.6886246Z  headers=headers, 2025-01-24T00:45:43.6886707Z  ) 2025-01-24T00:45:43.6887076Z  2025-01-24T00:45:43.6887443Z  if not json_response: 2025-01-24T00:45:43.6888094Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-01-24T00:45:43.6888725Z  return {} 2025-01-24T00:45:43.6889148Z  2025-01-24T00:45:43.6889530Z  return json_response 2025-01-24T00:45:43.6889994Z  2025-01-24T00:45:43.6890364Z  2025-01-24T00:45:43.6890968Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> Set[str]: 2025-01-24T00:45:43.6891704Z  """ 2025-01-24T00:45:43.6892254Z  Dynamically get the latest list of labels from the pull request 2025-01-24T00:45:43.6892914Z  """ 2025-01-24T00:45:43.6893535Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-01-24T00:45:43.6894151Z  return { 2025-01-24T00:45:43.6894764Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-01-24T00:45:43.6895453Z  } 2025-01-24T00:45:43.6895826Z  2025-01-24T00:45:43.6896184Z  2025-01-24T00:45:43.6896554Z def main() -> None: 2025-01-24T00:45:43.6897025Z  args = parse_args() 2025-01-24T00:45:43.6897484Z  2025-01-24T00:45:43.6897924Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-01-24T00:45:43.6898465Z  2025-01-24T00:45:43.6898851Z  # Check if the PR is opt-out 2025-01-24T00:45:43.6899496Z  if args.pr_number: 2025-01-24T00:45:43.6900211Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-01-24T00:45:43.6900984Z  if OPT_OUT_LABEL in labels: 2025-01-24T00:45:43.6901523Z  log.info( 2025-01-24T00:45:43.6902258Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-01-24T00:45:43.6903020Z  ) 2025-01-24T00:45:43.6903998Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-01-24T00:45:43.6904677Z  sys.exit() 2025-01-24T00:45:43.6905136Z  2025-01-24T00:45:43.6905492Z  try: 2025-01-24T00:45:43.6905962Z  rollout_state = get_rollout_state_from_issue( 2025-01-24T00:45:43.6906692Z  args.github_token, args.github_issue_repo, args.github_issue 2025-01-24T00:45:43.6907344Z  ) 2025-01-24T00:45:43.6907725Z  2025-01-24T00:45:43.6908134Z  username = get_potential_pr_author( 2025-01-24T00:45:43.6908686Z  args.github_token, 2025-01-24T00:45:43.6909196Z  args.github_repo, 2025-01-24T00:45:43.6909703Z  args.github_actor, 2025-01-24T00:45:43.6910229Z  args.github_ref_type, 2025-01-24T00:45:43.6910756Z  args.github_branch, 2025-01-24T00:45:43.6911284Z  ) 2025-01-24T00:45:43.6911677Z  2025-01-24T00:45:43.6912175Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-01-24T00:45:43.6912792Z  2025-01-24T00:45:43.6913333Z  runner_label_prefix = get_runner_prefix( 2025-01-24T00:45:43.6913899Z  rollout_state, 2025-01-24T00:45:43.6914427Z  (args.github_issue_owner, username), 2025-01-24T00:45:43.6915003Z  args.github_branch, 2025-01-24T00:45:43.6915547Z  args.eligible_experiments, 2025-01-24T00:45:43.6916106Z  is_canary, 2025-01-24T00:45:43.6916567Z  ) 2025-01-24T00:45:43.6916950Z  2025-01-24T00:45:43.6917323Z  except Exception as e: 2025-01-24T00:45:43.6917960Z  log.error( 2025-01-24T00:45:43.6918690Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-01-24T00:45:43.6919438Z  ) 2025-01-24T00:45:43.6919829Z  2025-01-24T00:45:43.6920385Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-01-24T00:45:43.6921061Z  2025-01-24T00:45:43.6921455Z  2025-01-24T00:45:43.6921831Z if __name__ == "__main__": 2025-01-24T00:45:43.6922310Z  main() 2025-01-24T00:45:43.6922708Z  2025-01-24T00:45:43.6923168Z EOF 2025-01-24T00:45:43.6923540Z  2025-01-24T00:45:43.6923932Z cat runner_determinator.py 2025-01-24T00:45:43.7353758Z shell: /usr/bin/bash -e {0} 2025-01-24T00:45:43.7355003Z env: 2025-01-24T00:45:43.7356021Z GITHUB_TOKEN: *** 2025-01-24T00:45:43.7356711Z ISSUE_NUMBER: 5132 2025-01-24T00:45:43.7357468Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-01-24T00:45:43.7358274Z ISSUE_OWNER: 2025-01-24T00:45:43.7358991Z CHECK_EXPERIMENTS: 2025-01-24T00:45:43.7359726Z PR_NUMBER: 2025-01-24T00:45:43.7360373Z ##[endgroup] 2025-01-24T00:45:43.7651990Z # flake8: noqa: G004 2025-01-24T00:45:43.7652325Z 2025-01-24T00:45:43.7652755Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-01-24T00:45:43.7653996Z # must be kept in sync. You can do it easily by running the following command: 2025-01-24T00:45:43.7654805Z # python .github/scripts/update_runner_determinator.py 2025-01-24T00:45:43.7655257Z 2025-01-24T00:45:43.7655429Z """ 2025-01-24T00:45:43.7656271Z This runner determinator is used to determine which set of runners to run a 2025-01-24T00:45:43.7657095Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-01-24T00:45:43.7657954Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-01-24T00:45:43.7658751Z of which runners should be used to run which job. 2025-01-24T00:45:43.7659141Z 2025-01-24T00:45:43.7659510Z The configuration has two parts, the settings and a list of opted-in users, 2025-01-24T00:45:43.7660353Z separated by a line containing "---". If the line is not present, the 2025-01-24T00:45:43.7661196Z settings are considered to be empty with only the second part, the user 2025-01-24T00:45:43.7661877Z list, defined. 2025-01-24T00:45:43.7662103Z 2025-01-24T00:45:43.7662451Z The first part is a YAML block that defines the rollout settings. This can be 2025-01-24T00:45:43.7663681Z used to define any settings that are needed to determine which runners to use. 2025-01-24T00:45:43.7664501Z It's fields are defined by the RolloutSettings class below. 2025-01-24T00:45:43.7664922Z 2025-01-24T00:45:43.7665270Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-01-24T00:45:43.7666101Z The user list is also a comma separated list of additional features or 2025-01-24T00:45:43.7666804Z experiments which the user could be opted in to. 2025-01-24T00:45:43.7667190Z 2025-01-24T00:45:43.7667380Z The user list has the following rules: 2025-01-24T00:45:43.7667718Z 2025-01-24T00:45:43.7668035Z - Users are GitHub usernames, which must start with the @ prefix 2025-01-24T00:45:43.7668866Z - Each user is also a comma-separated list of features/experiments to enable 2025-01-24T00:45:43.7669600Z - A "#" prefix opts the user out of all experiments 2025-01-24T00:45:43.7669984Z 2025-01-24T00:45:43.7670154Z Example config: 2025-01-24T00:45:43.7670604Z # A list of experiments that can be opted into. 2025-01-24T00:45:43.7671265Z # This defines the behavior they'll induce when opted into. 2025-01-24T00:45:43.7671873Z # Expected syntax is: 2025-01-24T00:45:43.7672503Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-01-24T00:45:43.7673695Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-01-24T00:45:43.7674448Z 2025-01-24T00:45:43.7674625Z experiments: 2025-01-24T00:45:43.7675004Z lf: 2025-01-24T00:45:43.7675385Z rollout_percent: 25 2025-01-24T00:45:43.7675835Z all_branches: false 2025-01-24T00:45:43.7676300Z default: true 2025-01-24T00:45:43.7676717Z --- 2025-01-24T00:45:43.7676915Z 2025-01-24T00:45:43.7677076Z # Opt-ins: 2025-01-24T00:45:43.7677644Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-01-24T00:45:43.7678485Z # and specifying experiments to enable in a comma-separated list. 2025-01-24T00:45:43.7679231Z # To always opt out of an experiment, prefix it with a "-". 2025-01-24T00:45:43.7679874Z # Experiments should be from the above list. 2025-01-24T00:45:43.7680244Z 2025-01-24T00:45:43.7680422Z @User1,-lf,split_build 2025-01-24T00:45:43.7680844Z @User2,lf 2025-01-24T00:45:43.7681223Z @User3,split_build 2025-01-24T00:45:43.7681625Z """ 2025-01-24T00:45:43.7681812Z 2025-01-24T00:45:43.7681989Z import json 2025-01-24T00:45:43.7682392Z import logging 2025-01-24T00:45:43.7682807Z import os 2025-01-24T00:45:43.7683548Z import random 2025-01-24T00:45:43.7683933Z import re 2025-01-24T00:45:43.7684281Z import sys 2025-01-24T00:45:43.7684673Z from argparse import ArgumentParser 2025-01-24T00:45:43.7685178Z from functools import lru_cache 2025-01-24T00:45:43.7685650Z from logging import LogRecord 2025-01-24T00:45:43.7686312Z from typing import Any, Dict, FrozenSet, Iterable, List, NamedTuple, Set, Tuple 2025-01-24T00:45:43.7687046Z from urllib.request import Request, urlopen 2025-01-24T00:45:43.7687399Z 2025-01-24T00:45:43.7687590Z import yaml 2025-01-24T00:45:43.7688116Z from github import Auth, Github 2025-01-24T00:45:43.7688591Z from github.Issue import Issue 2025-01-24T00:45:43.7688884Z 2025-01-24T00:45:43.7688890Z 2025-01-24T00:45:43.7689101Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-01-24T00:45:43.7689761Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-01-24T00:45:43.7690591Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-01-24T00:45:43.7691124Z 2025-01-24T00:45:43.7691348Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-01-24T00:45:43.7691891Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-01-24T00:45:43.7692383Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-01-24T00:45:43.7692921Z OPT_OUT_LABEL = "no-runner-experiments" 2025-01-24T00:45:43.7693483Z 2025-01-24T00:45:43.7693684Z SETTING_EXPERIMENTS = "experiments" 2025-01-24T00:45:43.7694015Z 2025-01-24T00:45:43.7694194Z LF_FLEET_EXPERIMENT = "lf" 2025-01-24T00:45:43.7694645Z CANARY_FLEET_SUFFIX = ".c" 2025-01-24T00:45:43.7694924Z 2025-01-24T00:45:43.7694930Z 2025-01-24T00:45:43.7695115Z class Experiment(NamedTuple): 2025-01-24T00:45:43.7695588Z rollout_perc: float = ( 2025-01-24T00:45:43.7696238Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-01-24T00:45:43.7696886Z ) 2025-01-24T00:45:43.7697250Z all_branches: bool = ( 2025-01-24T00:45:43.7697856Z False # If True, the experiment is also enabled on the exception branches 2025-01-24T00:45:43.7698505Z ) 2025-01-24T00:45:43.7698861Z default: bool = ( 2025-01-24T00:45:43.7699414Z True # If True, the experiment is enabled by default for all queries 2025-01-24T00:45:43.7700024Z ) 2025-01-24T00:45:43.7700216Z 2025-01-24T00:45:43.7700393Z # Add more fields as needed 2025-01-24T00:45:43.7700681Z 2025-01-24T00:45:43.7700687Z 2025-01-24T00:45:43.7700870Z class Settings(NamedTuple): 2025-01-24T00:45:43.7701300Z """ 2025-01-24T00:45:43.7701744Z Settings for the experiments that can be opted into. 2025-01-24T00:45:43.7702301Z """ 2025-01-24T00:45:43.7702487Z 2025-01-24T00:45:43.7702688Z experiments: Dict[str, Experiment] = {} 2025-01-24T00:45:43.7703041Z 2025-01-24T00:45:43.7703046Z 2025-01-24T00:45:43.7703344Z class ColorFormatter(logging.Formatter): 2025-01-24T00:45:43.7703946Z """Color codes the log messages based on the log level""" 2025-01-24T00:45:43.7704490Z 2025-01-24T00:45:43.7704661Z COLORS = { 2025-01-24T00:45:43.7705062Z "WARNING": "\033[33m", # Yellow 2025-01-24T00:45:43.7705550Z "ERROR": "\033[31m", # Red 2025-01-24T00:45:43.7706022Z "CRITICAL": "\033[31m", # Red 2025-01-24T00:45:43.7706508Z "INFO": "\033[0m", # Reset 2025-01-24T00:45:43.7706976Z "DEBUG": "\033[0m", # Reset 2025-01-24T00:45:43.7707427Z } 2025-01-24T00:45:43.7707618Z 2025-01-24T00:45:43.7707833Z def format(self, record: LogRecord) -> str: 2025-01-24T00:45:43.7708555Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-01-24T00:45:43.7709302Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-01-24T00:45:43.7709872Z return super().format(record) 2025-01-24T00:45:43.7710192Z 2025-01-24T00:45:43.7710204Z 2025-01-24T00:45:43.7710395Z handler = logging.StreamHandler() 2025-01-24T00:45:43.7711075Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-01-24T00:45:43.7711611Z 2025-01-24T00:45:43.7711845Z log = logging.getLogger(os.path.basename(__file__)) 2025-01-24T00:45:43.7712409Z log.addHandler(handler) 2025-01-24T00:45:43.7712842Z log.setLevel(logging.INFO) 2025-01-24T00:45:43.7713285Z 2025-01-24T00:45:43.7713295Z 2025-01-24T00:45:43.7713580Z def set_github_output(key: str, value: str) -> None: 2025-01-24T00:45:43.7714125Z """ 2025-01-24T00:45:43.7714612Z Defines outputs of the github action that invokes this script 2025-01-24T00:45:43.7715206Z """ 2025-01-24T00:45:43.7715566Z if not GITHUB_OUTPUT: 2025-01-24T00:45:43.7716586Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-01-24T00:45:43.7717799Z log.warning( 2025-01-24T00:45:43.7718601Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-01-24T00:45:43.7719484Z ) 2025-01-24T00:45:43.7729683Z print(f"::set-output name={key}::{value}") 2025-01-24T00:45:43.7730277Z return 2025-01-24T00:45:43.7730507Z 2025-01-24T00:45:43.7730715Z with open(GITHUB_OUTPUT, "a") as f: 2025-01-24T00:45:43.7731270Z log.info(f"Setting output: {key}='{value}'") 2025-01-24T00:45:43.7731831Z f.write(f"{key}={value}\n") 2025-01-24T00:45:43.7732146Z 2025-01-24T00:45:43.7732153Z 2025-01-24T00:45:43.7732457Z def _str_comma_separated_to_set(value: str) -> FrozenSet[str]: 2025-01-24T00:45:43.7733257Z return frozenset( 2025-01-24T00:45:43.7733919Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-01-24T00:45:43.7734580Z ) 2025-01-24T00:45:43.7734774Z 2025-01-24T00:45:43.7734781Z 2025-01-24T00:45:43.7734962Z def parse_args() -> Any: 2025-01-24T00:45:43.7735512Z parser = ArgumentParser("Get dynamic rollout settings") 2025-01-24T00:45:43.7736340Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-01-24T00:45:43.7737086Z parser.add_argument( 2025-01-24T00:45:43.7737524Z "--github-issue-repo", 2025-01-24T00:45:43.7737980Z type=str, 2025-01-24T00:45:43.7738369Z required=False, 2025-01-24T00:45:43.7738817Z default="pytorch/test-infra", 2025-01-24T00:45:43.7739340Z help="GitHub repo to get the issue", 2025-01-24T00:45:43.7739837Z ) 2025-01-24T00:45:43.7740203Z parser.add_argument( 2025-01-24T00:45:43.7740648Z "--github-repo", 2025-01-24T00:45:43.7741093Z type=str, 2025-01-24T00:45:43.7741503Z required=True, 2025-01-24T00:45:43.7741944Z help="GitHub repo where CI is running", 2025-01-24T00:45:43.7742445Z ) 2025-01-24T00:45:43.7742803Z parser.add_argument( 2025-01-24T00:45:43.7743580Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-01-24T00:45:43.7744213Z ) 2025-01-24T00:45:43.7744575Z parser.add_argument( 2025-01-24T00:45:43.7745349Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-01-24T00:45:43.7746008Z ) 2025-01-24T00:45:43.7746363Z parser.add_argument( 2025-01-24T00:45:43.7746972Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-01-24T00:45:43.7747626Z ) 2025-01-24T00:45:43.7747987Z parser.add_argument( 2025-01-24T00:45:43.7748604Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-01-24T00:45:43.7749274Z ) 2025-01-24T00:45:43.7749625Z parser.add_argument( 2025-01-24T00:45:43.7750073Z "--github-ref-type", 2025-01-24T00:45:43.7750514Z type=str, 2025-01-24T00:45:43.7750905Z required=True, 2025-01-24T00:45:43.7751361Z help="Current GitHub ref type, branch or tag", 2025-01-24T00:45:43.7751893Z ) 2025-01-24T00:45:43.7752243Z parser.add_argument( 2025-01-24T00:45:43.7752679Z "--eligible-experiments", 2025-01-24T00:45:43.7753388Z type=_str_comma_separated_to_set, 2025-01-24T00:45:43.7753916Z required=False, 2025-01-24T00:45:43.7754320Z default="", 2025-01-24T00:45:43.7755128Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-01-24T00:45:43.7756016Z ) 2025-01-24T00:45:43.7756377Z parser.add_argument( 2025-01-24T00:45:43.7756801Z "--pr-number", 2025-01-24T00:45:43.7757199Z type=str, 2025-01-24T00:45:43.7757584Z required=False, 2025-01-24T00:45:43.7757992Z default="", 2025-01-24T00:45:43.7758444Z help="the optional PR number where this is run", 2025-01-24T00:45:43.7758980Z ) 2025-01-24T00:45:43.7759320Z 2025-01-24T00:45:43.7759509Z return parser.parse_args() 2025-01-24T00:45:43.7759799Z 2025-01-24T00:45:43.7759806Z 2025-01-24T00:45:43.7760033Z def get_gh_client(github_token: str) -> Github: 2025-01-24T00:45:43.7760588Z auth = Auth.Token(github_token) 2025-01-24T00:45:43.7761080Z return Github(auth=auth) 2025-01-24T00:45:43.7761361Z 2025-01-24T00:45:43.7761367Z 2025-01-24T00:45:43.7761663Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: 2025-01-24T00:45:43.7762284Z repo = gh.get_repo(repo) 2025-01-24T00:45:43.7762763Z return repo.get_issue(number=issue_num) 2025-01-24T00:45:43.7763302Z 2025-01-24T00:45:43.7763310Z 2025-01-24T00:45:43.7763532Z def get_potential_pr_author( 2025-01-24T00:45:43.7764147Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-01-24T00:45:43.7764793Z ) -> str: 2025-01-24T00:45:43.7765288Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-01-24T00:45:43.7766098Z # Fetch the actual username from the original PR. The PR number is 2025-01-24T00:45:43.7766806Z # embedded in the tag name: ciflow// 2025-01-24T00:45:43.7767205Z 2025-01-24T00:45:43.7767391Z gh = get_gh_client(github_token) 2025-01-24T00:45:43.7767707Z 2025-01-24T00:45:43.7767974Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-01-24T00:45:43.7768562Z split_tag = ref_name.split("/") 2025-01-24T00:45:43.7769049Z if ( 2025-01-24T00:45:43.7769423Z len(split_tag) == 3 2025-01-24T00:45:43.7769884Z and split_tag[0] == "ciflow" 2025-01-24T00:45:43.7770384Z and split_tag[2].isnumeric() 2025-01-24T00:45:43.7770864Z ): 2025-01-24T00:45:43.7771237Z pr_number = split_tag[2] 2025-01-24T00:45:43.7771702Z try: 2025-01-24T00:45:43.7772112Z repository = gh.get_repo(repo) 2025-01-24T00:45:43.7772689Z pull = repository.get_pull(number=int(pr_number)) 2025-01-24T00:45:43.7773449Z except Exception as e: 2025-01-24T00:45:43.7773988Z raise Exception( # noqa: TRY002 2025-01-24T00:45:43.7774656Z f"issue with pull request {pr_number} from repo {repository}" 2025-01-24T00:45:43.7775272Z ) from e 2025-01-24T00:45:43.7775834Z return pull.user.login 2025-01-24T00:45:43.7776387Z # In all other cases, return the original input username 2025-01-24T00:45:43.7776950Z return username 2025-01-24T00:45:43.7777179Z 2025-01-24T00:45:43.7777186Z 2025-01-24T00:45:43.7777409Z def is_exception_branch(branch: str) -> bool: 2025-01-24T00:45:43.7777918Z """ 2025-01-24T00:45:43.7778534Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-01-24T00:45:43.7779272Z """ 2025-01-24T00:45:43.7779793Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-01-24T00:45:43.7780290Z 2025-01-24T00:45:43.7780297Z 2025-01-24T00:45:43.7780489Z def load_yaml(yaml_text: str) -> Any: 2025-01-24T00:45:43.7780957Z try: 2025-01-24T00:45:43.7781327Z data = yaml.safe_load(yaml_text) 2025-01-24T00:45:43.7781848Z return data 2025-01-24T00:45:43.7782270Z except yaml.YAMLError: 2025-01-24T00:45:43.7782730Z log.exception("Error loading YAML") 2025-01-24T00:45:43.7783333Z raise 2025-01-24T00:45:43.7783542Z 2025-01-24T00:45:43.7783548Z 2025-01-24T00:45:43.7783945Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> Tuple[str, str]: 2025-01-24T00:45:43.7784644Z """ 2025-01-24T00:45:43.7785238Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-01-24T00:45:43.7785803Z 2025-01-24T00:45:43.7786136Z If the issue body contains "---" then the text above that is the settings 2025-01-24T00:45:43.7786852Z and the text below is the list of opted in users. 2025-01-24T00:45:43.7787242Z 2025-01-24T00:45:43.7787619Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-01-24T00:45:43.7788424Z """ 2025-01-24T00:45:43.7788843Z rollout_state_parts = rollout_state.split("---") 2025-01-24T00:45:43.7789408Z if len(rollout_state_parts) >= 2: 2025-01-24T00:45:43.7789987Z return rollout_state_parts[0], rollout_state_parts[1] 2025-01-24T00:45:43.7790570Z else: 2025-01-24T00:45:43.7790936Z return "", rollout_state 2025-01-24T00:45:43.7791235Z 2025-01-24T00:45:43.7791241Z 2025-01-24T00:45:43.7791443Z class UserOptins(Dict[str, List[str]]): 2025-01-24T00:45:43.7791937Z """ 2025-01-24T00:45:43.7792436Z Dictionary of users with a list of features they have opted into 2025-01-24T00:45:43.7793211Z """ 2025-01-24T00:45:43.7793499Z 2025-01-24T00:45:43.7793505Z 2025-01-24T00:45:43.7793840Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-01-24T00:45:43.7794460Z """ 2025-01-24T00:45:43.7795128Z 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:45:43.7795783Z 2025-01-24T00:45:43.7796381Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-01-24T00:45:43.7797318Z - Example line: "@User1,lf,split_build" 2025-01-24T00:45:43.7797973Z - A "#" prefix indicates the user is opted out of all experiments 2025-01-24T00:45:43.7798433Z 2025-01-24T00:45:43.7798444Z 2025-01-24T00:45:43.7798601Z """ 2025-01-24T00:45:43.7798955Z optins = UserOptins() 2025-01-24T00:45:43.7799424Z for user in user_optin_text.split("\n"): 2025-01-24T00:45:43.7799950Z user = user.strip("\r\n\t -") 2025-01-24T00:45:43.7800469Z if not user or not user.startswith("@"): 2025-01-24T00:45:43.7800994Z # Not a valid user. Skip 2025-01-24T00:45:43.7801454Z continue 2025-01-24T00:45:43.7801689Z 2025-01-24T00:45:43.7801846Z if user: 2025-01-24T00:45:43.7802262Z usr_name = user.split(",")[0].strip("@") 2025-01-24T00:45:43.7802927Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-01-24T00:45:43.7803519Z 2025-01-24T00:45:43.7803692Z return optins 2025-01-24T00:45:43.7803920Z 2025-01-24T00:45:43.7803926Z 2025-01-24T00:45:43.7804213Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-01-24T00:45:43.7804919Z """ 2025-01-24T00:45:43.7805303Z Check if the experiment name is valid. 2025-01-24T00:45:43.7805793Z A valid name: 2025-01-24T00:45:43.7806394Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-01-24T00:45:43.7807276Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-01-24T00:45:43.7807949Z - Cannot contain spaces 2025-01-24T00:45:43.7808396Z """ 2025-01-24T00:45:43.7808582Z 2025-01-24T00:45:43.7808833Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-01-24T00:45:43.7809492Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-01-24T00:45:43.7809926Z 2025-01-24T00:45:43.7810090Z if valid: 2025-01-24T00:45:43.7810459Z return True 2025-01-24T00:45:43.7810685Z 2025-01-24T00:45:43.7810848Z log.error( 2025-01-24T00:45:43.7812209Z 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:45:43.7813776Z ) 2025-01-24T00:45:43.7814127Z return False 2025-01-24T00:45:43.7814349Z 2025-01-24T00:45:43.7814356Z 2025-01-24T00:45:43.7814650Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-01-24T00:45:43.7815242Z """ 2025-01-24T00:45:43.7815796Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-01-24T00:45:43.7816464Z """ 2025-01-24T00:45:43.7816812Z try: 2025-01-24T00:45:43.7817174Z if settings_text: 2025-01-24T00:45:43.7817973Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-01-24T00:45:43.7818724Z # for easy reading 2025-01-24T00:45:43.7819473Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-01-24T00:45:43.7820313Z # the backtick character in shell commands. 2025-01-24T00:45:43.7820898Z backtick = chr(96) # backtick character 2025-01-24T00:45:43.7821553Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-01-24T00:45:43.7822211Z settings = load_yaml(settings_text) 2025-01-24T00:45:43.7822566Z 2025-01-24T00:45:43.7822946Z # For now we just load experiments. We can expand this if/when we add more settings 2025-01-24T00:45:43.7823758Z experiments = {} 2025-01-24T00:45:43.7824035Z 2025-01-24T00:45:43.7824367Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-01-24T00:45:43.7825081Z if not is_valid_experiment_name(exp_name): 2025-01-24T00:45:43.7826116Z # 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:45:43.7827092Z continue 2025-01-24T00:45:43.7827364Z 2025-01-24T00:45:43.7827539Z valid_settings = {} 2025-01-24T00:45:43.7828033Z for setting in exp_settings: 2025-01-24T00:45:43.7828575Z if setting not in Experiment._fields: 2025-01-24T00:45:43.7829102Z log.warning( 2025-01-24T00:45:43.7829766Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-01-24T00:45:43.7830452Z ) 2025-01-24T00:45:43.7830862Z else: 2025-01-24T00:45:43.7831353Z valid_settings[setting] = exp_settings[setting] 2025-01-24T00:45:43.7831756Z 2025-01-24T00:45:43.7832021Z experiments[exp_name] = Experiment(**valid_settings) 2025-01-24T00:45:43.7832617Z return Settings(experiments) 2025-01-24T00:45:43.7832950Z 2025-01-24T00:45:43.7833209Z except Exception: 2025-01-24T00:45:43.7833668Z log.exception("Failed to parse settings") 2025-01-24T00:45:43.7834034Z 2025-01-24T00:45:43.7834342Z return Settings() 2025-01-24T00:45:43.7834599Z 2025-01-24T00:45:43.7834604Z 2025-01-24T00:45:43.7834841Z def parse_settings(rollout_state: str) -> Settings: 2025-01-24T00:45:43.7835375Z """ 2025-01-24T00:45:43.7835786Z Parse settings, if any, from the rollout state. 2025-01-24T00:45:43.7836170Z 2025-01-24T00:45:43.7836500Z If the issue body contains "---" then the text above that is the settings 2025-01-24T00:45:43.7837215Z and the text below is the list of opted in users. 2025-01-24T00:45:43.7837593Z 2025-01-24T00:45:43.7837975Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-01-24T00:45:43.7838681Z """ 2025-01-24T00:45:43.7839251Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-01-24T00:45:43.7839952Z return parse_settings_from_text(settings_text) 2025-01-24T00:45:43.7840334Z 2025-01-24T00:45:43.7840339Z 2025-01-24T00:45:43.7840574Z def parse_users(rollout_state: str) -> UserOptins: 2025-01-24T00:45:43.7841120Z """ 2025-01-24T00:45:43.7841517Z Parse users from the rollout state. 2025-01-24T00:45:43.7841852Z 2025-01-24T00:45:43.7842003Z """ 2025-01-24T00:45:43.7842506Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-01-24T00:45:43.7843315Z return parse_user_opt_in_from_text(users_text) 2025-01-24T00:45:43.7843711Z 2025-01-24T00:45:43.7843717Z 2025-01-24T00:45:43.7844107Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-01-24T00:45:43.7844803Z """ 2025-01-24T00:45:43.7845195Z Check if a user is opted into an experiment 2025-01-24T00:45:43.7845825Z """ 2025-01-24T00:45:43.7846263Z return experiment_name in user_optins.get(user, []) 2025-01-24T00:45:43.7846655Z 2025-01-24T00:45:43.7846663Z 2025-01-24T00:45:43.7847054Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-01-24T00:45:43.7847760Z """ 2025-01-24T00:45:43.7848197Z Check if a user explicitly opted out of an experiment 2025-01-24T00:45:43.7848744Z """ 2025-01-24T00:45:43.7849219Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-01-24T00:45:43.7849865Z experiment_optout = "-" + experiment_name 2025-01-24T00:45:43.7850472Z if experiment_optout not in user_optins.get(user, []): 2025-01-24T00:45:43.7851036Z return False 2025-01-24T00:45:43.7851281Z 2025-01-24T00:45:43.7851535Z if is_user_opted_in(user, user_optins, experiment_name): 2025-01-24T00:45:43.7852105Z log.warning( 2025-01-24T00:45:43.7852857Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-01-24T00:45:43.7853793Z ) 2025-01-24T00:45:43.7853991Z 2025-01-24T00:45:43.7854160Z return True 2025-01-24T00:45:43.7854375Z 2025-01-24T00:45:43.7854380Z 2025-01-24T00:45:43.7854558Z def get_runner_prefix( 2025-01-24T00:45:43.7854979Z rollout_state: str, 2025-01-24T00:45:43.7855424Z workflow_requestors: Iterable[str], 2025-01-24T00:45:43.7855909Z branch: str, 2025-01-24T00:45:43.7856375Z eligible_experiments: FrozenSet[str] = frozenset(), 2025-01-24T00:45:43.7856945Z is_canary: bool = False, 2025-01-24T00:45:43.7857368Z ) -> str: 2025-01-24T00:45:43.7857757Z settings = parse_settings(rollout_state) 2025-01-24T00:45:43.7858308Z user_optins = parse_users(rollout_state) 2025-01-24T00:45:43.7858649Z 2025-01-24T00:45:43.7858815Z fleet_prefix = "" 2025-01-24T00:45:43.7859223Z prefixes = [] 2025-01-24T00:45:43.7859810Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-01-24T00:45:43.7860678Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-01-24T00:45:43.7861350Z log.info( 2025-01-24T00:45:43.7861985Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-01-24T00:45:43.7862728Z ) 2025-01-24T00:45:43.7863290Z continue 2025-01-24T00:45:43.7863536Z 2025-01-24T00:45:43.7863716Z if eligible_experiments: 2025-01-24T00:45:43.7864241Z if experiment_name not in eligible_experiments: 2025-01-24T00:45:43.7864832Z exp_list = ", ".join(eligible_experiments) 2025-01-24T00:45:43.7865359Z log.info( 2025-01-24T00:45:43.7866097Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-01-24T00:45:43.7866887Z ) 2025-01-24T00:45:43.7867268Z continue 2025-01-24T00:45:43.7867714Z elif not experiment_settings.default: 2025-01-24T00:45:43.7868217Z log.info( 2025-01-24T00:45:43.7868833Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-01-24T00:45:43.7869528Z ) 2025-01-24T00:45:43.7869887Z continue 2025-01-24T00:45:43.7870128Z 2025-01-24T00:45:43.7870385Z # Is any workflow_requestor opted out to this experiment? 2025-01-24T00:45:43.7870974Z opted_out_users = [ 2025-01-24T00:45:43.7871403Z requestor 2025-01-24T00:45:43.7871834Z for requestor in workflow_requestors 2025-01-24T00:45:43.7872465Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-01-24T00:45:43.7873051Z ] 2025-01-24T00:45:43.7873353Z 2025-01-24T00:45:43.7873522Z if opted_out_users: 2025-01-24T00:45:43.7873950Z log.info( 2025-01-24T00:45:43.7874569Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-01-24T00:45:43.7875368Z ) 2025-01-24T00:45:43.7875732Z continue 2025-01-24T00:45:43.7875967Z 2025-01-24T00:45:43.7876221Z # Is any workflow_requestor opted in to this experiment? 2025-01-24T00:45:43.7876805Z opted_in_users = [ 2025-01-24T00:45:43.7877224Z requestor 2025-01-24T00:45:43.7877656Z for requestor in workflow_requestors 2025-01-24T00:45:43.7878279Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-01-24T00:45:43.7879169Z ] 2025-01-24T00:45:43.7879368Z 2025-01-24T00:45:43.7879533Z enabled = False 2025-01-24T00:45:43.7879949Z if opted_in_users: 2025-01-24T00:45:43.7880380Z log.info( 2025-01-24T00:45:43.7880933Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-01-24T00:45:43.7881586Z ) 2025-01-24T00:45:43.7881948Z enabled = True 2025-01-24T00:45:43.7882213Z 2025-01-24T00:45:43.7882413Z elif experiment_settings.rollout_perc: 2025-01-24T00:45:43.7883312Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-01-24T00:45:43.7884197Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-01-24T00:45:43.7884809Z log.info( 2025-01-24T00:45:43.7885630Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-01-24T00:45:43.7886495Z ) 2025-01-24T00:45:43.7886878Z enabled = True 2025-01-24T00:45:43.7887167Z 2025-01-24T00:45:43.7887328Z if enabled: 2025-01-24T00:45:43.7887764Z label = experiment_name 2025-01-24T00:45:43.7888280Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-01-24T00:45:43.7889058Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-01-24T00:45:43.7889874Z # - If it's enabled, then we always list it's prefix first 2025-01-24T00:45:43.7890593Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-01-24T00:45:43.7891233Z if is_canary: 2025-01-24T00:45:43.7891699Z label += CANARY_FLEET_SUFFIX 2025-01-24T00:45:43.7892213Z fleet_prefix = label 2025-01-24T00:45:43.7892827Z else: 2025-01-24T00:45:43.7893343Z prefixes.append(label) 2025-01-24T00:45:43.7893665Z 2025-01-24T00:45:43.7893841Z if len(prefixes) > 1: 2025-01-24T00:45:43.7894266Z log.error( 2025-01-24T00:45:43.7895231Z 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:45:43.7896270Z ) 2025-01-24T00:45:43.7896644Z prefixes = prefixes[:1] 2025-01-24T00:45:43.7896934Z 2025-01-24T00:45:43.7897117Z # Fleet always comes first 2025-01-24T00:45:43.7897557Z if fleet_prefix: 2025-01-24T00:45:43.7897989Z prefixes.insert(0, fleet_prefix) 2025-01-24T00:45:43.7898317Z 2025-01-24T00:45:43.7898558Z return ".".join(prefixes) + "." if prefixes else "" 2025-01-24T00:45:43.7898942Z 2025-01-24T00:45:43.7898949Z 2025-01-24T00:45:43.7899374Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-01-24T00:45:43.7900088Z """ 2025-01-24T00:45:43.7900633Z Gets the first comment of the issue, which contains the desired rollout state. 2025-01-24T00:45:43.7901151Z 2025-01-24T00:45:43.7901516Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-01-24T00:45:43.7902174Z """ 2025-01-24T00:45:43.7902545Z gh = get_gh_client(github_token) 2025-01-24T00:45:43.7903050Z issue = get_issue(gh, repo, issue_num) 2025-01-24T00:45:43.7903740Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-01-24T00:45:43.7904161Z 2025-01-24T00:45:43.7904167Z 2025-01-24T00:45:43.7904539Z def download_json(url: str, headers: Dict[str, str], num_retries: int = 3) -> Any: 2025-01-24T00:45:43.7905382Z for _ in range(num_retries): 2025-01-24T00:45:43.7905829Z try: 2025-01-24T00:45:43.7906248Z req = Request(url=url, headers=headers) 2025-01-24T00:45:43.7906877Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-01-24T00:45:43.7907486Z return json.loads(content) 2025-01-24T00:45:43.7907991Z except Exception as e: 2025-01-24T00:45:43.7908505Z log.warning(f"Could not download {url}: {e}") 2025-01-24T00:45:43.7908881Z 2025-01-24T00:45:43.7909237Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-01-24T00:45:43.7909905Z return {} 2025-01-24T00:45:43.7910117Z 2025-01-24T00:45:43.7910122Z 2025-01-24T00:45:43.7910304Z @lru_cache(maxsize=None) 2025-01-24T00:45:43.7910950Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> Dict[str, Any]: 2025-01-24T00:45:43.7911661Z """ 2025-01-24T00:45:43.7912046Z Dynamically get PR information 2025-01-24T00:45:43.7912507Z """ 2025-01-24T00:45:43.7912975Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-01-24T00:45:43.7913704Z headers = { 2025-01-24T00:45:43.7914133Z "Accept": "application/vnd.github.v3+json", 2025-01-24T00:45:43.7914712Z "Authorization": f"token {github_token}", 2025-01-24T00:45:43.7915225Z } 2025-01-24T00:45:43.7915624Z json_response: Dict[str, Any] = download_json( 2025-01-24T00:45:43.7916198Z url=f"{github_api}/issues/{pr_number}", 2025-01-24T00:45:43.7916714Z headers=headers, 2025-01-24T00:45:43.7917115Z ) 2025-01-24T00:45:43.7917311Z 2025-01-24T00:45:43.7917489Z if not json_response: 2025-01-24T00:45:43.7918044Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-01-24T00:45:43.7918623Z return {} 2025-01-24T00:45:43.7918858Z 2025-01-24T00:45:43.7919030Z return json_response 2025-01-24T00:45:43.7919291Z 2025-01-24T00:45:43.7919302Z 2025-01-24T00:45:43.7919677Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> Set[str]: 2025-01-24T00:45:43.7920353Z """ 2025-01-24T00:45:43.7920854Z Dynamically get the latest list of labels from the pull request 2025-01-24T00:45:43.7921466Z """ 2025-01-24T00:45:43.7922035Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-01-24T00:45:43.7922622Z return { 2025-01-24T00:45:43.7923267Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-01-24T00:45:43.7923924Z } 2025-01-24T00:45:43.7924120Z 2025-01-24T00:45:43.7924126Z 2025-01-24T00:45:43.7924299Z def main() -> None: 2025-01-24T00:45:43.7924699Z args = parse_args() 2025-01-24T00:45:43.7924953Z 2025-01-24T00:45:43.7925162Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-01-24T00:45:43.7925525Z 2025-01-24T00:45:43.7925707Z # Check if the PR is opt-out 2025-01-24T00:45:43.7926170Z if args.pr_number: 2025-01-24T00:45:43.7926789Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-01-24T00:45:43.7927487Z if OPT_OUT_LABEL in labels: 2025-01-24T00:45:43.7927961Z log.info( 2025-01-24T00:45:43.7928595Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-01-24T00:45:43.7929312Z ) 2025-01-24T00:45:43.7929835Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-01-24T00:45:43.7930464Z sys.exit() 2025-01-24T00:45:43.7930712Z 2025-01-24T00:45:43.7930868Z try: 2025-01-24T00:45:43.7931274Z rollout_state = get_rollout_state_from_issue( 2025-01-24T00:45:43.7931943Z args.github_token, args.github_issue_repo, args.github_issue 2025-01-24T00:45:43.7932546Z ) 2025-01-24T00:45:43.7932744Z 2025-01-24T00:45:43.7932936Z username = get_potential_pr_author( 2025-01-24T00:45:43.7933540Z args.github_token, 2025-01-24T00:45:43.7933990Z args.github_repo, 2025-01-24T00:45:43.7934567Z args.github_actor, 2025-01-24T00:45:43.7935029Z args.github_ref_type, 2025-01-24T00:45:43.7935492Z args.github_branch, 2025-01-24T00:45:43.7935950Z ) 2025-01-24T00:45:43.7936142Z 2025-01-24T00:45:43.7936421Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-01-24T00:45:43.7936840Z 2025-01-24T00:45:43.7937040Z runner_label_prefix = get_runner_prefix( 2025-01-24T00:45:43.7937561Z rollout_state, 2025-01-24T00:45:43.7938015Z (args.github_issue_owner, username), 2025-01-24T00:45:43.7938526Z args.github_branch, 2025-01-24T00:45:43.7938985Z args.eligible_experiments, 2025-01-24T00:45:43.7939469Z is_canary, 2025-01-24T00:45:43.7939855Z ) 2025-01-24T00:45:43.7940052Z 2025-01-24T00:45:43.7940228Z except Exception as e: 2025-01-24T00:45:43.7940660Z log.error( 2025-01-24T00:45:43.7941289Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-01-24T00:45:43.7942012Z ) 2025-01-24T00:45:43.7942201Z 2025-01-24T00:45:43.7942515Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-01-24T00:45:43.7942977Z 2025-01-24T00:45:43.7942983Z 2025-01-24T00:45:43.7943251Z if __name__ == "__main__": 2025-01-24T00:45:43.7943674Z main() 2025-01-24T00:45:43.7943867Z 2025-01-24T00:45:43.8032467Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-01-24T00:45:43.8033582Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-01-24T00:45:43.8061661Z shell: /usr/bin/bash -e {0} 2025-01-24T00:45:43.8062123Z env: 2025-01-24T00:45:43.8062709Z GITHUB_TOKEN: *** 2025-01-24T00:45:43.8063238Z ISSUE_NUMBER: 5132 2025-01-24T00:45:43.8063682Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-01-24T00:45:43.8064161Z ISSUE_OWNER: 2025-01-24T00:45:43.8064543Z CHECK_EXPERIMENTS: 2025-01-24T00:45:43.8064953Z PR_NUMBER: 2025-01-24T00:45:43.8065337Z ##[endgroup] 2025-01-24T00:45:44.9683874Z Defaulting to user installation because normal site-packages is not writeable 2025-01-24T00:45:46.1105363Z Collecting urllib3==1.26.18 2025-01-24T00:45:46.1504481Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-01-24T00:45:46.1740136Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.3 MB/s eta 0:00:00 2025-01-24T00:45:46.1943439Z Collecting PyGithub==2.3.0 2025-01-24T00:45:46.1973964Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-01-24T00:45:46.2416177Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-01-24T00:45:46.2462777Z 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:45:46.2520026Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-01-24T00:45:46.2538562Z 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:45:46.2553483Z 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:45:46.2797908Z Collecting Deprecated (from PyGithub==2.3.0) 2025-01-24T00:45:46.2846516Z Downloading Deprecated-1.2.15-py2.py3-none-any.whl.metadata (5.5 kB) 2025-01-24T00:45:46.3092449Z 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:45:46.4332802Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-01-24T00:45:46.4381031Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-01-24T00:45:46.5506322Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-01-24T00:45:46.5544118Z 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:45:46.5741560Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-01-24T00:45:46.5965418Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-01-24T00:45:46.6220630Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-01-24T00:45:46.6295481Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 24.1 MB/s eta 0:00:00 2025-01-24T00:45:46.6354510Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-01-24T00:45:46.6422593Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 68.1 MB/s eta 0:00:00 2025-01-24T00:45:46.6453481Z 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:45:46.6567950Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 94.1 MB/s eta 0:00:00 2025-01-24T00:45:46.6631492Z Downloading Deprecated-1.2.15-py2.py3-none-any.whl (9.9 kB) 2025-01-24T00:45:46.6714358Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-01-24T00:45:46.6826642Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 55.3 MB/s eta 0:00:00 2025-01-24T00:45:46.6865751Z 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:45:46.6931413Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 19.6 MB/s eta 0:00:00 2025-01-24T00:45:46.6983700Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-01-24T00:45:46.7041362Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 29.7 MB/s eta 0:00:00 2025-01-24T00:45:47.0448158Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-01-24T00:45:47.5867181Z 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:45:47.6755294Z ##[group]Run curr_branch="ciflow/inductor/145539" 2025-01-24T00:45:47.6755717Z curr_branch="ciflow/inductor/145539" 2025-01-24T00:45:47.6756034Z curr_ref_type="tag" 2025-01-24T00:45:47.6756294Z echo "Current branch is '$curr_branch'" 2025-01-24T00:45:47.6756569Z  2025-01-24T00:45:47.6756766Z python3 runner_determinator.py \ 2025-01-24T00:45:47.6757064Z  --github-token "$GITHUB_TOKEN" \ 2025-01-24T00:45:47.6757349Z  --github-issue "$ISSUE_NUMBER" \ 2025-01-24T00:45:47.6757616Z  --github-branch "$curr_branch" \ 2025-01-24T00:45:47.6757895Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-01-24T00:45:47.6758190Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-01-24T00:45:47.6758478Z  --github-ref-type "$curr_ref_type" \ 2025-01-24T00:45:47.6758750Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-01-24T00:45:47.6759119Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-01-24T00:45:47.6759418Z  --pr-number "${PR_NUMBER}" 2025-01-24T00:45:47.6788222Z shell: /usr/bin/bash -e {0} 2025-01-24T00:45:47.6788483Z env: 2025-01-24T00:45:47.6789123Z GITHUB_TOKEN: *** 2025-01-24T00:45:47.6789324Z ISSUE_NUMBER: 5132 2025-01-24T00:45:47.6789539Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-01-24T00:45:47.6789790Z ISSUE_OWNER: 2025-01-24T00:45:47.6789970Z CHECK_EXPERIMENTS: 2025-01-24T00:45:47.6790172Z PR_NUMBER: 2025-01-24T00:45:47.6790356Z ##[endgroup] 2025-01-24T00:45:47.6840272Z Current branch is 'ciflow/inductor/145539' 2025-01-24T00:45:49.8263570Z INFO : Based on rollout percentage of 55%, enabling experiment lf. 2025-01-24T00:45:49.8264829Z INFO : Skipping experiment 'awsa100', as it is not a default experiment 2025-01-24T00:45:49.8266571Z INFO : Setting output: label-type='lf.' 2025-01-24T00:45:49.8627562Z Evaluate and set job outputs 2025-01-24T00:45:49.8634650Z Set output 'label-type' 2025-01-24T00:45:49.8636529Z Cleaning up orphan processes