-
Notifications
You must be signed in to change notification settings - Fork 28
task
CML 🍬 Tear down by grepping
#389
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
Comments
This probably belongs to a separate epic/milestone titled “using |
While it's still far from ideal, have you tried using Exampleresource "iterative_task" "example" {
...
}
|
I tried jq also but is not very friendly. However terraform console looks very interesting |
Both |
@iterative/cml definitely it's worth to use
Here is a proven workflow. In my workflow the name: train-my-model
on: [push]
jobs:
train-tpi:
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: iterative/setup-cml@v1
- name: tpi
env:
REPO_TOKEN: ${{ secrets.REPO_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
shell: bash
run: |
cat <<EOF > main.tf
terraform {
required_providers {
iterative = {
source = "iterative/iterative",
}
}
}
provider "iterative" {}
resource "iterative_task" "train" {
cloud = "az"
machine = "Standard_D2S_v3"
region = "us-west"
spot = 0
workdir {
input = "."
output = "."
}
environment = {
EPOCHS = 1
}
script = <<-END
#!/bin/bash
sudo apt update
sudo apt-get install -y software-properties-common build-essential python3-pip
pip3 install -r requirements.txt
python3 train.py
END
}
EOF
terraform init
terraform apply --auto-approve
if terraform console <<< 'iterative_task.train.status["succeeded"]'; then
echo 'Destroying...'
terraform destroy --auto-approve
cml send-github-check --token=$GITHUB_TOKEN --conclusion=success --title='CML report' report.md
cml pr --md output/* >> report.md
cml send-comment --update report.md
cml send-comment --update --pr --commit-sha HEAD report.md
else
echo 'Creating report...'
echo 'In progress...' > report.md
cml send-github-check --token=$GITHUB_TOKEN --conclusion=neutral --title='CML report' report.md
fi |
GNU Bash version
POSIX compliant version ™
|
Here you're a tentative solution to the #357 potential XY problem. It would be nice to have an easier way of checking if a task has either failed or succeeded, but I'm afraid it would either involve exposing a redundant attribute (e.g. completed: boolean) or finding another way of invoking Succeeded + failed checkif terraform console <<< 'try(iterative_task.example.status["succeeded"], 0) + try(iterative_task.example.status["failed"], 0)' | grep --quiet --invert-match 0; then
echo the task has either succeeded or failed, destroying the resources...
fi Loop–based alternative (8 bytes less)if terraform console <<< 'sum([for status in ["succeeded", "failed"] : try(iterative_task.example.status[status], 0)])' | grep --quiet --invert-match 0; then
echo the task has either succeeded or failed, destroying the resources...
fi |
I don't quite grok Surely it should be |
Are you referring to #389 (comment)? 🤔 If so, you're probably missing a detail: |
I just realised 🤢 |
This comment was marked as off-topic.
This comment was marked as off-topic.
No longer a valid use case, use |
From users feedback
Its far from ideal, specially having status not totally working or not working as expected #388
The text was updated successfully, but these errors were encountered: