Thursday 8 October 2015

Chapter 27: Working with Binary Large Objects (Blobs)



Chapter 27: Working with Binary Large Objects (Blobs) 


Binary Large Objects 
Binary Large Objects (blobs) are binary data of variable length. CA Workload Automation 
AE supports blobs in job definitions, and after they are defined, they are stored in the 
database. This allows the blob data to be shared by jobs running on multiple computers. 
To understand the advantages of using blobs in CA Workload Automation AE 
environment, refer to the following example, which explains the process that is used to 
share data amongst the jobs that are running on a single computer: 
1. When the jobs are running on a single computer, you can define a command job to 
run a program that outputs the data to a file using the std_out_file attribute. 
2. When the job is completed, a file is created in the location specified by the 
std_out_file attribute. 
3. All the other jobs that depend on this output data can access this file. 
4. You can also define a second command job to run a program that reads the output 
data of the previous job, by specifying the file name in the std_in_file attribute. 
5. This second command job opens the file specified by the std_in_file attribute and 
passes the data to the program, allowing it to complete successfully. 
Based on this example, as the output data is stored in a file on one computer, it is not 
available to all the other jobs that are scheduled to run on other computers. However, 
the use of blobs allows the data that is saved as output by a job on one computer to be 
shared by all the other jobs that are running across multiple computers. 
Also, you can define a command job to run a program that uploads the output data to 
the database as a blob using the std_out_file attribute. You can also define a second 
command job to run a program that reads the blob data of the previous job using the 
std_in_file attribute. The second command job downloads the blob data specified by 
the std_in_file attribute from the database and passes the data to the program, allowing 
it to complete successfully. 
 Types of Blobs 
Blob data can be of the following types: 
Binary Data 
Requires a program that understands the format of the data to interpret the bytes 
in binary data. For example: 
Multimedia files which include the following: 
■ Images 
■ Video files 
■ Audio files
Textual Data 
Requires an operating system that can interpret the bytes in textual data, which 
contains the characters that conform to the ASCII standard. 
Note: Some operating systems handle the specification of a new line in the textual 
data differently. In this instance, you must convert the necessary textual data when 
it is copied across operating systems. 
CA Workload Automation AE allows you to specify the type of blob data that is 
being used and converts the textual data when it is downloaded across multiple 
operating systems. 
Types of Blobs 
CA Workload Automation AE supports the following types of blobs: 
■ Job blobs 
■ Global blobs 
Note: If you install the 64-bit agent using the CA Workload Automation Agent for UNIX, 
Linux, or Windows DVD, you cannot run jobs that contain globs or blobs as input or 
output. The native CA Workload Automation AE client or SDK runs only in 32-bit mode 
and does not support being called by a 64-bit application. 

Job Blobs 
Job blobs are associated with an existing CA Workload Automation AE job and are 
referenced by the job name. Job blobs can either be created at the time of the job 
definition or after the job has been defined. They are deleted when the job is deleted. 
There are three types of job blobs, which include the following: 
Input 
Contains the input data that is reserved for the job to which they are associated in 
textual data format. 
Output 
Stores the program output messages of a running job in textual or binary data 
format. 
Error 
Stores the error messages of a running job in textual or binary data format. 
Input Job Blobs 
Input blobs are uploaded to the database using JIL. You can insert an input job blob 
multiple times. Each time it is inserted, it acquires a new version number. 
When the job starts, the most recent version of the job input blob is used. All the earlier 
versions of the blob remain in the database until they are manually deleted. If you 
delete an input job blob, only the active version of the input job blob is deleted. The 
version which was prior to the deleted version becomes the new active version. 
When you run a job, the CA Workload Automation AE agent downloads the active 
version of job's input blob from the database into a temporary file on the computer. 
This file is then passed into the standard input of the program that is executed by the 
job. When the job completes, the temporary file containing the input blob data is 
deleted. The blob in the database, however, is not deleted and remains as the active 
version for subsequent job runs. 
 Global Blobs 
