iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🚀

Automating SIGNATE Competition Submissions via CLI: Introducing signate-deploy

に公開

Introduction

Previously, I wrote an article titled Cloud ML Practice Guide with SIGNATE x GitHub Actions, No Local Environment Required.

In that article, I introduced how to manually build GitHub Actions workflows, but the setup, such as repository initialization and SIGNATE CLI configuration, was tedious to do every time.

Therefore, I created a tool to automate this series of steps with a CLI.

pip install signate-deploy

PyPI: https://pypi.org/project/signate-deploy/
GitHub: https://github.com/yasumorishima/signate-deploy

What is signate-deploy?

signate-deploy is a tool that manages everything from creating a repository for SIGNATE competitions to submission, all via CLI commands.

signate-deploy init-repo   ← Initialize repository + Generate GitHub Actions
signate-deploy setup-token ← Configure SIGNATE API token
signate-deploy init        ← Authenticate SIGNATE CLI
signate-deploy submit      ← Submit via GitHub Actions

Differences from the existing article:

Existing Article signate-deploy
Workflow Manually create YAML Automatically generated with init-repo
SIGNATE authentication Manually configure signate.json Interactive configuration with setup-token
Submission Manually execute gh workflow run Execute with submit command
Data download Manually describe within workflow Execute with download command

Setup Procedure

1. Initialize Repository

python -m signate_deploy init-repo my-competition
cd my-competition

This automatically generates the following:

  • .github/workflows/signate-submit.yml (submission workflow)
  • .github/workflows/signate-download.yml (data download workflow)
  • train.py (template)
  • .gitignore

2. Configure SIGNATE API Token

python -m signate_deploy setup-token

Enter your SIGNATE email address and API token interactively, and save them to GitHub Secrets.

3. Authenticate SIGNATE CLI

python -m signate_deploy init

Perform initial authentication for SIGNATE CLI.

4. Confirm Competition Information

# Competition list
python -m signate_deploy competition-list

# Task list (specify competition_key)
python -m signate_deploy task-list --competition-key <competition_key>

# File list (specify task_key)
python -m signate_deploy file-list --task-key <task_key>

5. Download Data

python -m signate_deploy download

Download data via GitHub Actions.

6. Submit

python -m signate_deploy submit

Execute training and submission via GitHub Actions.

Command List

Command Description
init-repo Initialize repository + Generate GitHub Actions
init Authenticate SIGNATE CLI
setup-token Set API token in GitHub Secrets
submit Submit via GitHub Actions
download Download data via GitHub Actions
competition-list Display competition list
task-list Display task list
file-list Display file list

Example

I actually used it in a SIGNATE competition and confirmed that the entire flow from setup-token to download to submit can be completed on GitHub Actions.

python -m signate_deploy setup-token   # Token setup
python -m signate_deploy download      # Data download
# ... Create training code ...
python -m signate_deploy submit        # Submit

Common Issues

Windows PATH issue

On Windows, the signate-deploy command may not be added to PATH. In such cases, use python -m signate_deploy.

# If not in PATH
python -m signate_deploy <command>

competition_key and task_key are different

The value of competition= in the SIGNATE URL is the competition_key. The task_key required for data download must be obtained separately.

# 1. Get task list from competition_key
python -m signate_deploy task-list --competition-key <competition_key>

# 2. Get file list from task_key
python -m signate_deploy file-list --task-key <task_key>

submit/download via GitHub Actions

submit and download are executed via gh workflow run. They do not directly submit to SIGNATE locally, so prior integration with a GitHub repository is required.

gh secret set must be run within the repo directory

gh secret set will fail if the current directory is not a Git repository. Always execute it in the root of the repository.

cd my-competition   # Inside the Git repo directory
gh secret set SIGNATE_EMAIL --body your@email.com

v0.1.7: Support for Automatic Token Renewal

SIGNATE API tokens have an expiration date. From v0.1.7, init-repo automatically generates scripts/refresh_signate_token.py, which automatically acquires a new token every time GitHub Actions runs.

Setup (run inside the repo directory)

gh secret set SIGNATE_EMAIL --body your@email.com
gh secret set SIGNATE_PASSWORD   # Enter securely at the prompt

With just this, a new token will be automatically acquired for each Actions execution. There is no need to manually re-run setup-token.

Migration from v0.1.6 or earlier

Existing repositories can be updated to the latest workflow with init-repo --force.

python -m signate_deploy init-repo --force
git add .github/workflows/ scripts/
git commit -m "Update to token auto-refresh workflow"
git push

Add SIGNATE_EMAIL and SIGNATE_PASSWORD to GitHub Secrets, and you're done (SIGNATE_TOKEN_B64 will no longer be necessary).

Conclusion

pip install signate-deploy
python -m signate_deploy init-repo my-competition

You can automate SIGNATE competition environment setup and submission using the CLI.

For details on manual setup, please refer to this article.

PyPI: https://pypi.org/project/signate-deploy/
GitHub: https://github.com/yasumorishima/signate-deploy

GitHubで編集を提案

Discussion