Rescale API を簡単に使う方法
https://github.com/daikumatan/rescaleapi-wrapper
ファイルアップロードとダウンロードは Rescale CLI をつかったほうが良いので、まだ実装していません。
pre-condition
Creating RescaleAPI
- Rescaleにサインナップしてください
- ログインしてください
- API Keyを作成してください
- APIをコピーしてください
日本の場合 API Key をすぐに作れないケースが多いですので、その場合は、中の人に連絡したほうがベター
Edit your ~/.bashrc
set the API Key and Platform-URL
if JP,
echo 'export RESCALE_API_KEY=<API KEY>' >> ~/.bashrc
echo 'https://platform.rescale.jp/ >> ~/.bashrc'
if US,
echo 'export RESCALE_API_KEY=<API KEY>' >> ~/.bashrc
echo 'https://platform.rescale.com/ >> ~/.bashrc'
How to use rescaleapi command
Job list
If you want to display the job list including Job-IDs, Please execute the following command.
rescaleapi.py job ls
you can indicate the number of jobs with --max=<int>
. is positive integer.
NUMBER_OF_JOBS=256
rescaleapi.py job ls --max=${NUMBER_OF_JOBS}
Job information
If you want to display the job-information, Please execute the following command. response is json-data.
JOBID='<Job-ID obtained when you create the job>'
rescaleapi.py job info ${JOBID}
Create Job (Job Difinition)
you can create the job by using the following command.
(this command doesn't execute the job. Job-difinition is saved in Rescale.)
if you indicate JSON-data directly:
JSON='<JSON-DATA to create rescale-job>'
rescaleapi.py job create ${JSON}
else if you indicate JSON-FILE:
JSONFILE=<'JSONFILE job'>
rescaleapi.py job create --file ${JSONFILE}
Job submittion (Run)
you can submit the job you created with this command.
JOBID='<Job-ID obtained when you create the job>'
rescaleapi.py job submit ${JOBID}
Job Monitor
You can use this command to check the job-status or the end of the job.
JOBID='<Job-ID obtained when you create the job>'
rescaleapi.py job monitor ${JOBID}
Job Deletion
You can delete the job with the following command.
JOBID='<Job-ID obtained when you create the job>'
rescaleapi.py job delete ${JOBID}
Job Stop
You can stop the running job with the following command.
JOBID='<Job-ID obtained when you create the job>'
rescaleapi.py job stop ${JOBID}
Job Sharing
You can share the job to a user account belongint same company account.
JOBID='<Job-ID obtained when you create the job>'
ADDRESS='<e-mail address>'
rescaleapi.py job share ${JOBID} --email=${ADDRESS}
JOBID='<Job-ID obtained when you create the job>'
ADDRESS='<e-mail address>'
MESSAGE='<this is my test job>'
rescaleapi.py job share ${JOBID} --email=${ADDRESS} --message=${MESSAGE}
File list
You can take the file list for the Job-ID you indicate.
JOBID='<Job-ID obtained when you create the job>'
rescaleapi.py file ls ${JOBID}
JOBID='<Job-ID obtained when you create the job>'
DOE_RUN_NUMBERS="1,4,10,25"
rescaleapi.py file ls ${JOBID} --run=${DOE_RUN_NUMBERS}
File Information
You can take the file-information for the file-ID you indicate.
FILEID='<File-ID obtained when you execute "rescaleapi.py file ls" command>'
rescaleapi.py file info ${FILEID}
Help
rescaleapi.py -h
or
rescaleapi.py --help