-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yml
87 lines (87 loc) · 3.79 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# action.yml
name: 'ClearML verify code execution'
description: 'Launch the current PR as a remote task and poll status. Clean up when iterations are detected.'
inputs:
CLEARML_API_ACCESS_KEY:
description: 'ClearML api access key (can be generated in your profile page)'
required: true
CLEARML_API_SECRET_KEY:
description: 'ClearML api secret key (can be generated in your profile page)'
required: true
CLEARML_API_HOST:
description: 'ClearML server api host'
required: true
EXECUTION_TIMEOUT:
description: 'How long to wait for the first iteration before failing, not including time waiting in queue, in seconds. Note: this does include docker setup and package installations! (default: 600)'
default: 600
QUEUE_NAME:
description: 'Name of the queue to place the experiment into. (default: "default")'
default: "default"
CLEARML_PROJECT:
description: 'Project name to run the test task into. (default: "Github CICD")'
default: 'Github CICD'
CLEARML_TASK_NAME:
description: 'Task name to run the test task as. (default: "cicd_test_task")'
default: 'cicd_test_task'
EXECUTION_ENTRYPOINT:
description: 'Entry point script for the remote execution. (default: "main.py")'
default: 'main.py'
EXECUTION_FOLDER:
description: 'Execute the code from a local folder. (default: ".")'
default: '.'
EXECUTION_REQUIREMENTS:
description: 'Pip requirements file. (default: "requirements.txt")'
default: 'requirements.txt'
EXECUTION_ARGS:
description: 'Arguments to pass to the remote task, list of <argument>=<value> strings. (default: [])'
default: 'hack=empty_string_doesnt_work'
runs:
using: 'composite'
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install ClearML
shell: bash
run: |
pip install -r ${{ github.action_path }}/requirements.txt
sudo apt-get update && sudo apt-get install -y ripgrep
- name: Start the task
id: launch_task
shell: bash
run: |
echo "$QUEUE_NAME"
echo "TASK_ID=$(
clearml-task --project '${{ env.CLEARML_PROJECT }}' \
--name '${{ env.CLEARML_TASK_NAME }}' \
--branch ${{ github.head_ref }} \
--script '${{ env.EXECUTION_ENTRYPOINT }}' \
--folder '${{ env.EXECUTION_FOLDER }}' \
--requirements '${{ env.EXECUTION_REQUIREMENTS }}' \
--args '${{ env.EXECUTION_ARGS }}' \
--skip-task-init \
--queue '${{ env.QUEUE_NAME }}' | rg -o 'Task id=(.*) sent' -r '$1'
)" >> $GITHUB_OUTPUT
# There seems to be a bug in Github actions that doesn't allow me to use runs.env for everything...
env:
CLEARML_API_ACCESS_KEY: ${{ inputs.CLEARML_API_ACCESS_KEY }}
CLEARML_API_SECRET_KEY: ${{ inputs.CLEARML_API_SECRET_KEY }}
CLEARML_API_HOST: ${{ inputs.CLEARML_API_HOST }}
QUEUE_NAME: ${{ inputs.QUEUE_NAME }}
CLEARML_PROJECT: ${{ inputs.CLEARML_PROJECT }}
CLEARML_TASK_NAME: ${{ inputs.CLEARML_TASK_NAME }}
EXECUTION_ENTRYPOINT: ${{ inputs.EXECUTION_ENTRYPOINT }}
EXECUTION_FOLDER: ${{ inputs.EXECUTION_FOLDER }}
EXECUTION_REQUIREMENTS: ${{ inputs.EXECUTION_REQUIREMENTS }}
EXECUTION_ARGS: ${{ inputs.EXECUTION_ARGS }}
- name: Poll for task progress
shell: bash
run: python ${{ github.action_path }}/check_clearml_task_running.py "${{ steps.launch_task.outputs.TASK_ID }}"
env:
CLEARML_API_ACCESS_KEY: ${{ inputs.CLEARML_API_ACCESS_KEY }}
CLEARML_API_SECRET_KEY: ${{ inputs.CLEARML_API_SECRET_KEY }}
CLEARML_API_HOST: ${{ inputs.CLEARML_API_HOST }}
EXECUTION_TIMEOUT: ${{ inputs.EXECUTION_TIMEOUT }}