2025-01-24T00:45:37.3340475Z Current runner version: '2.321.0' 2025-01-24T00:45:37.3367823Z ##[group]Operating System 2025-01-24T00:45:37.3368634Z Ubuntu 2025-01-24T00:45:37.3369204Z 24.04.1 2025-01-24T00:45:37.3369823Z LTS 2025-01-24T00:45:37.3370320Z ##[endgroup] 2025-01-24T00:45:37.3370973Z ##[group]Runner Image 2025-01-24T00:45:37.3371870Z Image: ubuntu-24.04 2025-01-24T00:45:37.3372407Z Version: 20250120.5.0 2025-01-24T00:45:37.3373610Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250120.5/images/ubuntu/Ubuntu2404-Readme.md 2025-01-24T00:45:37.3375221Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250120.5 2025-01-24T00:45:37.3376213Z ##[endgroup] 2025-01-24T00:45:37.3376750Z ##[group]Runner Image Provisioner 2025-01-24T00:45:37.3377441Z 2.0.417.1 2025-01-24T00:45:37.3377941Z ##[endgroup] 2025-01-24T00:45:37.3380391Z ##[group]GITHUB_TOKEN Permissions 2025-01-24T00:45:37.3382833Z Actions: read 2025-01-24T00:45:37.3383588Z Attestations: read 2025-01-24T00:45:37.3384339Z Checks: read 2025-01-24T00:45:37.3384869Z Contents: read 2025-01-24T00:45:37.3385486Z Deployments: read 2025-01-24T00:45:37.3386055Z Discussions: read 2025-01-24T00:45:37.3386617Z Issues: read 2025-01-24T00:45:37.3387218Z Metadata: read 2025-01-24T00:45:37.3387772Z Packages: read 2025-01-24T00:45:37.3388277Z Pages: read 2025-01-24T00:45:37.3388864Z PullRequests: read 2025-01-24T00:45:37.3389440Z RepositoryProjects: read 2025-01-24T00:45:37.3390016Z SecurityEvents: read 2025-01-24T00:45:37.3390665Z Statuses: read 2025-01-24T00:45:37.3391362Z ##[endgroup] 2025-01-24T00:45:37.3394728Z Secret source: Actions 2025-01-24T00:45:37.3395991Z Prepare workflow directory 2025-01-24T00:45:37.4040509Z Prepare all required actions 2025-01-24T00:45:37.4095472Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (b2c89bc115123aea8e075e882ee121537ec92f89) 2025-01-24T00:45:37.4100459Z ##[group] Inputs 2025-01-24T00:45:37.4101012Z check_experiments: 2025-01-24T00:45:37.4101829Z triggering_actor: facebook-github-bot 2025-01-24T00:45:37.4102444Z issue_owner: yushangdi 2025-01-24T00:45:37.4102963Z curr_branch: export-D68294638 2025-01-24T00:45:37.4103497Z curr_ref_type: branch 2025-01-24T00:45:37.4103979Z issue_number: 5132 2025-01-24T00:45:37.4104451Z ##[endgroup] 2025-01-24T00:45:37.4104989Z Complete job name: get-label-type / runner-determinator 2025-01-24T00:45:37.4759840Z ##[group]Run cat < runner_determinator.py 2025-01-24T00:45:37.4761753Z cat < runner_determinator.py 2025-01-24T00:45:37.4762373Z # flake8: noqa: G004 2025-01-24T00:45:37.4762859Z  2025-01-24T00:45:37.4763601Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-01-24T00:45:37.4764685Z # must be kept in sync. You can do it easily by running the following command: 2025-01-24T00:45:37.4765607Z # python .github/scripts/update_runner_determinator.py 2025-01-24T00:45:37.4766281Z  2025-01-24T00:45:37.4766693Z """ 2025-01-24T00:45:37.4767368Z This runner determinator is used to determine which set of runners to run a 2025-01-24T00:45:37.4768386Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-01-24T00:45:37.4769494Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-01-24T00:45:37.4770437Z of which runners should be used to run which job. 2025-01-24T00:45:37.4771070Z  2025-01-24T00:45:37.4771915Z The configuration has two parts, the settings and a list of opted-in users, 2025-01-24T00:45:37.4772958Z separated by a line containing "---". If the line is not present, the 2025-01-24T00:45:37.4773967Z settings are considered to be empty with only the second part, the user 2025-01-24T00:45:37.4774764Z list, defined. 2025-01-24T00:45:37.4775204Z  2025-01-24T00:45:37.4775840Z The first part is a YAML block that defines the rollout settings. This can be 2025-01-24T00:45:37.4777188Z used to define any settings that are needed to determine which runners to use. 2025-01-24T00:45:37.4778199Z It's fields are defined by the RolloutSettings class below. 2025-01-24T00:45:37.4778901Z  2025-01-24T00:45:37.4779577Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-01-24T00:45:37.4780618Z The user list is also a comma separated list of additional features or 2025-01-24T00:45:37.4781620Z experiments which the user could be opted in to. 2025-01-24T00:45:37.4782269Z  2025-01-24T00:45:37.4782713Z The user list has the following rules: 2025-01-24T00:45:37.4783283Z  2025-01-24T00:45:37.4783876Z - Users are GitHub usernames, which must start with the @ prefix 2025-01-24T00:45:37.4784869Z - Each user is also a comma-separated list of features/experiments to enable 2025-01-24T00:45:37.4785766Z - A "#" prefix opts the user out of all experiments 2025-01-24T00:45:37.4786386Z  2025-01-24T00:45:37.4786819Z Example config: 2025-01-24T00:45:37.4787396Z  # A list of experiments that can be opted into. 2025-01-24T00:45:37.4788197Z  # This defines the behavior they'll induce when opted into. 2025-01-24T00:45:37.4788938Z  # Expected syntax is: 2025-01-24T00:45:37.4789745Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-01-24T00:45:37.4790901Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-01-24T00:45:37.4791882Z  2025-01-24T00:45:37.4792289Z  experiments: 2025-01-24T00:45:37.4792775Z  lf: 2025-01-24T00:45:37.4793242Z  rollout_percent: 25 2025-01-24T00:45:37.4793804Z  all_branches: false 2025-01-24T00:45:37.4794357Z  default: true 2025-01-24T00:45:37.4794870Z  --- 2025-01-24T00:45:37.4795288Z  2025-01-24T00:45:37.4795678Z  # Opt-ins: 2025-01-24T00:45:37.4796395Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-01-24T00:45:37.4797569Z  # and specifying experiments to enable in a comma-separated list. 2025-01-24T00:45:37.4798503Z  # To always opt out of an experiment, prefix it with a "-". 2025-01-24T00:45:37.4799292Z  # Experiments should be from the above list. 2025-01-24T00:45:37.4799919Z  2025-01-24T00:45:37.4800376Z  @User1,-lf,split_build 2025-01-24T00:45:37.4800915Z  @User2,lf 2025-01-24T00:45:37.4801506Z  @User3,split_build 2025-01-24T00:45:37.4802005Z """ 2025-01-24T00:45:37.4802404Z  2025-01-24T00:45:37.4802798Z import json 2025-01-24T00:45:37.4803244Z import logging 2025-01-24T00:45:37.4803736Z import os 2025-01-24T00:45:37.4804183Z import random 2025-01-24T00:45:37.4804641Z import re 2025-01-24T00:45:37.4805099Z import sys 2025-01-24T00:45:37.4805604Z from argparse import ArgumentParser 2025-01-24T00:45:37.4806234Z from functools import lru_cache 2025-01-24T00:45:37.4806833Z from logging import LogRecord 2025-01-24T00:45:37.4807684Z from typing import Any, Dict, FrozenSet, Iterable, List, NamedTuple, Set, Tuple 2025-01-24T00:45:37.4808614Z from urllib.request import Request, urlopen 2025-01-24T00:45:37.4809237Z  2025-01-24T00:45:37.4809640Z import yaml 2025-01-24T00:45:37.4810132Z from github import Auth, Github 2025-01-24T00:45:37.4810736Z from github.Issue import Issue 2025-01-24T00:45:37.4811446Z  2025-01-24T00:45:37.4811841Z  2025-01-24T00:45:37.4812340Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-01-24T00:45:37.4813350Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-01-24T00:45:37.4814382Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-01-24T00:45:37.4815208Z  2025-01-24T00:45:37.4815703Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-01-24T00:45:37.4816382Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-01-24T00:45:37.4817019Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-01-24T00:45:37.4817696Z OPT_OUT_LABEL = "no-runner-experiments" 2025-01-24T00:45:37.4818277Z  2025-01-24T00:45:37.4818730Z SETTING_EXPERIMENTS = "experiments" 2025-01-24T00:45:37.4819307Z  2025-01-24T00:45:37.4819720Z LF_FLEET_EXPERIMENT = "lf" 2025-01-24T00:45:37.4820276Z CANARY_FLEET_SUFFIX = ".c" 2025-01-24T00:45:37.4820800Z  2025-01-24T00:45:37.4821174Z  2025-01-24T00:45:37.4821723Z class Experiment(NamedTuple): 2025-01-24T00:45:37.4822317Z  rollout_perc: float = ( 2025-01-24T00:45:37.4823112Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-01-24T00:45:37.4823901Z  ) 2025-01-24T00:45:37.4824336Z  all_branches: bool = ( 2025-01-24T00:45:37.4825114Z  False # If True, the experiment is also enabled on the exception branches 2025-01-24T00:45:37.4825902Z  ) 2025-01-24T00:45:37.4826335Z  default: bool = ( 2025-01-24T00:45:37.4827043Z  True # If True, the experiment is enabled by default for all queries 2025-01-24T00:45:37.4827781Z  ) 2025-01-24T00:45:37.4828191Z  2025-01-24T00:45:37.4828610Z  # Add more fields as needed 2025-01-24T00:45:37.4829157Z  2025-01-24T00:45:37.4829543Z  2025-01-24T00:45:37.4829951Z class Settings(NamedTuple): 2025-01-24T00:45:37.4830491Z  """ 2025-01-24T00:45:37.4831064Z  Settings for the experiments that can be opted into. 2025-01-24T00:45:37.4831901Z  """ 2025-01-24T00:45:37.4832318Z  2025-01-24T00:45:37.4832780Z  experiments: Dict[str, Experiment] = {} 2025-01-24T00:45:37.4833397Z  2025-01-24T00:45:37.4833783Z  2025-01-24T00:45:37.4834387Z class ColorFormatter(logging.Formatter): 2025-01-24T00:45:37.4835173Z  """Color codes the log messages based on the log level""" 2025-01-24T00:45:37.4835861Z  2025-01-24T00:45:37.4836254Z  COLORS = { 2025-01-24T00:45:37.4836761Z  "WARNING": "\033[33m", # Yellow 2025-01-24T00:45:37.4837376Z  "ERROR": "\033[31m", # Red 2025-01-24T00:45:37.4837977Z  "CRITICAL": "\033[31m", # Red 2025-01-24T00:45:37.4838574Z  "INFO": "\033[0m", # Reset 2025-01-24T00:45:37.4839169Z  "DEBUG": "\033[0m", # Reset 2025-01-24T00:45:37.4839741Z  } 2025-01-24T00:45:37.4840140Z  2025-01-24T00:45:37.4840629Z  def format(self, record: LogRecord) -> str: 2025-01-24T00:45:37.4841640Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-01-24T00:45:37.4842575Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-01-24T00:45:37.4843277Z  return super().format(record) 2025-01-24T00:45:37.4843860Z  2025-01-24T00:45:37.4844243Z  2025-01-24T00:45:37.4844673Z handler = logging.StreamHandler() 2025-01-24T00:45:37.4845556Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-01-24T00:45:37.4846406Z  2025-01-24T00:45:37.4846930Z log = logging.getLogger(os.path.basename(__file__)) 2025-01-24T00:45:37.4847630Z log.addHandler(handler) 2025-01-24T00:45:37.4848185Z log.setLevel(logging.INFO) 2025-01-24T00:45:37.4848715Z  2025-01-24T00:45:37.4849240Z  2025-01-24T00:45:37.4849775Z def set_github_output(key: str, value: str) -> None: 2025-01-24T00:45:37.4850446Z  """ 2025-01-24T00:45:37.4851070Z  Defines outputs of the github action that invokes this script 2025-01-24T00:45:37.4851952Z  """ 2025-01-24T00:45:37.4852394Z  if not GITHUB_OUTPUT: 2025-01-24T00:45:37.4853695Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-01-24T00:45:37.4854991Z  log.warning( 2025-01-24T00:45:37.4856021Z  "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:37.4857104Z  ) 2025-01-24T00:45:37.4857631Z  print(f"::set-output name={key}::{value}") 2025-01-24T00:45:37.4858261Z  return 2025-01-24T00:45:37.4858725Z  2025-01-24T00:45:37.4859165Z  with open(GITHUB_OUTPUT, "a") as f: 2025-01-24T00:45:37.4859838Z  log.info(f"Setting output: {key}='{value}'") 2025-01-24T00:45:37.4860508Z  f.write(f"{key}={value}\n") 2025-01-24T00:45:37.4861073Z  2025-01-24T00:45:37.4861823Z  2025-01-24T00:45:37.4862434Z def _str_comma_separated_to_set(value: str) -> FrozenSet[str]: 2025-01-24T00:45:37.4863202Z  return frozenset( 2025-01-24T00:45:37.4863955Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-01-24T00:45:37.4864751Z  ) 2025-01-24T00:45:37.4865156Z  2025-01-24T00:45:37.4865528Z  2025-01-24T00:45:37.4865943Z def parse_args() -> Any: 2025-01-24T00:45:37.4866634Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-01-24T00:45:37.4867660Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-01-24T00:45:37.4868588Z  parser.add_argument( 2025-01-24T00:45:37.4869149Z  "--github-issue-repo", 2025-01-24T00:45:37.4869718Z  type=str, 2025-01-24T00:45:37.4870213Z  required=False, 2025-01-24T00:45:37.4870906Z  default="pytorch/test-infra", 2025-01-24T00:45:37.4871698Z  help="GitHub repo to get the issue", 2025-01-24T00:45:37.4872295Z  ) 2025-01-24T00:45:37.4872717Z  parser.add_argument( 2025-01-24T00:45:37.4873254Z  "--github-repo", 2025-01-24T00:45:37.4873777Z  type=str, 2025-01-24T00:45:37.4874260Z  required=True, 2025-01-24T00:45:37.4874834Z  help="GitHub repo where CI is running", 2025-01-24T00:45:37.4875473Z  ) 2025-01-24T00:45:37.4875901Z  parser.add_argument( 2025-01-24T00:45:37.4876660Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-01-24T00:45:37.4877434Z  ) 2025-01-24T00:45:37.4877851Z  parser.add_argument( 2025-01-24T00:45:37.4878620Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-01-24T00:45:37.4879421Z  ) 2025-01-24T00:45:37.4879859Z  parser.add_argument( 2025-01-24T00:45:37.4880656Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-01-24T00:45:37.4881554Z  ) 2025-01-24T00:45:37.4881986Z  parser.add_argument( 2025-01-24T00:45:37.4882809Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-01-24T00:45:37.4883634Z  ) 2025-01-24T00:45:37.4884065Z  parser.add_argument( 2025-01-24T00:45:37.4884606Z  "--github-ref-type", 2025-01-24T00:45:37.4885143Z  type=str, 2025-01-24T00:45:37.4885801Z  required=True, 2025-01-24T00:45:37.4886407Z  help="Current GitHub ref type, branch or tag", 2025-01-24T00:45:37.4887075Z  ) 2025-01-24T00:45:37.4887511Z  parser.add_argument( 2025-01-24T00:45:37.4888085Z  "--eligible-experiments", 2025-01-24T00:45:37.4888713Z  type=_str_comma_separated_to_set, 2025-01-24T00:45:37.4889316Z  required=False, 2025-01-24T00:45:37.4889839Z  default="", 2025-01-24T00:45:37.4890871Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-01-24T00:45:37.4892059Z  ) 2025-01-24T00:45:37.4892496Z  parser.add_argument( 2025-01-24T00:45:37.4893026Z  "--pr-number", 2025-01-24T00:45:37.4893538Z  type=str, 2025-01-24T00:45:37.4894033Z  required=False, 2025-01-24T00:45:37.4894554Z  default="", 2025-01-24T00:45:37.4895155Z  help="the optional PR number where this is run", 2025-01-24T00:45:37.4895802Z  ) 2025-01-24T00:45:37.4896195Z  2025-01-24T00:45:37.4896614Z  return parser.parse_args() 2025-01-24T00:45:37.4897176Z  2025-01-24T00:45:37.4897556Z  2025-01-24T00:45:37.4898046Z def get_gh_client(github_token: str) -> Github: 2025-01-24T00:45:37.4898731Z  auth = Auth.Token(github_token) 2025-01-24T00:45:37.4899311Z  return Github(auth=auth) 2025-01-24T00:45:37.4899840Z  2025-01-24T00:45:37.4900215Z  2025-01-24T00:45:37.4900784Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: 2025-01-24T00:45:37.4901637Z  repo = gh.get_repo(repo) 2025-01-24T00:45:37.4902254Z  return repo.get_issue(number=issue_num) 2025-01-24T00:45:37.4902905Z  2025-01-24T00:45:37.4903284Z  2025-01-24T00:45:37.4903706Z def get_potential_pr_author( 2025-01-24T00:45:37.4904482Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-01-24T00:45:37.4905270Z ) -> str: 2025-01-24T00:45:37.4905896Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-01-24T00:45:37.4906968Z  # Fetch the actual username from the original PR. The PR number is 2025-01-24T00:45:37.4907858Z  # embedded in the tag name: ciflow// 2025-01-24T00:45:37.4908511Z  2025-01-24T00:45:37.4908935Z  gh = get_gh_client(github_token) 2025-01-24T00:45:37.4909491Z  2025-01-24T00:45:37.4910025Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-01-24T00:45:37.4910773Z  split_tag = ref_name.split("/") 2025-01-24T00:45:37.4911454Z  if ( 2025-01-24T00:45:37.4911928Z  len(split_tag) == 3 2025-01-24T00:45:37.4912526Z  and split_tag[0] == "ciflow" 2025-01-24T00:45:37.4913147Z  and split_tag[2].isnumeric() 2025-01-24T00:45:37.4913719Z  ): 2025-01-24T00:45:37.4914197Z  pr_number = split_tag[2] 2025-01-24T00:45:37.4914768Z  try: 2025-01-24T00:45:37.4915302Z  repository = gh.get_repo(repo) 2025-01-24T00:45:37.4916020Z  pull = repository.get_pull(number=int(pr_number)) 2025-01-24T00:45:37.4916748Z  except Exception as e: 2025-01-24T00:45:37.4917379Z  raise Exception( # noqa: TRY002 2025-01-24T00:45:37.4918177Z  f"issue with pull request {pr_number} from repo {repository}" 2025-01-24T00:45:37.4918922Z  ) from e 2025-01-24T00:45:37.4919484Z  return pull.user.login 2025-01-24T00:45:37.4920191Z  # In all other cases, return the original input username 2025-01-24T00:45:37.4921015Z  return username 2025-01-24T00:45:37.4921611Z  2025-01-24T00:45:37.4921991Z  2025-01-24T00:45:37.4922458Z def is_exception_branch(branch: str) -> bool: 2025-01-24T00:45:37.4923072Z  """ 2025-01-24T00:45:37.4923862Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-01-24T00:45:37.4924761Z  """ 2025-01-24T00:45:37.4925404Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-01-24T00:45:37.4926177Z  2025-01-24T00:45:37.4926548Z  2025-01-24T00:45:37.4926978Z def load_yaml(yaml_text: str) -> Any: 2025-01-24T00:45:37.4927552Z  try: 2025-01-24T00:45:37.4928007Z  data = yaml.safe_load(yaml_text) 2025-01-24T00:45:37.4928597Z  return data 2025-01-24T00:45:37.4929111Z  except yaml.YAMLError: 2025-01-24T00:45:37.4929714Z  log.exception("Error loading YAML") 2025-01-24T00:45:37.4930315Z  raise 2025-01-24T00:45:37.4930759Z  2025-01-24T00:45:37.4931131Z  2025-01-24T00:45:37.4931949Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> Tuple[str, str]: 2025-01-24T00:45:37.4932832Z  """ 2025-01-24T00:45:37.4933573Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-01-24T00:45:37.4934437Z  2025-01-24T00:45:37.4935058Z  If the issue body contains "---" then the text above that is the settings 2025-01-24T00:45:37.4935949Z  and the text below is the list of opted in users. 2025-01-24T00:45:37.4936583Z  2025-01-24T00:45:37.4937237Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-01-24T00:45:37.4938045Z  """ 2025-01-24T00:45:37.4938573Z  rollout_state_parts = rollout_state.split("---") 2025-01-24T00:45:37.4939262Z  if len(rollout_state_parts) >= 2: 2025-01-24T00:45:37.4939983Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-01-24T00:45:37.4940663Z  else: 2025-01-24T00:45:37.4941335Z  return "", rollout_state 2025-01-24T00:45:37.4941909Z  2025-01-24T00:45:37.4942277Z  2025-01-24T00:45:37.4942729Z class UserOptins(Dict[str, List[str]]): 2025-01-24T00:45:37.4943324Z  """ 2025-01-24T00:45:37.4943941Z  Dictionary of users with a list of features they have opted into 2025-01-24T00:45:37.4944680Z  """ 2025-01-24T00:45:37.4945078Z  2025-01-24T00:45:37.4945439Z  2025-01-24T00:45:37.4946094Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-01-24T00:45:37.4946858Z  """ 2025-01-24T00:45:37.4947697Z  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:37.4948679Z  2025-01-24T00:45:37.4949611Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-01-24T00:45:37.4950780Z  - Example line: "@User1,lf,split_build" 2025-01-24T00:45:37.4951679Z  - A "#" prefix indicates the user is opted out of all experiments 2025-01-24T00:45:37.4952412Z  2025-01-24T00:45:37.4952781Z  2025-01-24T00:45:37.4953139Z  """ 2025-01-24T00:45:37.4953568Z  optins = UserOptins() 2025-01-24T00:45:37.4954149Z  for user in user_optin_text.split("\n"): 2025-01-24T00:45:37.4954799Z  user = user.strip("\r\n\t -") 2025-01-24T00:45:37.4955445Z  if not user or not user.startswith("@"): 2025-01-24T00:45:37.4956088Z  # Not a valid user. Skip 2025-01-24T00:45:37.4956790Z  continue 2025-01-24T00:45:37.4957269Z  2025-01-24T00:45:37.4957654Z  if user: 2025-01-24T00:45:37.4958194Z  usr_name = user.split(",")[0].strip("@") 2025-01-24T00:45:37.4959009Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-01-24T00:45:37.4959744Z  2025-01-24T00:45:37.4960124Z  return optins 2025-01-24T00:45:37.4960591Z  2025-01-24T00:45:37.4960960Z  2025-01-24T00:45:37.4961614Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-01-24T00:45:37.4962325Z  """ 2025-01-24T00:45:37.4962794Z  Check if the experiment name is valid. 2025-01-24T00:45:37.4963385Z  A valid name: 2025-01-24T00:45:37.4964179Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-01-24T00:45:37.4965278Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-01-24T00:45:37.4966108Z  - Cannot contain spaces 2025-01-24T00:45:37.4966656Z  """ 2025-01-24T00:45:37.4967055Z  2025-01-24T00:45:37.4967565Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-01-24T00:45:37.4968398Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-01-24T00:45:37.4969088Z  2025-01-24T00:45:37.4969461Z  if valid: 2025-01-24T00:45:37.4969917Z  return True 2025-01-24T00:45:37.4970382Z  2025-01-24T00:45:37.4970748Z  log.error( 2025-01-24T00:45:37.4972540Z  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:37.4974311Z  ) 2025-01-24T00:45:37.4974724Z  return False 2025-01-24T00:45:37.4975180Z  2025-01-24T00:45:37.4975543Z  2025-01-24T00:45:37.4976119Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-01-24T00:45:37.4976843Z  """ 2025-01-24T00:45:37.4977663Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-01-24T00:45:37.4978481Z  """ 2025-01-24T00:45:37.4978879Z  try: 2025-01-24T00:45:37.4979297Z  if settings_text: 2025-01-24T00:45:37.4980158Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-01-24T00:45:37.4981074Z  # for easy reading 2025-01-24T00:45:37.4982126Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-01-24T00:45:37.4983170Z  # the backtick character in shell commands. 2025-01-24T00:45:37.4983880Z  backtick = chr(96) # backtick character 2025-01-24T00:45:37.4984662Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-01-24T00:45:37.4985439Z  settings = load_yaml(settings_text) 2025-01-24T00:45:37.4986015Z  2025-01-24T00:45:37.4986730Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-01-24T00:45:37.4987577Z  experiments = {} 2025-01-24T00:45:37.4988093Z  2025-01-24T00:45:37.4988730Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-01-24T00:45:37.4989609Z  if not is_valid_experiment_name(exp_name): 2025-01-24T00:45:37.4990889Z  # 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:37.4992336Z  continue 2025-01-24T00:45:37.4992862Z  2025-01-24T00:45:37.4993274Z  valid_settings = {} 2025-01-24T00:45:37.4993882Z  for setting in exp_settings: 2025-01-24T00:45:37.4994550Z  if setting not in Experiment._fields: 2025-01-24T00:45:37.4995192Z  log.warning( 2025-01-24T00:45:37.4996018Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-01-24T00:45:37.4996832Z  ) 2025-01-24T00:45:37.4997339Z  else: 2025-01-24T00:45:37.4997952Z  valid_settings[setting] = exp_settings[setting] 2025-01-24T00:45:37.4998603Z  2025-01-24T00:45:37.4999137Z  experiments[exp_name] = Experiment(**valid_settings) 2025-01-24T00:45:37.4999881Z  return Settings(experiments) 2025-01-24T00:45:37.5000451Z  2025-01-24T00:45:37.5000841Z  except Exception: 2025-01-24T00:45:37.5001525Z  log.exception("Failed to parse settings") 2025-01-24T00:45:37.5002150Z  2025-01-24T00:45:37.5002538Z  return Settings() 2025-01-24T00:45:37.5003031Z  2025-01-24T00:45:37.5003396Z  2025-01-24T00:45:37.5003906Z def parse_settings(rollout_state: str) -> Settings: 2025-01-24T00:45:37.5004555Z  """ 2025-01-24T00:45:37.5005069Z  Parse settings, if any, from the rollout state. 2025-01-24T00:45:37.5005698Z  2025-01-24T00:45:37.5006309Z  If the issue body contains "---" then the text above that is the settings 2025-01-24T00:45:37.5007194Z  and the text below is the list of opted in users. 2025-01-24T00:45:37.5007822Z  2025-01-24T00:45:37.5008507Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-01-24T00:45:37.5009360Z  """ 2025-01-24T00:45:37.5010025Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-01-24T00:45:37.5010911Z  return parse_settings_from_text(settings_text) 2025-01-24T00:45:37.5011637Z  2025-01-24T00:45:37.5012267Z  2025-01-24T00:45:37.5012790Z def parse_users(rollout_state: str) -> UserOptins: 2025-01-24T00:45:37.5013434Z  """ 2025-01-24T00:45:37.5013893Z  Parse users from the rollout state. 2025-01-24T00:45:37.5014472Z  2025-01-24T00:45:37.5014839Z  """ 2025-01-24T00:45:37.5015474Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-01-24T00:45:37.5016352Z  return parse_user_opt_in_from_text(users_text) 2025-01-24T00:45:37.5016963Z  2025-01-24T00:45:37.5017336Z  2025-01-24T00:45:37.5018049Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-01-24T00:45:37.5018910Z  """ 2025-01-24T00:45:37.5019404Z  Check if a user is opted into an experiment 2025-01-24T00:45:37.5020016Z  """ 2025-01-24T00:45:37.5020569Z  return experiment_name in user_optins.get(user, []) 2025-01-24T00:45:37.5021341Z  2025-01-24T00:45:37.5021716Z  2025-01-24T00:45:37.5022423Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-01-24T00:45:37.5023298Z  """ 2025-01-24T00:45:37.5023852Z  Check if a user explicitly opted out of an experiment 2025-01-24T00:45:37.5024510Z  """ 2025-01-24T00:45:37.5025110Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-01-24T00:45:37.5025923Z  experiment_optout = "-" + experiment_name 2025-01-24T00:45:37.5026664Z  if experiment_optout not in user_optins.get(user, []): 2025-01-24T00:45:37.5027491Z  return False 2025-01-24T00:45:37.5027967Z  2025-01-24T00:45:37.5028492Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-01-24T00:45:37.5029175Z  log.warning( 2025-01-24T00:45:37.5030136Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-01-24T00:45:37.5031146Z  ) 2025-01-24T00:45:37.5031659Z  2025-01-24T00:45:37.5032042Z  return True 2025-01-24T00:45:37.5032495Z  2025-01-24T00:45:37.5032855Z  2025-01-24T00:45:37.5033251Z def get_runner_prefix( 2025-01-24T00:45:37.5033764Z  rollout_state: str, 2025-01-24T00:45:37.5034324Z  workflow_requestors: Iterable[str], 2025-01-24T00:45:37.5034911Z  branch: str, 2025-01-24T00:45:37.5035520Z  eligible_experiments: FrozenSet[str] = frozenset(), 2025-01-24T00:45:37.5036212Z  is_canary: bool = False, 2025-01-24T00:45:37.5036739Z ) -> str: 2025-01-24T00:45:37.5037236Z  settings = parse_settings(rollout_state) 2025-01-24T00:45:37.5037913Z  user_optins = parse_users(rollout_state) 2025-01-24T00:45:37.5038512Z  2025-01-24T00:45:37.5038902Z  fleet_prefix = "" 2025-01-24T00:45:37.5039404Z  prefixes = [] 2025-01-24T00:45:37.5040176Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-01-24T00:45:37.5041388Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-01-24T00:45:37.5042214Z  log.info( 2025-01-24T00:45:37.5043029Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-01-24T00:45:37.5043904Z  ) 2025-01-24T00:45:37.5044364Z  continue 2025-01-24T00:45:37.5044846Z  2025-01-24T00:45:37.5045260Z  if eligible_experiments: 2025-01-24T00:45:37.5045928Z  if experiment_name not in eligible_experiments: 2025-01-24T00:45:37.5046663Z  exp_list = ", ".join(eligible_experiments) 2025-01-24T00:45:37.5047425Z  log.info( 2025-01-24T00:45:37.5048363Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-01-24T00:45:37.5049318Z  ) 2025-01-24T00:45:37.5049786Z  continue 2025-01-24T00:45:37.5050355Z  elif not experiment_settings.default: 2025-01-24T00:45:37.5050946Z  log.info( 2025-01-24T00:45:37.5051836Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-01-24T00:45:37.5052669Z  ) 2025-01-24T00:45:37.5053117Z  continue 2025-01-24T00:45:37.5053587Z  2025-01-24T00:45:37.5054124Z  # Is any workflow_requestor opted out to this experiment? 2025-01-24T00:45:37.5054831Z  opted_out_users = [ 2025-01-24T00:45:37.5055382Z  requestor 2025-01-24T00:45:37.5055949Z  for requestor in workflow_requestors 2025-01-24T00:45:37.5056737Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-01-24T00:45:37.5057477Z  ] 2025-01-24T00:45:37.5057901Z  2025-01-24T00:45:37.5058292Z  if opted_out_users: 2025-01-24T00:45:37.5058836Z  log.info( 2025-01-24T00:45:37.5059591Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-01-24T00:45:37.5060425Z  ) 2025-01-24T00:45:37.5060926Z  continue 2025-01-24T00:45:37.5061686Z  2025-01-24T00:45:37.5062259Z  # Is any workflow_requestor opted in to this experiment? 2025-01-24T00:45:37.5063013Z  opted_in_users = [ 2025-01-24T00:45:37.5063591Z  requestor 2025-01-24T00:45:37.5064196Z  for requestor in workflow_requestors 2025-01-24T00:45:37.5065034Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-01-24T00:45:37.5065796Z  ] 2025-01-24T00:45:37.5066253Z  2025-01-24T00:45:37.5066690Z  enabled = False 2025-01-24T00:45:37.5067270Z  if opted_in_users: 2025-01-24T00:45:37.5067840Z  log.info( 2025-01-24T00:45:37.5068593Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-01-24T00:45:37.5069363Z  ) 2025-01-24T00:45:37.5069811Z  enabled = True 2025-01-24T00:45:37.5070329Z  2025-01-24T00:45:37.5070775Z  elif experiment_settings.rollout_perc: 2025-01-24T00:45:37.5071831Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-01-24T00:45:37.5072927Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-01-24T00:45:37.5073664Z  log.info( 2025-01-24T00:45:37.5074693Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-01-24T00:45:37.5075739Z  ) 2025-01-24T00:45:37.5076225Z  enabled = True 2025-01-24T00:45:37.5076752Z  2025-01-24T00:45:37.5077241Z  if enabled: 2025-01-24T00:45:37.5077764Z  label = experiment_name 2025-01-24T00:45:37.5078414Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-01-24T00:45:37.5079366Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-01-24T00:45:37.5080398Z  # - If it's enabled, then we always list it's prefix first 2025-01-24T00:45:37.5081512Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-01-24T00:45:37.5082297Z  if is_canary: 2025-01-24T00:45:37.5082894Z  label += CANARY_FLEET_SUFFIX 2025-01-24T00:45:37.5083515Z  fleet_prefix = label 2025-01-24T00:45:37.5084083Z  else: 2025-01-24T00:45:37.5084600Z  prefixes.append(label) 2025-01-24T00:45:37.5085171Z  2025-01-24T00:45:37.5085573Z  if len(prefixes) > 1: 2025-01-24T00:45:37.5086097Z  log.error( 2025-01-24T00:45:37.5087353Z  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:37.5088626Z  ) 2025-01-24T00:45:37.5089069Z  prefixes = prefixes[:1] 2025-01-24T00:45:37.5089614Z  2025-01-24T00:45:37.5090022Z  # Fleet always comes first 2025-01-24T00:45:37.5090584Z  if fleet_prefix: 2025-01-24T00:45:37.5091123Z  prefixes.insert(0, fleet_prefix) 2025-01-24T00:45:37.5091802Z  2025-01-24T00:45:37.5092297Z  return ".".join(prefixes) + "." if prefixes else "" 2025-01-24T00:45:37.5092941Z  2025-01-24T00:45:37.5093310Z  2025-01-24T00:45:37.5094033Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-01-24T00:45:37.5094919Z  """ 2025-01-24T00:45:37.5095619Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-01-24T00:45:37.5096573Z  2025-01-24T00:45:37.5097235Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-01-24T00:45:37.5098043Z  """ 2025-01-24T00:45:37.5098488Z  gh = get_gh_client(github_token) 2025-01-24T00:45:37.5099132Z  issue = get_issue(gh, repo, issue_num) 2025-01-24T00:45:37.5099887Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-01-24T00:45:37.5100561Z  2025-01-24T00:45:37.5100933Z  2025-01-24T00:45:37.5101719Z def download_json(url: str, headers: Dict[str, str], num_retries: int = 3) -> Any: 2025-01-24T00:45:37.5102901Z  for _ in range(num_retries): 2025-01-24T00:45:37.5103751Z  try: 2025-01-24T00:45:37.5104617Z  req = Request(url=url, headers=headers) 2025-01-24T00:45:37.5105395Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-01-24T00:45:37.5106125Z  return json.loads(content) 2025-01-24T00:45:37.5106742Z  except Exception as e: 2025-01-24T00:45:37.5107394Z  log.warning(f"Could not download {url}: {e}") 2025-01-24T00:45:37.5108110Z  2025-01-24T00:45:37.5108762Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-01-24T00:45:37.5109589Z  return {} 2025-01-24T00:45:37.5110023Z  2025-01-24T00:45:37.5110395Z  2025-01-24T00:45:37.5110791Z @lru_cache(maxsize=None) 2025-01-24T00:45:37.5111760Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> Dict[str, Any]: 2025-01-24T00:45:37.5112615Z  """ 2025-01-24T00:45:37.5113060Z  Dynamically get PR information 2025-01-24T00:45:37.5113606Z  """ 2025-01-24T00:45:37.5114213Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-01-24T00:45:37.5177255Z  headers = { 2025-01-24T00:45:37.5178540Z  "Accept": "application/vnd.github.v3+json", 2025-01-24T00:45:37.5179980Z  "Authorization": f"token {github_token}", 2025-01-24T00:45:37.5180828Z  } 2025-01-24T00:45:37.5181596Z  json_response: Dict[str, Any] = download_json( 2025-01-24T00:45:37.5182577Z  url=f"{github_api}/issues/{pr_number}", 2025-01-24T00:45:37.5183234Z  headers=headers, 2025-01-24T00:45:37.5183732Z  ) 2025-01-24T00:45:37.5184121Z  2025-01-24T00:45:37.5184509Z  if not json_response: 2025-01-24T00:45:37.5185197Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-01-24T00:45:37.5185915Z  return {} 2025-01-24T00:45:37.5186364Z  2025-01-24T00:45:37.5186782Z  return json_response 2025-01-24T00:45:37.5187276Z  2025-01-24T00:45:37.5187632Z  2025-01-24T00:45:37.5188286Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> Set[str]: 2025-01-24T00:45:37.5189101Z  """ 2025-01-24T00:45:37.5189731Z  Dynamically get the latest list of labels from the pull request 2025-01-24T00:45:37.5190443Z  """ 2025-01-24T00:45:37.5191001Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-01-24T00:45:37.5191877Z  return { 2025-01-24T00:45:37.5192536Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-01-24T00:45:37.5193290Z  } 2025-01-24T00:45:37.5193678Z  2025-01-24T00:45:37.5194034Z  2025-01-24T00:45:37.5194443Z def main() -> None: 2025-01-24T00:45:37.5194944Z  args = parse_args() 2025-01-24T00:45:37.5195422Z  2025-01-24T00:45:37.5195883Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-01-24T00:45:37.5196479Z  2025-01-24T00:45:37.5196889Z  # Check if the PR is opt-out 2025-01-24T00:45:37.5197714Z  if args.pr_number: 2025-01-24T00:45:37.5198535Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-01-24T00:45:37.5199396Z  if OPT_OUT_LABEL in labels: 2025-01-24T00:45:37.5199948Z  log.info( 2025-01-24T00:45:37.5200755Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-01-24T00:45:37.5201806Z  ) 2025-01-24T00:45:37.5202454Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-01-24T00:45:37.5203197Z  sys.exit() 2025-01-24T00:45:37.5203669Z  2025-01-24T00:45:37.5204037Z  try: 2025-01-24T00:45:37.5204544Z  rollout_state = get_rollout_state_from_issue( 2025-01-24T00:45:37.5205338Z  args.github_token, args.github_issue_repo, args.github_issue 2025-01-24T00:45:37.5206066Z  ) 2025-01-24T00:45:37.5206508Z  2025-01-24T00:45:37.5206944Z  username = get_potential_pr_author( 2025-01-24T00:45:37.5207550Z  args.github_token, 2025-01-24T00:45:37.5208106Z  args.github_repo, 2025-01-24T00:45:37.5208660Z  args.github_actor, 2025-01-24T00:45:37.5209223Z  args.github_ref_type, 2025-01-24T00:45:37.5209796Z  args.github_branch, 2025-01-24T00:45:37.5210322Z  ) 2025-01-24T00:45:37.5210723Z  2025-01-24T00:45:37.5211500Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-01-24T00:45:37.5212187Z  2025-01-24T00:45:37.5212634Z  runner_label_prefix = get_runner_prefix( 2025-01-24T00:45:37.5213253Z  rollout_state, 2025-01-24T00:45:37.5213821Z  (args.github_issue_owner, username), 2025-01-24T00:45:37.5214430Z  args.github_branch, 2025-01-24T00:45:37.5215004Z  args.eligible_experiments, 2025-01-24T00:45:37.5215573Z  is_canary, 2025-01-24T00:45:37.5216045Z  ) 2025-01-24T00:45:37.5216447Z  2025-01-24T00:45:37.5216837Z  except Exception as e: 2025-01-24T00:45:37.5217515Z  log.error( 2025-01-24T00:45:37.5218328Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-01-24T00:45:37.5219162Z  ) 2025-01-24T00:45:37.5219564Z  2025-01-24T00:45:37.5220156Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-01-24T00:45:37.5220880Z  2025-01-24T00:45:37.5221477Z  2025-01-24T00:45:37.5221887Z if __name__ == "__main__": 2025-01-24T00:45:37.5222400Z  main() 2025-01-24T00:45:37.5222800Z  2025-01-24T00:45:37.5223181Z EOF 2025-01-24T00:45:37.5223559Z  2025-01-24T00:45:37.5223953Z cat runner_determinator.py 2025-01-24T00:45:37.5475901Z shell: /usr/bin/bash -e {0} 2025-01-24T00:45:37.5476721Z env: 2025-01-24T00:45:37.5477450Z GITHUB_TOKEN: *** 2025-01-24T00:45:37.5477893Z ISSUE_NUMBER: 5132 2025-01-24T00:45:37.5478390Z TRIGGERING_ACTOR: facebook-github-bot 2025-01-24T00:45:37.5478954Z ISSUE_OWNER: yushangdi 2025-01-24T00:45:37.5479418Z CHECK_EXPERIMENTS: 2025-01-24T00:45:37.5479860Z PR_NUMBER: 145539 2025-01-24T00:45:37.5480285Z ##[endgroup] 2025-01-24T00:45:37.5687832Z # flake8: noqa: G004 2025-01-24T00:45:37.5688217Z 2025-01-24T00:45:37.5688681Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-01-24T00:45:37.5689760Z # must be kept in sync. You can do it easily by running the following command: 2025-01-24T00:45:37.5690607Z # python .github/scripts/update_runner_determinator.py 2025-01-24T00:45:37.5691079Z 2025-01-24T00:45:37.5691919Z """ 2025-01-24T00:45:37.5692554Z This runner determinator is used to determine which set of runners to run a 2025-01-24T00:45:37.5693482Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-01-24T00:45:37.5694433Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-01-24T00:45:37.5695293Z of which runners should be used to run which job. 2025-01-24T00:45:37.5695739Z 2025-01-24T00:45:37.5696145Z The configuration has two parts, the settings and a list of opted-in users, 2025-01-24T00:45:37.5697094Z separated by a line containing "---". If the line is not present, the 2025-01-24T00:45:37.5698015Z settings are considered to be empty with only the second part, the user 2025-01-24T00:45:37.5698739Z list, defined. 2025-01-24T00:45:37.5698969Z 2025-01-24T00:45:37.5699361Z The first part is a YAML block that defines the rollout settings. This can be 2025-01-24T00:45:37.5700319Z used to define any settings that are needed to determine which runners to use. 2025-01-24T00:45:37.5701458Z It's fields are defined by the RolloutSettings class below. 2025-01-24T00:45:37.5702017Z 2025-01-24T00:45:37.5702410Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-01-24T00:45:37.5703334Z The user list is also a comma separated list of additional features or 2025-01-24T00:45:37.5704163Z experiments which the user could be opted in to. 2025-01-24T00:45:37.5704609Z 2025-01-24T00:45:37.5704813Z The user list has the following rules: 2025-01-24T00:45:37.5705180Z 2025-01-24T00:45:37.5705517Z - Users are GitHub usernames, which must start with the @ prefix 2025-01-24T00:45:37.5706431Z - Each user is also a comma-separated list of features/experiments to enable 2025-01-24T00:45:37.5707244Z - A "#" prefix opts the user out of all experiments 2025-01-24T00:45:37.5707658Z 2025-01-24T00:45:37.5707838Z Example config: 2025-01-24T00:45:37.5708296Z # A list of experiments that can be opted into. 2025-01-24T00:45:37.5709006Z # This defines the behavior they'll induce when opted into. 2025-01-24T00:45:37.5709686Z # Expected syntax is: 2025-01-24T00:45:37.5710365Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-01-24T00:45:37.5711608Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-01-24T00:45:37.5712447Z 2025-01-24T00:45:37.5712647Z experiments: 2025-01-24T00:45:37.5713059Z lf: 2025-01-24T00:45:37.5713451Z rollout_percent: 25 2025-01-24T00:45:37.5713927Z all_branches: false 2025-01-24T00:45:37.5714383Z default: true 2025-01-24T00:45:37.5714802Z --- 2025-01-24T00:45:37.5715000Z 2025-01-24T00:45:37.5715174Z # Opt-ins: 2025-01-24T00:45:37.5715779Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-01-24T00:45:37.5716708Z # and specifying experiments to enable in a comma-separated list. 2025-01-24T00:45:37.5717525Z # To always opt out of an experiment, prefix it with a "-". 2025-01-24T00:45:37.5718231Z # Experiments should be from the above list. 2025-01-24T00:45:37.5718640Z 2025-01-24T00:45:37.5718822Z @User1,-lf,split_build 2025-01-24T00:45:37.5719276Z @User2,lf 2025-01-24T00:45:37.5719665Z @User3,split_build 2025-01-24T00:45:37.5720088Z """ 2025-01-24T00:45:37.5720276Z 2025-01-24T00:45:37.5720456Z import json 2025-01-24T00:45:37.5720832Z import logging 2025-01-24T00:45:37.5721410Z import os 2025-01-24T00:45:37.5721807Z import random 2025-01-24T00:45:37.5722184Z import re 2025-01-24T00:45:37.5722557Z import sys 2025-01-24T00:45:37.5722955Z from argparse import ArgumentParser 2025-01-24T00:45:37.5723496Z from functools import lru_cache 2025-01-24T00:45:37.5724001Z from logging import LogRecord 2025-01-24T00:45:37.5724747Z from typing import Any, Dict, FrozenSet, Iterable, List, NamedTuple, Set, Tuple 2025-01-24T00:45:37.5725570Z from urllib.request import Request, urlopen 2025-01-24T00:45:37.5725967Z 2025-01-24T00:45:37.5726300Z import yaml 2025-01-24T00:45:37.5726702Z from github import Auth, Github 2025-01-24T00:45:37.5727201Z from github.Issue import Issue 2025-01-24T00:45:37.5727524Z 2025-01-24T00:45:37.5727533Z 2025-01-24T00:45:37.5727753Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-01-24T00:45:37.5728492Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-01-24T00:45:37.5729413Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-01-24T00:45:37.5730025Z 2025-01-24T00:45:37.5730261Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-01-24T00:45:37.5730857Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-01-24T00:45:37.5731651Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-01-24T00:45:37.5732250Z OPT_OUT_LABEL = "no-runner-experiments" 2025-01-24T00:45:37.5732629Z 2025-01-24T00:45:37.5732831Z SETTING_EXPERIMENTS = "experiments" 2025-01-24T00:45:37.5733181Z 2025-01-24T00:45:37.5733368Z LF_FLEET_EXPERIMENT = "lf" 2025-01-24T00:45:37.5733852Z CANARY_FLEET_SUFFIX = ".c" 2025-01-24T00:45:37.5734159Z 2025-01-24T00:45:37.5734166Z 2025-01-24T00:45:37.5734364Z class Experiment(NamedTuple): 2025-01-24T00:45:37.5734855Z rollout_perc: float = ( 2025-01-24T00:45:37.5735522Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-01-24T00:45:37.5736243Z ) 2025-01-24T00:45:37.5736609Z all_branches: bool = ( 2025-01-24T00:45:37.5737258Z False # If True, the experiment is also enabled on the exception branches 2025-01-24T00:45:37.5737975Z ) 2025-01-24T00:45:37.5738333Z default: bool = ( 2025-01-24T00:45:37.5738921Z True # If True, the experiment is enabled by default for all queries 2025-01-24T00:45:37.5739594Z ) 2025-01-24T00:45:37.5739785Z 2025-01-24T00:45:37.5739963Z # Add more fields as needed 2025-01-24T00:45:37.5740278Z 2025-01-24T00:45:37.5740285Z 2025-01-24T00:45:37.5740471Z class Settings(NamedTuple): 2025-01-24T00:45:37.5740935Z """ 2025-01-24T00:45:37.5741609Z Settings for the experiments that can be opted into. 2025-01-24T00:45:37.5742240Z """ 2025-01-24T00:45:37.5742436Z 2025-01-24T00:45:37.5742653Z experiments: Dict[str, Experiment] = {} 2025-01-24T00:45:37.5743036Z 2025-01-24T00:45:37.5743044Z 2025-01-24T00:45:37.5743262Z class ColorFormatter(logging.Formatter): 2025-01-24T00:45:37.5744058Z """Color codes the log messages based on the log level""" 2025-01-24T00:45:37.5744541Z 2025-01-24T00:45:37.5744708Z COLORS = { 2025-01-24T00:45:37.5745120Z "WARNING": "\033[33m", # Yellow 2025-01-24T00:45:37.5745644Z "ERROR": "\033[31m", # Red 2025-01-24T00:45:37.5746146Z "CRITICAL": "\033[31m", # Red 2025-01-24T00:45:37.5746660Z "INFO": "\033[0m", # Reset 2025-01-24T00:45:37.5747149Z "DEBUG": "\033[0m", # Reset 2025-01-24T00:45:37.5747634Z } 2025-01-24T00:45:37.5747823Z 2025-01-24T00:45:37.5748055Z def format(self, record: LogRecord) -> str: 2025-01-24T00:45:37.5748845Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-01-24T00:45:37.5749673Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-01-24T00:45:37.5750297Z return super().format(record) 2025-01-24T00:45:37.5750648Z 2025-01-24T00:45:37.5750655Z 2025-01-24T00:45:37.5750849Z handler = logging.StreamHandler() 2025-01-24T00:45:37.5751843Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-01-24T00:45:37.5752453Z 2025-01-24T00:45:37.5752714Z log = logging.getLogger(os.path.basename(__file__)) 2025-01-24T00:45:37.5753317Z log.addHandler(handler) 2025-01-24T00:45:37.5753770Z log.setLevel(logging.INFO) 2025-01-24T00:45:37.5754068Z 2025-01-24T00:45:37.5754075Z 2025-01-24T00:45:37.5754331Z def set_github_output(key: str, value: str) -> None: 2025-01-24T00:45:37.5754920Z """ 2025-01-24T00:45:37.5755435Z Defines outputs of the github action that invokes this script 2025-01-24T00:45:37.5756102Z """ 2025-01-24T00:45:37.5756459Z if not GITHUB_OUTPUT: 2025-01-24T00:45:37.5757597Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-01-24T00:45:37.5758950Z log.warning( 2025-01-24T00:45:37.5759851Z "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:37.5760852Z ) 2025-01-24T00:45:37.5770599Z print(f"::set-output name={key}::{value}") 2025-01-24T00:45:37.5771504Z return 2025-01-24T00:45:37.5771899Z 2025-01-24T00:45:37.5772110Z with open(GITHUB_OUTPUT, "a") as f: 2025-01-24T00:45:37.5772712Z log.info(f"Setting output: {key}='{value}'") 2025-01-24T00:45:37.5773292Z f.write(f"{key}={value}\n") 2025-01-24T00:45:37.5773637Z 2025-01-24T00:45:37.5773645Z 2025-01-24T00:45:37.5773965Z def _str_comma_separated_to_set(value: str) -> FrozenSet[str]: 2025-01-24T00:45:37.5774627Z return frozenset( 2025-01-24T00:45:37.5775258Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-01-24T00:45:37.5775992Z ) 2025-01-24T00:45:37.5776193Z 2025-01-24T00:45:37.5776201Z 2025-01-24T00:45:37.5776387Z def parse_args() -> Any: 2025-01-24T00:45:37.5776964Z parser = ArgumentParser("Get dynamic rollout settings") 2025-01-24T00:45:37.5777872Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-01-24T00:45:37.5778683Z parser.add_argument( 2025-01-24T00:45:37.5779145Z "--github-issue-repo", 2025-01-24T00:45:37.5779610Z type=str, 2025-01-24T00:45:37.5780016Z required=False, 2025-01-24T00:45:37.5780470Z default="pytorch/test-infra", 2025-01-24T00:45:37.5781025Z help="GitHub repo to get the issue", 2025-01-24T00:45:37.5781890Z ) 2025-01-24T00:45:37.5782269Z parser.add_argument( 2025-01-24T00:45:37.5782720Z "--github-repo", 2025-01-24T00:45:37.5783143Z type=str, 2025-01-24T00:45:37.5783536Z required=True, 2025-01-24T00:45:37.5784032Z help="GitHub repo where CI is running", 2025-01-24T00:45:37.5784578Z ) 2025-01-24T00:45:37.5784939Z parser.add_argument( 2025-01-24T00:45:37.5785570Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-01-24T00:45:37.5786258Z ) 2025-01-24T00:45:37.5786615Z parser.add_argument( 2025-01-24T00:45:37.5787449Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-01-24T00:45:37.5788188Z ) 2025-01-24T00:45:37.5788549Z parser.add_argument( 2025-01-24T00:45:37.5789243Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-01-24T00:45:37.5790471Z ) 2025-01-24T00:45:37.5791339Z parser.add_argument( 2025-01-24T00:45:37.5792543Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-01-24T00:45:37.5793937Z ) 2025-01-24T00:45:37.5794505Z parser.add_argument( 2025-01-24T00:45:37.5794972Z "--github-ref-type", 2025-01-24T00:45:37.5795458Z type=str, 2025-01-24T00:45:37.5795853Z required=True, 2025-01-24T00:45:37.5796346Z help="Current GitHub ref type, branch or tag", 2025-01-24T00:45:37.5796917Z ) 2025-01-24T00:45:37.5797278Z parser.add_argument( 2025-01-24T00:45:37.5797747Z "--eligible-experiments", 2025-01-24T00:45:37.5798285Z type=_str_comma_separated_to_set, 2025-01-24T00:45:37.5798814Z required=False, 2025-01-24T00:45:37.5799245Z default="", 2025-01-24T00:45:37.5800127Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-01-24T00:45:37.5801114Z ) 2025-01-24T00:45:37.5801745Z parser.add_argument( 2025-01-24T00:45:37.5802210Z "--pr-number", 2025-01-24T00:45:37.5802625Z type=str, 2025-01-24T00:45:37.5803028Z required=False, 2025-01-24T00:45:37.5803449Z default="", 2025-01-24T00:45:37.5803924Z help="the optional PR number where this is run", 2025-01-24T00:45:37.5804707Z ) 2025-01-24T00:45:37.5804904Z 2025-01-24T00:45:37.5805093Z return parser.parse_args() 2025-01-24T00:45:37.5805417Z 2025-01-24T00:45:37.5805426Z 2025-01-24T00:45:37.5805656Z def get_gh_client(github_token: str) -> Github: 2025-01-24T00:45:37.5806248Z auth = Auth.Token(github_token) 2025-01-24T00:45:37.5806773Z return Github(auth=auth) 2025-01-24T00:45:37.5807079Z 2025-01-24T00:45:37.5807086Z 2025-01-24T00:45:37.5807391Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: 2025-01-24T00:45:37.5808054Z repo = gh.get_repo(repo) 2025-01-24T00:45:37.5808561Z return repo.get_issue(number=issue_num) 2025-01-24T00:45:37.5808931Z 2025-01-24T00:45:37.5808939Z 2025-01-24T00:45:37.5809130Z def get_potential_pr_author( 2025-01-24T00:45:37.5809800Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-01-24T00:45:37.5810542Z ) -> str: 2025-01-24T00:45:37.5811070Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-01-24T00:45:37.5812063Z # Fetch the actual username from the original PR. The PR number is 2025-01-24T00:45:37.5812840Z # embedded in the tag name: ciflow// 2025-01-24T00:45:37.5813276Z 2025-01-24T00:45:37.5813468Z gh = get_gh_client(github_token) 2025-01-24T00:45:37.5813827Z 2025-01-24T00:45:37.5814112Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-01-24T00:45:37.5814764Z split_tag = ref_name.split("/") 2025-01-24T00:45:37.5815282Z if ( 2025-01-24T00:45:37.5815674Z len(split_tag) == 3 2025-01-24T00:45:37.5816166Z and split_tag[0] == "ciflow" 2025-01-24T00:45:37.5816702Z and split_tag[2].isnumeric() 2025-01-24T00:45:37.5817231Z ): 2025-01-24T00:45:37.5817623Z pr_number = split_tag[2] 2025-01-24T00:45:37.5818117Z try: 2025-01-24T00:45:37.5818567Z repository = gh.get_repo(repo) 2025-01-24T00:45:37.5819218Z pull = repository.get_pull(number=int(pr_number)) 2025-01-24T00:45:37.5819846Z except Exception as e: 2025-01-24T00:45:37.5820391Z raise Exception( # noqa: TRY002 2025-01-24T00:45:37.5821100Z f"issue with pull request {pr_number} from repo {repository}" 2025-01-24T00:45:37.5822086Z ) from e 2025-01-24T00:45:37.5822731Z return pull.user.login 2025-01-24T00:45:37.5823359Z # In all other cases, return the original input username 2025-01-24T00:45:37.5823974Z return username 2025-01-24T00:45:37.5824232Z 2025-01-24T00:45:37.5824239Z 2025-01-24T00:45:37.5824473Z def is_exception_branch(branch: str) -> bool: 2025-01-24T00:45:37.5825033Z """ 2025-01-24T00:45:37.5825694Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-01-24T00:45:37.5826514Z """ 2025-01-24T00:45:37.5827081Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-01-24T00:45:37.5827641Z 2025-01-24T00:45:37.5827659Z 2025-01-24T00:45:37.5827860Z def load_yaml(yaml_text: str) -> Any: 2025-01-24T00:45:37.5828378Z try: 2025-01-24T00:45:37.5828769Z data = yaml.safe_load(yaml_text) 2025-01-24T00:45:37.5829288Z return data 2025-01-24T00:45:37.5829714Z except yaml.YAMLError: 2025-01-24T00:45:37.5830205Z log.exception("Error loading YAML") 2025-01-24T00:45:37.5830750Z raise 2025-01-24T00:45:37.5830979Z 2025-01-24T00:45:37.5830987Z 2025-01-24T00:45:37.5831576Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> Tuple[str, str]: 2025-01-24T00:45:37.5832371Z """ 2025-01-24T00:45:37.5833004Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-01-24T00:45:37.5833655Z 2025-01-24T00:45:37.5834027Z If the issue body contains "---" then the text above that is the settings 2025-01-24T00:45:37.5835267Z and the text below is the list of opted in users. 2025-01-24T00:45:37.5836086Z 2025-01-24T00:45:37.5836722Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-01-24T00:45:37.5838344Z """ 2025-01-24T00:45:37.5839141Z rollout_state_parts = rollout_state.split("---") 2025-01-24T00:45:37.5840307Z if len(rollout_state_parts) >= 2: 2025-01-24T00:45:37.5841648Z return rollout_state_parts[0], rollout_state_parts[1] 2025-01-24T00:45:37.5842857Z else: 2025-01-24T00:45:37.5843551Z return "", rollout_state 2025-01-24T00:45:37.5844140Z 2025-01-24T00:45:37.5844151Z 2025-01-24T00:45:37.5844509Z class UserOptins(Dict[str, List[str]]): 2025-01-24T00:45:37.5845501Z """ 2025-01-24T00:45:37.5846449Z Dictionary of users with a list of features they have opted into 2025-01-24T00:45:37.5847722Z """ 2025-01-24T00:45:37.5848100Z 2025-01-24T00:45:37.5848113Z 2025-01-24T00:45:37.5848725Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-01-24T00:45:37.5849964Z """ 2025-01-24T00:45:37.5851448Z 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:37.5852839Z 2025-01-24T00:45:37.5854042Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-01-24T00:45:37.5855962Z - Example line: "@User1,lf,split_build" 2025-01-24T00:45:37.5857268Z - A "#" prefix indicates the user is opted out of all experiments 2025-01-24T00:45:37.5858200Z 2025-01-24T00:45:37.5858213Z 2025-01-24T00:45:37.5858495Z """ 2025-01-24T00:45:37.5859170Z optins = UserOptins() 2025-01-24T00:45:37.5860043Z for user in user_optin_text.split("\n"): 2025-01-24T00:45:37.5861055Z user = user.strip("\r\n\t -") 2025-01-24T00:45:37.5862344Z if not user or not user.startswith("@"): 2025-01-24T00:45:37.5863472Z # Not a valid user. Skip 2025-01-24T00:45:37.5864446Z continue 2025-01-24T00:45:37.5864916Z 2025-01-24T00:45:37.5865216Z if user: 2025-01-24T00:45:37.5865703Z usr_name = user.split(",")[0].strip("@") 2025-01-24T00:45:37.5866456Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-01-24T00:45:37.5867001Z 2025-01-24T00:45:37.5867173Z return optins 2025-01-24T00:45:37.5867421Z 2025-01-24T00:45:37.5867429Z 2025-01-24T00:45:37.5867921Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-01-24T00:45:37.5868572Z """ 2025-01-24T00:45:37.5868979Z Check if the experiment name is valid. 2025-01-24T00:45:37.5869516Z A valid name: 2025-01-24T00:45:37.5870183Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-01-24T00:45:37.5871371Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-01-24T00:45:37.5872230Z - Cannot contain spaces 2025-01-24T00:45:37.5872698Z """ 2025-01-24T00:45:37.5872902Z 2025-01-24T00:45:37.5873183Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-01-24T00:45:37.5873922Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-01-24T00:45:37.5874403Z 2025-01-24T00:45:37.5874568Z if valid: 2025-01-24T00:45:37.5874948Z return True 2025-01-24T00:45:37.5875187Z 2025-01-24T00:45:37.5875357Z log.error( 2025-01-24T00:45:37.5876927Z 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:37.5878610Z ) 2025-01-24T00:45:37.5878968Z return False 2025-01-24T00:45:37.5879204Z 2025-01-24T00:45:37.5879213Z 2025-01-24T00:45:37.5879536Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-01-24T00:45:37.5880181Z """ 2025-01-24T00:45:37.5880785Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-01-24T00:45:37.5881650Z """ 2025-01-24T00:45:37.5881995Z try: 2025-01-24T00:45:37.5882369Z if settings_text: 2025-01-24T00:45:37.5883273Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-01-24T00:45:37.5884112Z # for easy reading 2025-01-24T00:45:37.5884932Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-01-24T00:45:37.5885880Z # the backtick character in shell commands. 2025-01-24T00:45:37.5886500Z backtick = chr(96) # backtick character 2025-01-24T00:45:37.5887194Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-01-24T00:45:37.5887878Z settings = load_yaml(settings_text) 2025-01-24T00:45:37.5888263Z 2025-01-24T00:45:37.5888687Z # For now we just load experiments. We can expand this if/when we add more settings 2025-01-24T00:45:37.5889514Z experiments = {} 2025-01-24T00:45:37.5889820Z 2025-01-24T00:45:37.5890197Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-01-24T00:45:37.5890988Z if not is_valid_experiment_name(exp_name): 2025-01-24T00:45:37.5892273Z # 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:37.5893385Z continue 2025-01-24T00:45:37.5893689Z 2025-01-24T00:45:37.5893873Z valid_settings = {} 2025-01-24T00:45:37.5894402Z for setting in exp_settings: 2025-01-24T00:45:37.5894995Z if setting not in Experiment._fields: 2025-01-24T00:45:37.5895563Z log.warning( 2025-01-24T00:45:37.5896300Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-01-24T00:45:37.5897053Z ) 2025-01-24T00:45:37.5897484Z else: 2025-01-24T00:45:37.5898002Z valid_settings[setting] = exp_settings[setting] 2025-01-24T00:45:37.5898463Z 2025-01-24T00:45:37.5898748Z experiments[exp_name] = Experiment(**valid_settings) 2025-01-24T00:45:37.5899401Z return Settings(experiments) 2025-01-24T00:45:37.5899765Z 2025-01-24T00:45:37.5899944Z except Exception: 2025-01-24T00:45:37.5900428Z log.exception("Failed to parse settings") 2025-01-24T00:45:37.5900979Z 2025-01-24T00:45:37.5901172Z return Settings() 2025-01-24T00:45:37.5901554Z 2025-01-24T00:45:37.5901564Z 2025-01-24T00:45:37.5901824Z def parse_settings(rollout_state: str) -> Settings: 2025-01-24T00:45:37.5902428Z """ 2025-01-24T00:45:37.5902866Z Parse settings, if any, from the rollout state. 2025-01-24T00:45:37.5903288Z 2025-01-24T00:45:37.5903653Z If the issue body contains "---" then the text above that is the settings 2025-01-24T00:45:37.5904448Z and the text below is the list of opted in users. 2025-01-24T00:45:37.5904869Z 2025-01-24T00:45:37.5905300Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-01-24T00:45:37.5906119Z """ 2025-01-24T00:45:37.5906726Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-01-24T00:45:37.5907533Z return parse_settings_from_text(settings_text) 2025-01-24T00:45:37.5907955Z 2025-01-24T00:45:37.5907963Z 2025-01-24T00:45:37.5908237Z def parse_users(rollout_state: str) -> UserOptins: 2025-01-24T00:45:37.5908823Z """ 2025-01-24T00:45:37.5909209Z Parse users from the rollout state. 2025-01-24T00:45:37.5909576Z 2025-01-24T00:45:37.5909740Z """ 2025-01-24T00:45:37.5910275Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-01-24T00:45:37.5911041Z return parse_user_opt_in_from_text(users_text) 2025-01-24T00:45:37.5911582Z 2025-01-24T00:45:37.5911589Z 2025-01-24T00:45:37.5912031Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-01-24T00:45:37.5912816Z """ 2025-01-24T00:45:37.5913236Z Check if a user is opted into an experiment 2025-01-24T00:45:37.5913949Z """ 2025-01-24T00:45:37.5914402Z return experiment_name in user_optins.get(user, []) 2025-01-24T00:45:37.5914845Z 2025-01-24T00:45:37.5914854Z 2025-01-24T00:45:37.5915298Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-01-24T00:45:37.5916101Z """ 2025-01-24T00:45:37.5916571Z Check if a user explicitly opted out of an experiment 2025-01-24T00:45:37.5917174Z """ 2025-01-24T00:45:37.5917688Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-01-24T00:45:37.5918399Z experiment_optout = "-" + experiment_name 2025-01-24T00:45:37.5919064Z if experiment_optout not in user_optins.get(user, []): 2025-01-24T00:45:37.5919688Z return False 2025-01-24T00:45:37.5919942Z 2025-01-24T00:45:37.5920225Z if is_user_opted_in(user, user_optins, experiment_name): 2025-01-24T00:45:37.5920868Z log.warning( 2025-01-24T00:45:37.5921826Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-01-24T00:45:37.5922772Z ) 2025-01-24T00:45:37.5922990Z 2025-01-24T00:45:37.5923154Z return True 2025-01-24T00:45:37.5923387Z 2025-01-24T00:45:37.5923396Z 2025-01-24T00:45:37.5923581Z def get_runner_prefix( 2025-01-24T00:45:37.5924031Z rollout_state: str, 2025-01-24T00:45:37.5924511Z workflow_requestors: Iterable[str], 2025-01-24T00:45:37.5925037Z branch: str, 2025-01-24T00:45:37.5925527Z eligible_experiments: FrozenSet[str] = frozenset(), 2025-01-24T00:45:37.5926150Z is_canary: bool = False, 2025-01-24T00:45:37.5926622Z ) -> str: 2025-01-24T00:45:37.5927044Z settings = parse_settings(rollout_state) 2025-01-24T00:45:37.5927636Z user_optins = parse_users(rollout_state) 2025-01-24T00:45:37.5928021Z 2025-01-24T00:45:37.5928204Z fleet_prefix = "" 2025-01-24T00:45:37.5928632Z prefixes = [] 2025-01-24T00:45:37.5929281Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-01-24T00:45:37.5930286Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-01-24T00:45:37.5931027Z log.info( 2025-01-24T00:45:37.5931845Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-01-24T00:45:37.5932668Z ) 2025-01-24T00:45:37.5933175Z continue 2025-01-24T00:45:37.5933449Z 2025-01-24T00:45:37.5933642Z if eligible_experiments: 2025-01-24T00:45:37.5934240Z if experiment_name not in eligible_experiments: 2025-01-24T00:45:37.5934898Z exp_list = ", ".join(eligible_experiments) 2025-01-24T00:45:37.5935487Z log.info( 2025-01-24T00:45:37.5936321Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-01-24T00:45:37.5937208Z ) 2025-01-24T00:45:37.5937611Z continue 2025-01-24T00:45:37.5938089Z elif not experiment_settings.default: 2025-01-24T00:45:37.5938643Z log.info( 2025-01-24T00:45:37.5939327Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-01-24T00:45:37.5940113Z ) 2025-01-24T00:45:37.5940491Z continue 2025-01-24T00:45:37.5940747Z 2025-01-24T00:45:37.5941046Z # Is any workflow_requestor opted out to this experiment? 2025-01-24T00:45:37.5941796Z opted_out_users = [ 2025-01-24T00:45:37.5942250Z requestor 2025-01-24T00:45:37.5942713Z for requestor in workflow_requestors 2025-01-24T00:45:37.5943411Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-01-24T00:45:37.5944067Z ] 2025-01-24T00:45:37.5944279Z 2025-01-24T00:45:37.5944454Z if opted_out_users: 2025-01-24T00:45:37.5944916Z log.info( 2025-01-24T00:45:37.5945554Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-01-24T00:45:37.5946429Z ) 2025-01-24T00:45:37.5946803Z continue 2025-01-24T00:45:37.5947058Z 2025-01-24T00:45:37.5947338Z # Is any workflow_requestor opted in to this experiment? 2025-01-24T00:45:37.5947972Z opted_in_users = [ 2025-01-24T00:45:37.5948423Z requestor 2025-01-24T00:45:37.5948880Z for requestor in workflow_requestors 2025-01-24T00:45:37.5949568Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-01-24T00:45:37.5950217Z ] 2025-01-24T00:45:37.5950421Z 2025-01-24T00:45:37.5950592Z enabled = False 2025-01-24T00:45:37.5951032Z if opted_in_users: 2025-01-24T00:45:37.5951592Z log.info( 2025-01-24T00:45:37.5952204Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-01-24T00:45:37.5952931Z ) 2025-01-24T00:45:37.5953317Z enabled = True 2025-01-24T00:45:37.5953601Z 2025-01-24T00:45:37.5953822Z elif experiment_settings.rollout_perc: 2025-01-24T00:45:37.5954704Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-01-24T00:45:37.5955697Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-01-24T00:45:37.5956383Z log.info( 2025-01-24T00:45:37.5957314Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-01-24T00:45:37.5958299Z ) 2025-01-24T00:45:37.5958700Z enabled = True 2025-01-24T00:45:37.5959009Z 2025-01-24T00:45:37.5959172Z if enabled: 2025-01-24T00:45:37.5959601Z label = experiment_name 2025-01-24T00:45:37.5960164Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-01-24T00:45:37.5961024Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-01-24T00:45:37.5962071Z # - If it's enabled, then we always list it's prefix first 2025-01-24T00:45:37.5962867Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-01-24T00:45:37.5963566Z if is_canary: 2025-01-24T00:45:37.5964066Z label += CANARY_FLEET_SUFFIX 2025-01-24T00:45:37.5964635Z fleet_prefix = label 2025-01-24T00:45:37.5965261Z else: 2025-01-24T00:45:37.5965710Z prefixes.append(label) 2025-01-24T00:45:37.5966076Z 2025-01-24T00:45:37.5966264Z if len(prefixes) > 1: 2025-01-24T00:45:37.5966708Z log.error( 2025-01-24T00:45:37.5967812Z 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:37.5969045Z ) 2025-01-24T00:45:37.5969427Z prefixes = prefixes[:1] 2025-01-24T00:45:37.5969752Z 2025-01-24T00:45:37.5969938Z # Fleet always comes first 2025-01-24T00:45:37.5970425Z if fleet_prefix: 2025-01-24T00:45:37.5970869Z prefixes.insert(0, fleet_prefix) 2025-01-24T00:45:37.5971354Z 2025-01-24T00:45:37.5971613Z return ".".join(prefixes) + "." if prefixes else "" 2025-01-24T00:45:37.5972050Z 2025-01-24T00:45:37.5972059Z 2025-01-24T00:45:37.5972549Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-01-24T00:45:37.5973376Z """ 2025-01-24T00:45:37.5973976Z Gets the first comment of the issue, which contains the desired rollout state. 2025-01-24T00:45:37.5974594Z 2025-01-24T00:45:37.5974995Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-01-24T00:45:37.5975739Z """ 2025-01-24T00:45:37.5976114Z gh = get_gh_client(github_token) 2025-01-24T00:45:37.5976672Z issue = get_issue(gh, repo, issue_num) 2025-01-24T00:45:37.5977332Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-01-24T00:45:37.5977801Z 2025-01-24T00:45:37.5977808Z 2025-01-24T00:45:37.5978374Z def download_json(url: str, headers: Dict[str, str], num_retries: int = 3) -> Any: 2025-01-24T00:45:37.5979192Z for _ in range(num_retries): 2025-01-24T00:45:37.5979678Z try: 2025-01-24T00:45:37.5980096Z req = Request(url=url, headers=headers) 2025-01-24T00:45:37.5980803Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-01-24T00:45:37.5981586Z return json.loads(content) 2025-01-24T00:45:37.5982124Z except Exception as e: 2025-01-24T00:45:37.5982680Z log.warning(f"Could not download {url}: {e}") 2025-01-24T00:45:37.5983103Z 2025-01-24T00:45:37.5983509Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-01-24T00:45:37.5984254Z return {} 2025-01-24T00:45:37.5984481Z 2025-01-24T00:45:37.5984489Z 2025-01-24T00:45:37.5984669Z @lru_cache(maxsize=None) 2025-01-24T00:45:37.5985423Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> Dict[str, Any]: 2025-01-24T00:45:37.5986232Z """ 2025-01-24T00:45:37.5986615Z Dynamically get PR information 2025-01-24T00:45:37.5987112Z """ 2025-01-24T00:45:37.5987604Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-01-24T00:45:37.5988254Z headers = { 2025-01-24T00:45:37.5988707Z "Accept": "application/vnd.github.v3+json", 2025-01-24T00:45:37.5989365Z "Authorization": f"token {github_token}", 2025-01-24T00:45:37.5989917Z } 2025-01-24T00:45:37.5990343Z json_response: Dict[str, Any] = download_json( 2025-01-24T00:45:37.5990964Z url=f"{github_api}/issues/{pr_number}", 2025-01-24T00:45:37.5991639Z headers=headers, 2025-01-24T00:45:37.5992074Z ) 2025-01-24T00:45:37.5992264Z 2025-01-24T00:45:37.5992443Z if not json_response: 2025-01-24T00:45:37.5993023Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-01-24T00:45:37.5993689Z return {} 2025-01-24T00:45:37.5993931Z 2025-01-24T00:45:37.5994111Z return json_response 2025-01-24T00:45:37.5994417Z 2025-01-24T00:45:37.5994426Z 2025-01-24T00:45:37.5994852Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> Set[str]: 2025-01-24T00:45:37.5995627Z """ 2025-01-24T00:45:37.5996160Z Dynamically get the latest list of labels from the pull request 2025-01-24T00:45:37.5996848Z """ 2025-01-24T00:45:37.5997465Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-01-24T00:45:37.5998117Z return { 2025-01-24T00:45:37.5998710Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-01-24T00:45:37.5999448Z } 2025-01-24T00:45:37.5999645Z 2025-01-24T00:45:37.5999653Z 2025-01-24T00:45:37.5999829Z def main() -> None: 2025-01-24T00:45:37.6000246Z args = parse_args() 2025-01-24T00:45:37.6000524Z 2025-01-24T00:45:37.6000753Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-01-24T00:45:37.6001160Z 2025-01-24T00:45:37.6001453Z # Check if the PR is opt-out 2025-01-24T00:45:37.6001959Z if args.pr_number: 2025-01-24T00:45:37.6002650Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-01-24T00:45:37.6003441Z if OPT_OUT_LABEL in labels: 2025-01-24T00:45:37.6003951Z log.info( 2025-01-24T00:45:37.6004669Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-01-24T00:45:37.6005513Z ) 2025-01-24T00:45:37.6006098Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-01-24T00:45:37.6006797Z sys.exit() 2025-01-24T00:45:37.6007059Z 2025-01-24T00:45:37.6007217Z try: 2025-01-24T00:45:37.6007650Z rollout_state = get_rollout_state_from_issue( 2025-01-24T00:45:37.6008390Z args.github_token, args.github_issue_repo, args.github_issue 2025-01-24T00:45:37.6009055Z ) 2025-01-24T00:45:37.6009267Z 2025-01-24T00:45:37.6009471Z username = get_potential_pr_author( 2025-01-24T00:45:37.6010031Z args.github_token, 2025-01-24T00:45:37.6010653Z args.github_repo, 2025-01-24T00:45:37.6011142Z args.github_actor, 2025-01-24T00:45:37.6011740Z args.github_ref_type, 2025-01-24T00:45:37.6012243Z args.github_branch, 2025-01-24T00:45:37.6012709Z ) 2025-01-24T00:45:37.6012911Z 2025-01-24T00:45:37.6013217Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-01-24T00:45:37.6013698Z 2025-01-24T00:45:37.6013918Z runner_label_prefix = get_runner_prefix( 2025-01-24T00:45:37.6014485Z rollout_state, 2025-01-24T00:45:37.6014975Z (args.github_issue_owner, username), 2025-01-24T00:45:37.6015535Z args.github_branch, 2025-01-24T00:45:37.6016039Z args.eligible_experiments, 2025-01-24T00:45:37.6016563Z is_canary, 2025-01-24T00:45:37.6016973Z ) 2025-01-24T00:45:37.6017184Z 2025-01-24T00:45:37.6017370Z except Exception as e: 2025-01-24T00:45:37.6017829Z log.error( 2025-01-24T00:45:37.6018518Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-01-24T00:45:37.6019337Z ) 2025-01-24T00:45:37.6019541Z 2025-01-24T00:45:37.6019889Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-01-24T00:45:37.6020416Z 2025-01-24T00:45:37.6020423Z 2025-01-24T00:45:37.6020610Z if __name__ == "__main__": 2025-01-24T00:45:37.6021050Z main() 2025-01-24T00:45:37.6021360Z 2025-01-24T00:45:37.6116560Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-01-24T00:45:37.6117502Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-01-24T00:45:37.6145569Z shell: /usr/bin/bash -e {0} 2025-01-24T00:45:37.6146064Z env: 2025-01-24T00:45:37.6146689Z GITHUB_TOKEN: *** 2025-01-24T00:45:37.6147115Z ISSUE_NUMBER: 5132 2025-01-24T00:45:37.6147568Z TRIGGERING_ACTOR: facebook-github-bot 2025-01-24T00:45:37.6148126Z ISSUE_OWNER: yushangdi 2025-01-24T00:45:37.6148580Z CHECK_EXPERIMENTS: 2025-01-24T00:45:37.6149029Z PR_NUMBER: 145539 2025-01-24T00:45:37.6149429Z ##[endgroup] 2025-01-24T00:45:39.0396858Z Defaulting to user installation because normal site-packages is not writeable 2025-01-24T00:45:39.9896029Z Collecting urllib3==1.26.18 2025-01-24T00:45:40.1103361Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-01-24T00:45:40.1360591Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.4 MB/s eta 0:00:00 2025-01-24T00:45:40.1560366Z Collecting PyGithub==2.3.0 2025-01-24T00:45:40.1716260Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-01-24T00:45:40.2143309Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-01-24T00:45:40.2180093Z 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:40.2237118Z 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:40.2255469Z 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:40.2271876Z 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:40.2503804Z Collecting Deprecated (from PyGithub==2.3.0) 2025-01-24T00:45:40.2584807Z Downloading Deprecated-1.2.15-py2.py3-none-any.whl.metadata (5.5 kB) 2025-01-24T00:45:40.2813643Z 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:40.3913619Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-01-24T00:45:40.3950011Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-01-24T00:45:40.5145132Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-01-24T00:45:40.5183072Z 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:40.5366335Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-01-24T00:45:40.5402004Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-01-24T00:45:40.5637975Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-01-24T00:45:40.5730286Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 18.0 MB/s eta 0:00:00 2025-01-24T00:45:40.5789730Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-01-24T00:45:40.5906610Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 34.5 MB/s eta 0:00:00 2025-01-24T00:45:40.5954219Z 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:40.6084553Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 74.5 MB/s eta 0:00:00 2025-01-24T00:45:40.6136771Z Downloading Deprecated-1.2.15-py2.py3-none-any.whl (9.9 kB) 2025-01-24T00:45:40.6208537Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-01-24T00:45:40.6293027Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 70.3 MB/s eta 0:00:00 2025-01-24T00:45:40.6328448Z 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:40.6372499Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 27.7 MB/s eta 0:00:00 2025-01-24T00:45:40.6407940Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-01-24T00:45:40.6457348Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 33.7 MB/s eta 0:00:00 2025-01-24T00:45:40.9634934Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-01-24T00:45:41.4918988Z 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:41.5706305Z ##[group]Run curr_branch="export-D68294638" 2025-01-24T00:45:41.5706724Z curr_branch="export-D68294638" 2025-01-24T00:45:41.5706995Z curr_ref_type="branch" 2025-01-24T00:45:41.5707257Z echo "Current branch is '$curr_branch'" 2025-01-24T00:45:41.5707524Z  2025-01-24T00:45:41.5707727Z python3 runner_determinator.py \ 2025-01-24T00:45:41.5708018Z  --github-token "$GITHUB_TOKEN" \ 2025-01-24T00:45:41.5708296Z  --github-issue "$ISSUE_NUMBER" \ 2025-01-24T00:45:41.5708564Z  --github-branch "$curr_branch" \ 2025-01-24T00:45:41.5708832Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-01-24T00:45:41.5709247Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-01-24T00:45:41.5709741Z  --github-ref-type "$curr_ref_type" \ 2025-01-24T00:45:41.5710243Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-01-24T00:45:41.5710770Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-01-24T00:45:41.5711425Z  --pr-number "${PR_NUMBER}" 2025-01-24T00:45:41.5742146Z shell: /usr/bin/bash -e {0} 2025-01-24T00:45:41.5742387Z env: 2025-01-24T00:45:41.5743023Z GITHUB_TOKEN: *** 2025-01-24T00:45:41.5743236Z ISSUE_NUMBER: 5132 2025-01-24T00:45:41.5743455Z TRIGGERING_ACTOR: facebook-github-bot 2025-01-24T00:45:41.5743720Z ISSUE_OWNER: yushangdi 2025-01-24T00:45:41.5743939Z CHECK_EXPERIMENTS: 2025-01-24T00:45:41.5744158Z PR_NUMBER: 145539 2025-01-24T00:45:41.5744352Z ##[endgroup] 2025-01-24T00:45:41.5792468Z Current branch is 'export-D68294638' 2025-01-24T00:45:43.5342852Z INFO : Skipping experiment 'awsa100', as it is not a default experiment 2025-01-24T00:45:43.5344805Z INFO : Setting output: label-type='' 2025-01-24T00:45:43.5659022Z Evaluate and set job outputs 2025-01-24T00:45:43.5665881Z Cleaning up orphan processes