Output and Error Job Blobs 
Output and error job blobs store the program output and error messages of a running 
job. When you run a job, the CA Workload Automation AE agent creates temporary files 
on the computer that are used to capture the standard output and standard error 
messages from the program that was executed by the job. After the job has completed 
its run, the agent uploads the files containing the output data as blobs into the 
database, overwriting the existing files, and deletes the temporary files. An output job 
blob can be used as input by another job. An error job blob, on the other hand, cannot 
be used as input by another job. 
Global Blobs 
Global blobs are general purpose blobs in textual or binary data format. Like the CA 
Workload Automation AE global variables, they are referenced by a unique name. You 
can either upload the global blobs to the database using JIL or they can be uploaded by 
the CA Workload Automation AE agent, after a job has completed its run. After a global 
blob is created, it is available to any job as input. Global blobs remain in the database 
until they are deleted using JIL. 
Manage Blobs Using JIL 
The following section describes how to use JIL to do the following: 
■ Upload blobs to the database 
■ Delete blobs from the database 
Note: For more information, see the Reference Guide. 
Blob Attributes 
The following table lists the subcommands and attributes associated with the definition 
or destruction of a blob: 
Task Subcommands Attributes 
Create input job blob insert_job, update_job blob_input or blob_file 
Create input job blob insert_blob blob_input or blob_file 
Delete job blob delete_blob blob_type Blob Attributes 
Task Subcommands Attributes 
Create global blob 
insert_glob blob_mode, blob_input, or 
blob_file 
Delete global blob delete_glob 
The blob_input attribute lets you manually input the contents of a blob containing 
textual data. The blob_input attribute has the following format: 
blob_input: <auto_blobt>textual data</auto_blobt> 
Note: The textual data begins immediately after the auto_blobt XML-style open tag and 
may span multiple lines. JIL recognizes the end of the textual data when it reads the 
auto_blobt XML-style end tag. This implies that the literal character string 
</auto_blobt> cannot form part of the blob_input value. If you want to include this 
character string as part of the textual blob data, use the blob_file attribute. 
The blob_file attribute allows the user to specify the location and name of a file on the 
computer that serves as the input job blob or global blob file. The blob_file attribute has 
the following format: 
blob_file: filename 
Note: If the blob_file attribute is used to specify an input job blob through the 
insert_job or insert_blob subcommand, the file is interpreted as a text-based file. 
Create Input Job Blobs 
To create an input job blob in the database using JIL, do the following: 
■ Upload an input job blob at the time of the definition of the associated job. 
■ Upload an input job blob after you have defined the job. 
Note: Input job blobs are referenced by the name of the job. 
To create an input job blob at the time of the definition of the associated job, use the 
insert_job JIL subcommand and specify either the blob_input or blob_file attributes, as 
follows: 
insert_job: test_job_with_blob 
job_type: cmd 
command: sleep 60 
machine: juno 
owner: jerry@juno 
std_in_file: $$blobt 
blob_input: <auto_blobt>multi-lined text data for job blob 
</auto_blobt> 
or 
blob_file: /test_job_with_blob_file.txt 
To create an input job blob after you have defined the job, use the insert_blob JIL 
subcommand and specify either the blob_input or blob_file attributes, as follows: 
insert_blob: test_job_with_blob 
blob_input: <auto_blobt>multi-lined text data for job blob 
</auto_blobt> 
or 
blob_file: /test_job_with_blob_file.txt 
JIL interprets the file name that is specified in the blob_file attribute as a file that 
contains the textual data and performs a conversion of the new line character. JIL also 
displays the version number of the most recent input job blob. 
Delete Job Blobs 
You can use the JIL delete_blob subcommand to delete the following: 
■ Active version of the input job blob 
■ Output and error job blobs 
You must specify whether to delete the job input or output blob data using the 
blob_type attribute. 
Note: Job blobs are referenced by the name of the job. JIL displays the version number 
of the most recent job input blob. 
To delete the most recent version of the input job blob, use the delete_blob JIL 
subcommand and specify the blob_type attribute with the value of input, as follows: 
delete_blob: test_job_with_blob 
blob_type: input 
To delete the output and error job blobs, use the delete_blob JIL subcommand and 
specify the blob_type attribute with the value of output, as follows: 
delete_blob: test_job_with_blob 
blob_type: output 
Create Global Blobs 
You can use the JIL insert_glob subcommand to upload blobs containing textual or 
binary data. 
As the global blobs are not associated with a job, you must do the following: 
■ Provide a unique identifier. 
■ Specify the mode of the blob data that is being used in the blob_mode attribute. 
Note: If you use the insert_glob JIL subcommand using the same name as an existing 
global blob, the blob data is reinserted into the database. In this case, the original blob 
data is deleted and the new blob data takes its place. 
 Delete Global Blobs 
