workclassoperations.py script

We can use the workclassoperations.py script to create, update, and manage work classes.


Purpose

We can complete the following actions with the workclassoperations.py script:


Location

The workclassoperations.py script is in the app_server_root/bin directory.


Usage

The script usage for general help follows:

The script usage for operation-specific help follows:

Depending on where you are issuing the command, we might have to specify the path to the workclassoperation.py script. For example, you create a profile named Dmgr01 located in the c:\app_server_root\profiles\Dmgr01\bin directory.

Note that if the deployment manager is not started, include the additional parameter -conntype NONE:


Operations

listWorkClasses

Lists work classes by type. The format of listing is workclassname type appname/odrname deploymentname

  • -type: Type of work class to list:

    • ASP: application service policy

    • ARP: application routing policy

    • GSP: generic server service policy

    • GRP: generic server routing policy

  • -appname: Name of the application. Required if specified the --type parameter as ASP or ARP.

  • -odrname: Name of the on demand router (ODR). Required if specified the --type parameter as GSP or GRP.

createWorkClass

Creates a work class. The new service policy does not contain any application modules or classification rules. Create and associate application modules and classification rules separately.

  • :

    • -type: Type of work class to list:

      • ASP: application service policy

      • ARP: application routing policy

      • GSP: generic server service policy

      • GRP: generic server routing policy

    • -appname: Name of the application. Required if specified the --type parameter as ASP or ARP.

    • -odrname: Name of the on demand router (ODR). Required if specified the --type parameter as GSP or GRP.

    • -nodename: Name of the node. Required if specified the --type parameter as GSP or GRP.

    • -wcname: Unique name for the work class within the specified type.

    • -protocol: Communications protocol that transmits the request. Currently supported protocols are HTTP, IIOP, SOAP, and JMS.

    • -wcaction: Specifies the default action to take when a request is matched to a member for the specified work class.

    • -module: Application module to associate members. Required if specified the --appname and --members parameters.

    • -members: Protocol-specific pattern:

      • HTTP: /test1?/test2/*

      • IIOP: ejbName:ejbMethod?ejbName:ejbMethod

      • SOAP: webService:operationName?webService:operationName

      • JMS: bus:destination?bus:destination

    • -rule: Specifies a classification rule in the format of "priority?rule?action"

    • -virtualhost: Virtual host. Required if specified the --type parameter as GSP or GRP.

  • removeWorkClass: Removes a work class.

    • -type: Type of work class to remove:

      • ASP: application service policy

      • ARP: application routing policy

      • GSP: generic server service policy

      • GRP: generic server routing policy

    • -appname: Name of the application. Required if specified the --type parameter as ASP or ARP.

    • -odrname: Name of the on demand router (ODR). Required if specified the --type parameter as GSP or GRP.

    • -wcname: Unique name for the work class within the specified type.

  • addMembers: Adds members to a work class. The ODR uses the new member to match incoming requests.

    • -type: Type of work class to remove:

      • ASP: application service policy

      • ARP: application routing policy

      • GSP: generic server service policy

      • GRP: generic server routing policy

    • -appname: Name of the application. Required if specified the --type parameter as ASP or ARP.

    • -odrname: Name of the on demand router (ODR). Required if specified the --type parameter as GSP or GRP.

    • -wcname: Unique name for the work class within the specified type.

    • -protocol: Communications protocol that transmits the request. Currently supported protocols are HTTP, IIOP, SOAP, and JMS.

    • -module: Application module to associate members. Required if specified the --appname and --members parameters.

    • -members: Protocol-specific pattern:

      • HTTP: /test1?/test2/*

      • IIOP: ejbName:ejbMethod?ejbName:ejbMethod

      • SOAP: webService:operationName?webService:operationName

      • JMS: bus:destination?bus:destination

    • -ejbname: Name of the EJB. Required only when specified the --protocol parameter as JMS and the --module parameter as IIOP.

  • removeMembers: Removes members from a work class. The member is no longer used by the ODR.

    • -type: Type of work class to modify:

      • ASP: application service policy

      • ARP: application routing policy

      • GSP: generic server service policy

      • GRP: generic server routing policy

    • -appname: Name of the application. Required if specified the --type parameter as ASP or ARP.

    • -odrname: Name of the on demand router (ODR). Required if specified the --type parameter as GSP or GRP.

    • -wcname: Unique name for the work class within the specified type.

    • -protocol: Communications protocol that transmits the request. Currently supported protocols are HTTP, IIOP, SOAP, and JMS.

    • -module: Application module from which to disassociate members. Required if specified the --appname and --members parameters.

    • -members: Protocol-specific pattern:

      • HTTP: /test1?/test2/*

      • IIOP: ejbName:ejbMethod?ejbName:ejbMethod

      • SOAP: webService:operationName?webService:operationName

      • JMS: bus:destination?bus:destination

  • listMembers: Lists members of a work class.

    • -type: Type of work class to list:

      • ASP: application service policy

      • ARP: application routing policy

      • GSP: generic server service policy

      • GRP: generic server routing policy

    • -appname: Name of the application. Required if specified the --type parameter as ASP or ARP.

    • -odrname: Name of the on demand router (ODR). Required if specified the --type parameter as GSP or GRP.

    • -nodename: Name of the node. Required if specified the --type parameter as GSP or GRP.

    • -wcname: Unique name for the work class within the specified type.

    • -protocol: Communications protocol that transmits the request. Currently supported protocols are HTTP, IIOP, SOAP, and JMS.

  • addRules: Adds a classification rule used by the ODR to a work class. If we issue the command with the like wildcard '%' on UNIX operating systems, replace the escape sequence (\%%) with (\%).

    • -type: Type of work class to modify:

      • ASP: application service policy

      • ARP: application routing policy

      • GSP: generic server service policy

      • GRP: generic server routing policy

    • -appname: Name of the application. Required if specified the --type parameter as ASP or ARP.

    • -odrname: Name of the on demand router (ODR). Required if specified the --type parameter as GSP or GRP.

    • -nodename: Name of the node. Required if specified the --type parameter as GSP or GRP.

    • -wcname: Unique name for the work class within the specified type.

    • -rule: Specifies a classification rule in the format of "priority?rule?action"

  • removeRule: Removes a classification rule from a work class. The rule is no longer used by the ODR.

    • -type: Type of work class to modify:

      • ASP: application service policy

      • ARP: application routing policy

      • GSP: generic server service policy

      • GRP: generic server routing policy

    • -appname: Name of the application. Required if specified the --type parameter as ASP or ARP.

    • -odrname: Name of the on demand router (ODR). Required if specified the --type parameter as GSP or GRP.

    • -wcname: Unique name for the work class within the specified type.

    • -expression: Rule expression.

    • -priority: Priority of the rule to match. The rule with the lowest priority is matched first.

  • listRules: Lists classification rules.

    • -type: Type of work class to modify:

      • ASP: application service policy

      • ARP: application routing policy

      • GSP: generic server service policy

      • GRP: generic server routing policy

    • -appname: Name of the application. Required if specified the --type parameter as ASP or ARP.

    • -odrname: Name of the on demand router (ODR). Required if specified the --type parameter as GSP or GRP.

    • -wcname: Unique name for the work class within the specified type.

  • modifyDefaultAction: Edits the default action for a work class.

    • -type: Type of work class to modify:

      • ASP: application service policy

      • ARP: application routing policy

      • GSP: generic server service policy

      • GRP: generic server routing policy

    • -appname: Name of the application. Required if specified the --type parameter as ASP or ARP.

    • -odrname: Name of the on demand router (ODR). Required if specified the --type parameter as GSP or GRP.

    • -wcname: Unique name for the work class within the specified type.

    • -wcaction: Specifies the default action to take when a request is matched to a member for the specified work class.

  • getDefaultAction: Default action for a work class.

    • -type: Type of work class to list:

      • ASP: application service policy

      • ARP: application routing policy

      • GSP: generic server service policy

      • GRP: generic server routing policy

    • -appname: Name of the application. Required if specified the --type parameter as ASP or ARP.

    • -odrname: Name of the on demand router (ODR). Required if specified the --type parameter as GSP or GRP.

    • -wcname: Unique name for the work class within the specified type.

  • modifyVirtualHost: Edits the virtual host for a work class.

    • -type: Type of work class to modify. The valid types are GSP and GRP.

    • -odrname: Name of the on demand router (ODR). Required if specified the --type parameter as GSP or GRP.

    • -wcname: Unique name for the work class within the specified type.

    • -virtualhost: Virtual host. Required if specified the --type parameter as GSP or GRP.

  • getVirtualHost: Lists the virtual host for a work class.

    • -type: Type of work class to list. The valid types are GSP and GRP.

    • -odrname: Name of the on demand router (ODR). Required if specified the --type parameter as GSP or GRP.

    • -wcname: Unique name for the work class within the specified type.


Example

List all work classes:

List all work classes for application Trade:

Create a HTTP application routing policy work class for application Trade with a default action of reject and reject code of 404:

List all routing policy work classes for application Trade:

View the default action of a HTTP application routing policy work class for application Trade:

Modify the default action to Default_TC in a HTTP application service policy work class for application Trade-edition1.0:

Map the default HTTP work class of edition 1.2 of the DayTrader application to the default transaction class for the service policy GOLD:

import java.lang.System as System  wasinstallroot=System.getProperty("was.install.root")
execfile(wasinstallroot+"/bin/IMPPYModules.py")
import java.lang.System as System  wasinstallroot=System.getProperty("was.install.root")
execfile(wasinstallroot+"/bin/IMPPYModules.py")
 #application with name DayTrader installed with edition 1.2
appName="DayTrader-edition1.2"
#Default_TC_GOLD is the default transaction class mapped to service policy GOLD
modifyAppSLADefaultAction("Default_HTTP_WC", appName, tcName, 0)
 AdminConfig.save()

For transitioning users: The WebSphere Virtual Enterprise command that equates to IMPPYModules.py is XDPYModules.py. If we are making the transition from WebSphere Virtual Enterprise, we can continue to use the XDPYModules.py command, which operates the same as the IMPPYModules.py command.trns

Add a classification rule to the application service policy work class for application Trade:

Remove a classification rule by priority from the application service policy work class for application Trade:

Remove a HTTP application routing policy work class for application Trade:


Related concepts

  • Overview of work classes

  • Intelligent Management: routing and service policies