Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dataclasses from ci_setup.py #3251

Merged
merged 2 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions eng/performance/benchmark_jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,6 @@ jobs:
steps:
- checkout: self
clean: true
- ${{ if ne(parameters.osName, 'windows') }}:
- script: wget https://bootstrap.pypa.io/pip/3.6/get-pip.py && $(Python) get-pip.py --user
displayName: Ensure pip is installed
- script: $(Python) -m pip install --user dataclasses
displayName: Install dataclasses library used in ci_setup.py
- script: $(Python) scripts/ci_setup.py --channel $(_Channel) --architecture ${{parameters.architecture}} --perf-hash $(Build.SourceVersion) --queue ${{parameters.queue}} --build-number $(Build.BuildNumber) --build-configs $(_Configs) $(AffinityParam) $(runEnvVarsParam) $(TargetsWindowsParam)
displayName: Run ci_setup.py
- ${{ if eq(parameters.osName, 'windows') }}:
Expand Down
5 changes: 0 additions & 5 deletions eng/performance/scenarios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,6 @@ jobs:
steps:
- checkout: self
clean: true
- ${{ if ne(parameters.osName, 'windows') }}:
- script: wget https://bootstrap.pypa.io/pip/3.6/get-pip.py && $(Python) get-pip.py --user
displayName: Ensure pip is installed
- script: $(Python) -m pip install --user dataclasses
displayName: Install dataclasses library used in ci_setup.py
- ${{ if ne(length(parameters.channels), 0) }}:
- script: $(Python) scripts/ci_setup.py --channel $(_Channel) --architecture ${{parameters.architecture}} --perf-hash $(Build.SourceVersion) --queue ${{parameters.queue}} --build-number $(Build.BuildNumber) --build-configs $(_Configs) --output-file $(CorrelationStaging)machine-setup --install-dir $(CorrelationStaging)dotnet $(runEnvVarsParam) $(AffinityParam) $(TargetsWindowsParam)
displayName: Run ci_setup.py
Expand Down
66 changes: 33 additions & 33 deletions scripts/ci_setup.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
#!/usr/bin/env python3

from argparse import ArgumentParser, ArgumentTypeError
from dataclasses import dataclass, field
from logging import getLogger

import os
import sys
import datetime

from subprocess import check_output
from typing import Optional, List
from typing import Any, Optional, List

from performance.common import get_machine_architecture, get_repo_root_path, set_environment_variable
from performance.common import get_tools_directory
Expand Down Expand Up @@ -268,36 +267,36 @@ def __process_arguments(args: List[str]):
return parser.parse_args(args)


@dataclass
class CiSetupArgs:
channel: str
quiet: bool = False
commit_sha: Optional[str] = None
repository: Optional[str] = None
architecture: str = get_machine_architecture()
dotnet_path: Optional[str] = None
dotnet_versions: List[str] = field(default_factory=list)
install_dir: Optional[str] = None
build_configs: List[str] = field(default_factory=list)
pgo_status: Optional[str] = None
get_perf_hash: bool = False
perf_hash: str = 'testSha'
cli: Optional[str] = None
commit_time: Optional[str] = None
local_build: bool = False
branch: Optional[str] = None
output_file: str = os.path.join(get_tools_directory(), 'machine-setup')
not_in_lab: bool = False
queue: str = 'testQueue'
build_number: str = '1234.1'
locale: str = 'en-US'
maui_version: str = ''
affinity: Optional[str] = None
run_env_vars: Optional[List[str]] = None
target_windows: bool = True
physical_promotion: Optional[str] = None

def main(args: CiSetupArgs):
# @dataclass
# class CiSetupArgs:
# channel: str
# quiet: bool = False
# commit_sha: Optional[str] = None
# repository: Optional[str] = None
# architecture: str = get_machine_architecture()
# dotnet_path: Optional[str] = None
# dotnet_versions: List[str] = field(default_factory=list)
# install_dir: Optional[str] = None
# build_configs: List[str] = field(default_factory=list)
# pgo_status: Optional[str] = None
# get_perf_hash: bool = False
# perf_hash: str = 'testSha'
# cli: Optional[str] = None
# commit_time: Optional[str] = None
# local_build: bool = False
# branch: Optional[str] = None
# output_file: str = os.path.join(get_tools_directory(), 'machine-setup')
# not_in_lab: bool = False
# queue: str = 'testQueue'
# build_number: str = '1234.1'
# locale: str = 'en-US'
# maui_version: str = ''
# affinity: Optional[str] = None
# run_env_vars: Optional[List[str]] = None
# target_windows: bool = True
# physical_promotion: Optional[str] = None

def main(args: Any):
verbose = not args.quiet
setup_loggers(verbose=verbose)

Expand Down Expand Up @@ -454,7 +453,8 @@ def main(args: CiSetupArgs):
def __main(argv: List[str]):
validate_supported_runtime()
args = __process_arguments(argv)
main(CiSetupArgs(**vars(args)))
# main(CiSetupArgs(**vars(args)))
main(args)


if __name__ == "__main__":
Expand Down
Loading