To create a global blob containing textual data, use the insert_glob JIL subcommand and 
specify the blob_mode attribute with a value of text and either the blob_input or 
blob_file attributes, as follows: 
insert_glob: my_text_global_blob 
blob_mode: text 
blob_input: <auto_blobt>multi-lined text data for job blob 
</auto_blobt> 
or 
blob_file: /my_text_global_blob_file.txt 
Note: JIL interprets the file name that is specified in the blob_file attribute as a file that 
contains textual data and performs a conversion of the new line character. 
To create a global blob containing binary data, use the insert_glob subcommand and 
specify the blob_mode attribute with a value of binary and the blob_file attribute, as 
follows: 
insert_glob: my_binary_global_blob 
blob_mode: binary 
blob_file: /my_binary_global_blob_file 
Note: You cannot use the blob_input attribute to create a global blob that contains the 
binary data. 
Delete Global Blobs 
You can use the JIL delete_glob subcommand to delete the existing global blobs. 
Note: You must provide a unique identifier because global blobs are not associated with 
a job. 
To delete a global blob, use the delete_glob JIL subcommand and provide the name of 
an existing global blob, as follows: 
delete_glob: my_global_blob 
Use Blobs in Job Definitions 
You can use the std_in_file, std_out_file, and std_err_file attributes of the JIL insert_job, 
update_job, or override_job subcommands to reference blobs in addition to files. Based 
on the keyword values you specify for these attributes, CA Workload Automation AE 
downloads a blob for input or uploads a job’s output as blob to meet the job’s needs. 
The keywords are explained in the subsequent sections. 
 Use Blobs in Job Definitions 
std_in_file Attribute 
The keywords that are supported by the std_in_file attribute include the following: 
$$blobt 
Uses the input job blob of the current job as input and treats the blob data as 
textual data. 
$$blob.<job name> 
Uses the output job blob of the specified job as input and treats the blob data as 
binary data. 
$$blobt.<job name> 
Uses the output job blob of the specified job as input and treats the blob data as 
textual data. 
$$glob.<global blob name> 
Uses the specified global blob as input and treats the blob data as binary data. 
$$globt.<global blob name> 
Uses the specified global blob as input and treats the blob data as textual data. 
Note: You cannot use the keyword $$blob to specify the use of the current job's input 
blob. 
To define a job that uses the output blob of its previous run as input 
1. Define the job so that the job's name is in the std_in_file attribute using either the 
$$blob.<job name> or $$blobt.<job name> keyword. 
2. Apply a one-time override of the std_in_file attribute, so that the job reads from a 
local file on the computer on its first run. 
 Use Blobs in Job Definitions 
std_out_file and std_err_file Attributes 
The keywords that are supported by the std_out_file and std_err_file attributes include 
the following: 
$$blob 
Uploads the output or error of the current job as a job blob and treats the data as 
binary data. 
$$blobt 
Uploads the output or error of the current job as a job blob and treats the data as 
textual data. 
$$glob.<global blob name> 
Uploads the output or error of the current job as a global blob with the specified 
name and treats the data as binary data. 
$$globt.<global blob name> 
Uploads the output or error of the current job as a global blob with the specified 
name and treats the data as textual data. 
Note: 
■ You cannot append data to an existing job or global blob. 
■ CA Workload Automation AE does not support the use of > or >> character strings 
in the std_out_file or std_err_file attributes. 
■ Existing blob data is overwritten with the new data after the job run is completed. 
Generate Blob Reports Using Autorep 
You can use the autorep utility to report on and download the input job blobs and global 
blobs. To export the job definition using the autorep –J <jobname> -q option includes 
exporting all versions of that job’s input blob. If a download path is not specified, the 
contents of all input job blobs are displayed along with the job definition. Otherwise, 
autorep downloads the input blob to the specified directory and displays the input blob 
file names numbered by version along with the job definition. Reports generated against 
one or more global blobs are extracted in binary format unless otherwise specified using 
the –a command line parameter. If a download path is not specified, autorep downloads 
the global blob into a temporary directory. 
Options specific to blob and glob data include the following: 
-z globname 
Specifies a glob name or mask whose contents are to be extracted. ALL may be 
specified to extract all globs. Wildcard characters % and _ are also supported. 
-a 
Specifies that the global blob can be downloaded as textual data. 
-f outdir 
Specifies the directory name where input job blobs or global blobs are extracted to. 
The default value is as follows: 
■ UNIX—The /tmp directory. 
■ Windows—The directory represented by the environment variable %TEMP%. 
Note: For more information about autorep reports, job input, and global blobs, see the 
Reference Guide. 
 Generate Blob Reports Using Autorep 
