I'm trying to use the Application Lab application on Bluemix's Workload Scheduler service but can't find any documentation on how to use it. Specifically, I need to run a RESTful URL once a day, with a timestamp of the previous run embedded in the URL. Creating variables in Application Lab seems pretty straightforward, but I can't figure out how to set or use them. Can someone point me in the right direction?
The update of the variables of the application lab via APIs is not yet available (it will be soon).
There is another way of doing it that I can share with you. Follow these steps:
Enable the cloud agent to run scripts
You should open a ticket for that. By defaults the cloud agent is not enabled to run scripts but you can open a ticket to change this.
Get the user credentials
Open the service a take not of the user credentials. Click "Add credentials" if they are not present.
Open the Workload Editor
The workload editor is a more powerful UI with respect to the Application Lab and enable complex scenarios.
To open the Workload Designer, open the Application Lab, right click on a process and select "Launch Workload Designer".
Define the restful job
Create a new restful job:
Then set the name and the workstations and check the flag "Variable resolution at runtime".
Then click on the "Action" pane and set the URI of the service. Add the ${TIMESTAMP} variable in the URI. For testing purposes I used this URI:
http://echo.jsontest.com/title/ipsum/content/${TIMESTAMP}
Save this definition (use the floppy disk icon).
Define the job that updates the variable
Create an executable job:
Set the name, the workstation and the "Variable resolution at runtime" flag
Then open the "Task pane" and add the following in the script field:
#/bin/sh -x
#Set the following 3 variables from your credentials
export USERNAME="xxxxxx@bluemix.net"
export PASSWORD='xxxxxx'
export HOSTNAME=xxxxx.wa.ibmserviceengage.com
#Replace "CC" with the letters of your tenant
export VT=CCTIMESTAMP
#MAIN STARTS HERE
export TIMESTAMP=`date +%s`
. /home/wauser/TWA/TWS/tws_env.sh
echo "VARTABLE $VT MEMBERS TIMESTAMP \"$TIMESTAMP\" END" > /home/wauser/vt.txt
composer -host $HOSTNAME -protocol https -username "$USERNAME" -password $PASSWORD replace /home/wauser/vt.txt
Submit the job by clicking "Select Action" -> "Submit Job into current plan".
Define a job stream
Click "New" -> "Job Stream"
Define the name, the workstation and the variable table (replace CC with your two letters tenant id). The right click on and select add jobs:
Add the "TEST" and "UPDATETIMESTAMP" jobs (or the name you used).
Right click on "UPDATETIMESTAMP" and select "Add dependencies" -> "Job in the same job stream" and then select "TEST".
Right click on "Run Cycles" and select "Add Run Cycle"
Open the "Rule" pane and select "Daily"
Open the "Time Restrictions" and set the time when the job stream has to start and check the flag "use as time dependency".
Save the job stream and you're done!