Path: blob/master/part-2/data-io/allas-batch-jobs.md
696 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-conf
can 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-conf
again with the-k
option:Here, the option
-k
indicates 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-conf
with the-k
option and the Allas project name.
☝🏻 Note that if you mistype your password when using the
-k
option, you must use the commandunset OS_PASSWORD
before you can try again.Refresh the connection with the command:
☝🏻 When
$OS_PASSWORD
is 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-commands
Copy the batch job script below to the text file you are editing:
In the script, replace
<project_number>_$USER
to 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
rclone
orswift
instead of thea-commands
, you need to addsource allas_conf
commands to your script.Copy the batch job script below to the text file you are editing:
Replace
<project_number>_$USER
to 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