Example: Export Job Definition with Input Blobs 
This example uses the autorep command to export a job definition: 
autorep -J ALL -q 
The output might resemble the following: 
insert_job: test_job 
job_type: cmd 
command: cat 
machine: juno 
owner: jerry@ca 
permission: gx,ge,wx 
alarm_if_fail: 1 
If the job has one or more input blobs tied to it, in addition to the job definition, the 
autorep command extracts each of the job blob definitions, and the output might 
resemble the following: 
insert_job: test_job_with_blob job_type: cmd 
command: cat 
machine: juno 
owner: jerry@juno 
permission: 
std_in_file: $$blobt 
alarm_if_fail: 1 
/* -- test_job_with_blob:insert_blob #1 -- */ 
insert_blob: test_job_with_blob 
blob_input: <auto_blobt>multi-lined text data for job blob 1 
</auto_blobt> 
/* -- test_job_with_blob:insert_blob #2 -- */ 
insert_blob: test_job_with_blob 
blob_input: <auto_blobt> multi-lined text data for job blob 2 
</auto_blobt> 
/* -- test_job_with_blob:insert_blob #3 -- */ 
insert_blob: test_job_with_blob 
blob_input: <auto_blobt> multi-lined text data for job blob 3 
</auto_blobt> 
You can also specify a location to download the blobs using the -f parameter as follows: 
autorep -J ALL -q -f /myblobsdir 
The output might resemble the following: 
insert_job: test_job_with_blob job_type: cmd 
command: cat 
machine: juno 
owner: jerry@juno 
permission: Generate Blob Reports Using Autorep 
std_in_file: $$blobt 
alarm_if_fail: 1 
/* -- test_job_with_blob:insert_blob #1 -- */ 
insert_blob: test_job_with_blob 
blob_file: /myblobsdir/test_job_with_blob_1.txt 
/* -- test_job_with_blob:insert_blob #2 -- */ 
insert_blob: test_job_with_blob 
blob_file: /myblobsdir/test_job_with_blob_2.txt 
/* -- test_job_with_blob:insert_blob #3 -- */ 
insert_blob: test_job_with_blob 
blob_file: /myblobsdir/test_job_with_blob_3.txt 
Example: Generate a Report for All Global Blobs 
This example generates a report that downloads the contents of all global blobs to the 
location /myblobsdir as binary data: 
autorep -z ALL -f /myblobsdir 
The report might resemble the following: 
Glob Name File Name 
____________ _____________________________ 
MYGLOB /myblobsdir/MYGLOB 
REPORT_CHART /myblobsdir/REPORT_CHART 
ARCHIVED_DATA /myblobsdir/ARCHIVED_DATA 
JOB_SNAPSHOT /myblobsdir/JOB_SNAPSHOT 
This example generates a report that downloads the contents of all global blobs to the 
location /myblobsdir as text data: 
autorep -z ALL -f /myblobsdir -a 
The report might resemble the following: 
Glob Name File Name 
___________ __________________________________ 
MYGLOB /myblobsdir/MYGLOB.txt 
REPORT_CHART /myblobsdir/REPORT_CHART.txt 
ARCHIVED_DATA /myblobsdir/ARCHIVED_DATA.txt 
JOB_SNAPSHOT /myblobsdir/JOB_SNAPSHOT.txt 

No comments:

Post a Comment