Path: blob/master/part-2/data-io/allas-batch-jobs.md
1237 views
------Using Allas in batch jobs
Preparations
💬 The allas-conf command opens an Allas connection that is valid for eight hours.
In case of interactive usage, this eight-hour limit is not problematic as
allas-confcan be executed again to extend the validity of the connection.In case of batch jobs, the situation is different, as it may take more than eight hours before the job even starts!
To be able to use Allas in a batch job, load the Allas module and run
allas-confagain with the-koption:Here, the option
-kindicates that the password will be stored in an environment variable$OS_PASSWORD. With this variable defined, you no longer need to input your password when you re-executeallas-confwith the-koption and the Allas project name.
☝🏻 Note that if you mistype your password when using the
-koption, you must use the commandunset OS_PASSWORDbefore you can try again.Refresh the connection with the command:
☝🏻 When
$OS_PASSWORDis set, thea-commands(a-put,a-get,a-list,a-delete) automatically refresh the Allas connection when the commands are executed in a batch job.Choose a file from Allas. The file should have text in it. You can use the one you created in one of the earlier tutorials, or then any other text file you have in Allas:
Create a new batch job script. First open a new text file with the command:
Option 1:
a-commandsCopy the batch job script below to the text file you are editing:
In the script, replace
<project_number>_$USERto match your bucket name and<filename>to the name of the file you have in Allas. Remember to also define your billing project (--account).
Option 2:
rclone☝🏻 If you use
rcloneorswiftinstead of thea-commands, you need to addsource allas_confcommands to your script.Copy the batch job script below to the text file you are editing:
Replace
<project_number>_$USERto match your bucket name and<filename>to the name of the file you have in Allas. Remember to also define your billing project (--account).
Submit the batch job with the command:
Monitor the progress of your batch job:
More information
Docs CSC: Using Allas in batch jobs