TIBCO Streaming epadmin commands to update model and rule files in a cluster

TIBCO Streaming epadmin commands to update model and rule files in a cluster

book

Article ID: KB0074807

calendar_today

Updated On:

Products Versions
TIBCO Streaming 10

Description

StreamBase operators like the Decision Table, TERR, Tensorflow, and Python may use model, rules, or other artifact file types using the operator properties AMS Tab. Using the Artifact Management Server (AMS) I can update these files while a node is running and the operator will start using the new file immediately.

Can I update these files from the command line instead of using an Artifact Management Server (AMS) instance?

Issue/Introduction

command usage instructions

Resolution

Artifact files may be uploaded to the cluster and activated for use by their operators within the cluster using the ‘ epadmin’ commands ‘ load artifact’ and ‘ activate artifact’. This is enabled within a cluster when the application has an Artifact Distribution Service (ADS) configuration that identifies the specific files to be managed by project path, name, and type.

From documentation page:
    TIBCO Streaming > EP Commands > epadmin and epdev References > epadmin-artifact
"The epadmin artifact commands can be used to administer the packaged artifacts. artifact commands always make sure that the cluster-wide state of the managed artifacts are consistent, whether a command is sent to a single node, multiple nodes, or all nodes in a cluster."

An AMS server organizes artifact files into projects, and optionally paths within those projects. This file structure, " project/folder/artifact", must be duplicated within the " src/main/resources/" folder of the project in order to provide default versions of each artifact to manage. This is necessary since AMS will not be providing these artifacts when the server starts up.

Identify each artifact file in the "Artifacts" HOCON configuration file used to initialize the Artifact Distribution Service (ADS) within the cluster.

Example "ads.conf":
 name = "Artifacts-conf" type = "com.tibco.ep.streambase.configuration.ads" version = "1.0.0" configuration = { 	Artifacts = { 		artifacts = [  			{ 				artifactSource = "dtrules/rules.sbdt" 				latest = true 				name = "dtrules/rules" 				state = ACTIVE 				type = SB_DECISION_TABLE 				version = "1.0" 			}			 		] 	} }

The " name" setting matches the operator configuration for AMS, Project Name and Decision Table Path properties.

The " artifactSource" setting matches the " src/main/resources" sub-folders where the default artifact may be found.

The currently supported " type" values are documented in the Artifact Management Server documentation page :
  Artifact Management Server Guide > AMS Administration > Artifact Administration
  https://docs.tibco.com/pub/str/10.6.0/doc/ams/index.html#ams-art-admin.html

For the JPMML, TensorFlow, TERR, or H2O operators, the artifactSource path is defined on the AMS tab, Artifacts list, as so (example):
   Artifacts: [ "project1/h20_A.pojo", "project2/pojos/h20_B.pojo" ]
which would correspond to project paths " src/main/resources/project1/h20_A.pojo" and " src/main/resources/project2/pojos/h20_B.pojo".

The Python operator, AMS tab, only selects a single script artifact, identified by Name and Version. The Name contains the project path, such as "project1/scriptA.py".

For a Decision Table (DT), the artifact (rule file) path is defined on the Decision Table Settings tab.
SB Studio Decision Table properties for using ADS
The DT operator properties only specify that AMS/ADS is in use and the artifact path is:
  Project Name: dtrules 
  Decision Table Path: rules 


Each of the operators must have ADS enabled in their StreamBase properties, the Decision Table operator needs " Load from AMS" and " Use ADS" checked. The other operators need property " Required On Startup" checked (enabled, true).

Examine the artifact state in the running server using command:
  epadmin servicename=A.X display artifact

The commands to load and activate a new rules file are:

1. epadmin servicename=A.X load artifact type=SB_DECISION_TABLE name=dtrules/rules version=1.1 sourcefile=./rules2.sbdt
  • After this command, all rules files are loaded and distinguished by version numbers 1.0 and 1.1.
  • The version number simply identifies that the files are different within the cluster and does not have a relation to actual version numbers within the file or in the file-name.
2. epadmin servicename=A.X activate artifact type=SB_DECISION_TABLE name=dtrules/rules version=1.1 latest=true
  • After this command, all rules files are Active, but only the 1.1 version is "latest" which forces the DT operator to use the new rules file because in its properties no version was specified (default = latest).
  • Use this command to switch between loaded rules versions by changing only the version number..

Additional Information

  Artifact Management Server Guide > AMS Administration > Artifact Administration