This sample contains a SimpleCI batch
project that is associated with an EJB project (SimpleCIEJBs) and an EAR project (SimpleCIEAR). The SimpleCI application demonstrates the compute-intensive
programming model by performing compute-intensive mathematical calculations
for a specified time.
Before you begin
- Install one of the following supported servers:
- WebSphere® Application
Server V8.5
- WebSphere Application Server V8.0
- WebSphere Application Server V8.0 with WebSphere Extended Deployment Compute Grid V8.0
- WebSphere Application
Server V7.0 with Feature Pack for Modern Batch
- Configure WebSphere Application Server to accept
batch applications.
Tip: The application server
is not ready to accept batch applications, if you cannot open the
Modern Batch job management console. For example, if you try to go
to the
Servers view, right-click the server
and select
Modern Batch Job Management Console you might get one of the following error messages:
To overcome these error messages, complete the
Configuring WebSphere Application Server
to accept batch application task for your server and return to
this page for information about running the sample.
About this task
To run the sample on the server, follow these steps:
Procedure
- Determine which supported version of the
server you want to run this sample on by adding the server in the
Servers view:
- WebSphere Application
Server V7.0
- WebSphere Application
Server V8.0
- WebSphere Application
Server V8.5
- To open the Servers view, go to the toolbar and select .
- To add a server entry, right-click in the Servers view
and select . Follow the instructions in the New Server wizard, ensuring that you select either WebSphere Application
Server V7.0, WebSphere Application Server V8.0 or WebSphere Application Server V8.5. For
more details, see the Creating a WebSphere Application Server topic.
- Import the sample into your workspace:
- In the help system of the product, click this Import sample link to import the compute-intensive application
sample into your workspace.
- In the Import wizard, accept the default settings and click Finish.
- If you want to run this sample on WebSphere Application Server
V8.0 or V8.5, you must change the default setting for the targeted
runtime environment. The default environment for this
sample is set to WebSphere Application Server V7.0. The Sample Runtime Targeting wizard opens only if the workbench does not contain a WebSphere Application Server V7.0 runtime
environment:
- If the Sample Runtime Targeting wizard
opens, the workbench does not contain a WebSphere Application Server V7.0 runtime
environment:
- Select Manually install a compatible runtime or stub
after importing the sample option and click Finish.
- In the Workspace Migration page, click Next.
- On the Workspace projects which need migration page, click Next.
- On the Migration Project Resources page,
click Next.
- In the Server Runtimes list on the Undefined Server Runtime page, for the was.base.v7 entry, select WebSphere Application Server v8.0 or WebSphere Application Server v8.5 under
the New Server Runtime column. Click Next.
- On the Complete Migration Startup page,
click Finish.
- On the Migration Validation window, click OK.
- If the Sample Runtime Targeting wizard
does not open, the workbench contains a WebSphere Application Server V7.0 runtime
environment:
- In the Enterprise Explorer view, right-click
the SimpleCIEAR project and select .
- Select the WebSphere Application Server V8.0 or WebSphere Application Server V8.5 check
box, and click OK.
- When the import is complete, you can see the following
projects in the Enterprise Explorer view:
- To run the sample on the server:
- In the Servers view, right-click the server and select Start. Wait for the server to start. Look
in the Servers view to see that the state and status of the server
changes to Started and Synchronized.
- In the Servers view, right-click the server and select Add and Remove. In the Available list in the wizard, select the SimpleCIEAR application,
click Add, and then click Finish. Wait for the application to publish and start. Look
in the Servers view to see that the state and status of the application
changes to Started and Synchronized.
- In the Enterprise Explorer view, expand folders, right-click the SimpleCIxJCL.xml file, and select .
In the
Run Configurations wizard, the
SimpleCIxJCL.xml file is a batch job (xJCL) file.
Jobs are expressed using
an Extensible Markup Language XML dialect called XML Job Control Language
(xJCL). All jobs contain the following information:
- The identity of the batch application that performs the work
- One or more job steps that must be performed to complete the work
- The identity of an artifact within the application that provides
the logic for each job step
- Key and value pairs for each job step to provide additional context
to the application artifacts
For more details, see
Batch applications, jobs, and job definitions in the WebSphere Application
Server information center.
- If the server has application security is enabled, select
the Security is enable on this server check
box. Specify the user name and password for the job scheduler.
Tip: You can find which user or group maps to the
security roles lradmin and lrsubmitter by opening the Administrative Console and select .
- View the input values to run the sample:
Substitution properties define name and value pairs for
symbolic variables. In an xJCL file, a symbolic variable is an expression
of the form ${variable-name} which is found outside
a comment in an otherwise well-formed document. Substitution for symbolic
variables occurs at run time. When the xJCL file is issued, the ${variable-name} string is replaced with the value of the
property.
In the
Update substitution properties section under the
Property column, you can
find two substitution properties which are used as input values for
the sample:
- calctime is set at a default value of 30 seconds.
The sample is given 30 seconds to perform compute-intensive mathematical
calculations.
- outfile is set at a default value of /data/simpleciout.txt the location of the output text
file after running this sample. In the next step, you override this
substitution property by substituting /data/ with
an existing file directory on your machine, to prevent exception.
Tip: In the Update substitution properties section, you can update the values of the substitution properties
for the job that is defined in the Batch Job file field. Use this section to specify new property values during a
run configuration session, without modifying the actual batch job
(xJCL) file. This is helpful when substitution properties contain
environment-specific values, such as file paths.
- Modify the input values to run the sample. In the Update substitution properties section,
under the New Value column for the outfile substitution property, type the path where you
want the simpleciout.txt output text file to be written
when running this sample. For example, C:\temp\simpleciout.txt.
- In the Run Configurations wizard,
click Run to issue the batch job file.
- In the Modern Batch Job Management console, view the job
and log:
- In the left pane under the Job Management section, click the View jobs link. The job table lists the submitted jobs.
- By default, this compute-intensive application sample
takes 30 seconds to run. Under the State column,
the state of this sample should remain at Executing for 30 seconds from when the application starts to run. Click the
refresh button in the heading of the State column
to see the state change to Ended when the compute-intensive
application completes.
- Under the Job ID column, click
the SimpleCI:<jobID> link. You can click Download to open or save
a copy of the job log.
A
job log contains the following
information:
- A copy of the xJCL file that was used to run the job, including
xJCL substitution values.
- A set of system messages that communicate the major life cycle
events corresponding to the job. Example of system events that are
recorded in a job log are the beginning and end of a job and its job
steps.
- A set of messages written to standard output and standard error
by a job step program.
For more details about job logs, see the
Job logs topic in the WebSphere Application Server information
center.
Here is an example of the job log for this sample:CWLRB5671I: [10/20/10 15:09:02:902 EDT] Processing for job SimpleCI:00007 started.
CWLRB5807I: [10/20/10 15:09:02:932 EDT] Original XJCL
1 : <?xml version="1.0" encoding="UTF-8"?>
2 : <!--(C) Copyright IBM Corp. 2005 - All Rights Reserved. DISCLAIMER: The following source code is sample code created by IBM Corporation. This sample code is provided to you solely for the purpose of assisting you in the use of the product. The code is provided 'AS IS', without warranty or condition of any kind. IBM shall not be liable for any damages arising out of your use of the sample code, even if IBM has been advised of the possibility of such damages.-->
3 : <job default-application-name="SimpleCIEAR" name="SimpleCI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://core.wcg.etools.ibm.com/xsd/xJCL.xsd">
4 : <jndi-name>ejb/com/ibm/ws/ci/SimpleCIEarCIController</jndi-name>
5 : <substitution-props>
6 : <prop name="calctime" value="30"></prop>
7 : <prop name="outfile" value="C:\temp\mytext.txt"></prop>
8 : </substitution-props>
9 : <job-step name="Step1">
10 : <classname>com.ibm.websphere.ci.samples.SimpleCIWork</classname>
11 : <props>
12 : <prop name="calculationTimeInSecs" value="${calctime}"></prop>
13 : <prop name="outputFileName" value="${outfile}"></prop>
14 : </props>
15 : </job-step>
16 : </job>
CWLRB5808I: [10/20/10 15:09:02:945 EDT] Substituted XJCL
1 : <?xml version="1.0" encoding="UTF-8"?>
2 : <!--(C) Copyright IBM Corp. 2005 - All Rights Reserved. DISCLAIMER: The following source code is sample code created by IBM Corporation. This sample code is provided to you solely for the purpose of assisting you in the use of the product. The code is provided 'AS IS', without warranty or condition of any kind. IBM shall not be liable for any damages arising out of your use of the sample code, even if IBM has been advised of the possibility of such damages.-->
3 : <job default-application-name="SimpleCIEAR" name="SimpleCI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://core.wcg.etools.ibm.com/xsd/xJCL.xsd">
4 : <jndi-name>ejb/com/ibm/ws/ci/SimpleCIEarCIController</jndi-name>
5 : <substitution-props>
6 : <prop name="calctime" value="30"></prop>
7 : <prop name="outfile" value="C:\temp\mytext.txt"></prop>
8 : </substitution-props>
9 : <job-step name="Step1">
10 : <classname>com.ibm.websphere.ci.samples.SimpleCIWork</classname>
11 : <props>
12 : <prop name="calculationTimeInSecs" value="30"></prop>
13 : <prop name="outputFileName" value="C:\temp\mytext.txt"></prop>
14 : </props>
15 : </job-step>
16 : </job>
CWLRB5684I: [10/20/10 15:09:02:981 EDT] Job SimpleCI:00007 is queued for execution
CWLRB5586I: [10/20/10 15:09:02:995 EDT] CWLRS6006I: Job class Default, Importance 8, Service Class null, Service Goal Type 4, Application Type j2ee, Submitter UNAUTHENTICATED.
CWLRB5586I: [10/20/10 15:09:02:995 EDT] CWLRS6007I: Job Arrival Time 10/20/10 3:09 PM, Goal Max Completion Time 0, Goal Max Queue Time 0, Breach Time 10/21/10 3:09 PM.
CWLRB5586I: [10/20/10 15:09:02:996 EDT] CWLRS6021I: List of eligible endpoints to execute the job: zebraNode01/server1.
CWLRB5586I: [10/20/10 15:09:02:996 EDT] CWLRS6011I: APC is not active. GAP will make the endpoint selection.
CWLRB5586I: [10/20/10 15:09:03:020 EDT] CWLRS6013I: GAP is dispatching job SimpleCI:00007. Job queue time 0.025 seconds.
CWLRB3090I: [10/20/10 15:09:03:075 EDT] Job SimpleCI:00007 is dispatched to endpoint zebraNode01/server1: result: 0
System.out: [10/20/10 15:09:03:170 EDT] Wed Oct 20 15:09:03 EDT 2010: SimpleCI application starting...
System.out: [10/20/10 15:09:03:170 EDT] -->Will loop processing a variety of math functions for approximately 30.0 seconds!
System.out: [10/20/10 15:09:33:198 EDT] Wed Oct 20 15:09:33 EDT 2010: SimpleCI application complete!
System.out: [10/20/10 15:09:33:199 EDT] -->Actual Processing time = 30.028 seconds!
CWLRB3800I: [10/20/10 15:09:33:224 EDT] Job [SimpleCI:00007] ended normally.
- Here is an example of the output in the simpleciout.txt file:
Wed Oct 20 15:09:03 EDT 2010: SimpleCI application starting...
-->Will loop processing a variety of math functions for approximately 30.0 seconds!
Wed Oct 20 15:09:33 EDT 2010: SimpleCI application complete!
-->Actual Processing time = 30.028 seconds!