Alon wants to refresh all TurnKey Linux appliances with the latest security updates.
He writes a script which accepts the name of an appliance as an argument, downloads the latest version from Sourceforge, extracts the root filesystem, installs the security updates, repackages the root filesystem into an appliance ISO and uploads a new version of the appliance back to Sourceforge.
After testing the script on his local Ubuntu workstation, he asks the Hub to launch a new TurnKey Core instance (22.214.171.124), transfers his script and installs whatever dependencies are required. Once everything is tested to work, he creates a new TKLBAM backup with captures the state of his master worker server.
Alon runs his first cloudtask test:
echo core | cloudtask --workers=126.96.36.199 refresh-iso-security-updates
Once he confirms that this single test job worked correctly, he's ready for the big batch job that will run on 10 servers in parallel.
Since this is a routine task Alon expects to repeat regularly, he creates a pre-configured cloudtask template for it in $HOME/cloudtasks:
$ mkdir $HOME/cloudtasks $ cd $HOME/cloudtasks $ cat > refresh-iso << 'EOF' from cloudtask import Task class RefreshISO(Task): DESCRIPTION = "This task refreshes security updates on an ISO" BACKUP_ID = 123 COMMAND = 'refresh-iso-security-updates' SPLIT = 10 REPORT = 'mail: firstname.lastname@example.org email@example.com firstname.lastname@example.org' HUB_APIKEY = 'BRDUKK3WDXY3CFQ' RefreshISO.main() EOF $ chmod +x ./refresh-iso $ cat $PATH_LIST_APPLIANCES | ./refresh-iso About to launch 10 cloud servers to execute the following task: Parameter Value --------- ----- jobs 40 (appengine .. zimbra) command refresh-iso-security-updates hub-apikey 5YGVPEMHJHU5EA ec2-region us-east-1 ec2-size m1.small ec2-type s3 user root backup-id 123 workers - overlay - post - pre - timeout - report mail: email@example.com firstname.lastname@example.org Is this really what you want? [yes/no] yes session 11 (pid 29709) 188.8.131.52 (29721): launched new worker 184.108.40.206 (29722): launched new worker 220.127.116.11 (29724): launched new worker 18.104.22.168 (29723): launched new worker ...
45 minutes later, Alon receives an e-mail from cloudtask that the job has finished. In the body is the session log detailing if errors were detected on any job (e.g., non-zero exitcode), how long the session took to run, etc.
Had he wanted to, Alon could have followed the execution of the task jobs in real-time by tailing the worker log files:
tail -f ~/.cloudtask/11/workers/29721