Skip to content

Commit

Permalink
[CI] Launch and stop compile server via workflow (#396)
Browse files Browse the repository at this point in the history
  • Loading branch information
hjjq authored Dec 21, 2023
1 parent 2040a7c commit a70faa0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions .github/scripts/start_instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def run_command(cmd):
hw_config_ids = [s for s in hw_config_ids.split(',') if s]

instances = []
# Fetch list of (cloud_provider_id, instance_id) tuples from DB
# Fetch list of (cloud_provider_id, instance_id) tuples from DB and add them to the list of instances to launch
for hw_config_id in hw_config_ids:
query = (
'SELECT cloud_provider_id, instance_id, hardware_config.name as hw_config FROM cloud_instance '
Expand All @@ -43,6 +43,16 @@ def run_command(cmd):
raise ValueError(f'Instance with hardware config id {hw_config_id} does not exist.')
instances.append(rows[0])

# Fetch the compile server instance ID from DB and add it to list of instances to launch
query = (
'SELECT cloud_provider_id, instance_id, 0 FROM compile_server LIMIT 1'
)
cursor.execute(query)
rows = cursor.fetchall()
if len(rows) == 0:
raise ValueError(f'No compile server found in DB.')
instances.append(rows[0])

# Store a json containing all the required model/OPs (and inputs) for this regression run
# This json will be uploaded as an artifact, and will be filled in by subsequent jobs
# For now, we run all model/input combinations by default
Expand Down Expand Up @@ -126,7 +136,8 @@ def run_command(cmd):
hw_configs = []
for instance in instances:
_, _, hw_config = instance
hw_configs.append(hw_config)
if hw_config != 0:
hw_configs.append(hw_config)
hw_config_json_str = json.dumps(hw_configs)
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
print(f'hw_configs={hw_config_json_str}', file=fh)
2 changes: 1 addition & 1 deletion .github/workflows/regression.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ jobs:
id: run_py_script
run: timeout 900 python ./.github/scripts/start_instances.py
env:
# TODO: Allow launching only specified GPU instances
HW_CONFIG: all
REPO_NAME: ${{ github.repository }}
# TODO: Allow launching only specified GPU instances

- name: Upload run configs
uses: actions/upload-artifact@v3
Expand Down

0 comments on commit a70faa0

Please sign in to comment.