Transformer Pipeline Module API Reference  8.0.2.290852-a608fcd3
System information

Detailed Description

The functions in this package provide access to information about the system.

Functions

 system.scriptid ()
 Retrieve the id of the currently running pipeline script. More...
 
 system.version ()
 Retrieve the version of the currently running pipeline module. More...
 
 system.expand (var pattern)
 Perform substitutions on a string. More...
 
 system.threadindex (var pattern)
 Return the current thread number. More...
 
 system.get_pipeline (var scriptid)
 Return configuration information for the specified pipeline. More...
 
 system.delete_pipeline (var scriptid)
 Delete the specified pipeline. More...
 
 system.millitime ()
 Return the number of milliseconds since the Epoch. More...
 
 system.time ()
 Return the number of seconds since the Epoch. More...
 
 system.difftime (var time0, var time1)
 Calculate time difference. More...
 
 system.udpsignal_send (var msg)
 Send a UDP message to this Transformer. More...
 
 system.udp_sendto (var addr, var port, var message)
 Send data to a UDP address. More...
 
 system.set_status_down (var peer_label)
 Set peer status down. More...
 
 system.set_status_up (var peer_label)
 Set peer status up. More...
 
 system.peer_label_byindex (var index)
 Return the peer label corresponding to a peer index. More...
 
 system.peer_index_bylabel (var label)
 Returns the peer index corresponding to a peer label. More...
 
 system.peer_status_bylabel (var label)
 Returns the peer status for a given peer label. More...
 
 system.num_peers ()
 Return the number of configured peers in the system ( if Discovery mode if off ) Return the highest peer index ( if Discovery mode if on ) More...
 
 system.strptime (var timestamp, var format)
 Parse a timestamp according the give timestamp format. More...
 
 system.peer_enabled_bylabel (var label)
 Returns whether a peer is enabled or not. More...
 
 system.hostname ()
 Returns the hostname. More...
 
 system.pipelines_for_symbol (var name)
 Returns the pipeline id's for a given symbol. More...
 
 system.get_log_level ()
 Get the current logging level for the pipeline log. More...
 

Function Documentation

system.delete_pipeline ( var  scriptid)

Delete the specified pipeline.

Parameters
scriptid- The scriptid of the pipeline which will be deleted
Return values
0- Success
nil- Failure (pipeline does not exist)

This function will delete the in-memory configuration of the specified pipeline. No more events will be passed into the pipeline and its configuration cannot be retrieved after this call.

system.difftime ( var  time0,
var  time1 
)

Calculate time difference.

Parameters
time0- First time
time1- Second time
Returns
The number of seconds elapsed between time time1 and time time0
system.expand ( var  pattern)

Perform substitutions on a string.

Parameters
pattern- The string to perform substituions on
Returns
An expanded string with all appropriate substitutions made

This function will expand the following tokens in the supplied argument:

  • %h The hostname
  • %a The application name (as set by the configuration option application-name)
  • %n The application name (as set by the configuration option application-name)
  • %r The application root (as set by the configuration option application-root)
  • %u The home directory of the process owner.
system.get_log_level ( )

Get the current logging level for the pipeline log.

Returns
- The logging level. See Logging routines for the possible values
system.get_pipeline ( var  scriptid)

Return configuration information for the specified pipeline.

Parameters
scriptid- The scriptid of the pipeline whose configuration should be returned

This function will return an object of type Dynamic pipeline configuration that can be queried and set to adjust the configuration of the specified pipeline

system.hostname ( )

Returns the hostname.

Returns
The hostname
system.millitime ( )

Return the number of milliseconds since the Epoch.

Return values
numberof milliseconds since the Epoch
system.num_peers ( )

Return the number of configured peers in the system ( if Discovery mode if off ) Return the highest peer index ( if Discovery mode if on )

Returns
The number of peers
system.peer_enabled_bylabel ( var  label)

Returns whether a peer is enabled or not.

Parameters
label- Peer label to return the state for
Return values
0- Peer is disabled
1- Peer is enabled
system.peer_index_bylabel ( var  label)

Returns the peer index corresponding to a peer label.

Parameters
label- Peer label to return the index for
Returns
The peer index
Return values
-1- Peer label not known
system.peer_label_byindex ( var  index)

Return the peer label corresponding to a peer index.

Parameters
index- Peer index to return the label for
Returns
The peer label
Return values
Peer<index>- If peer index is not defined
system.peer_status_bylabel ( var  label)

Returns the peer status for a given peer label.

Parameters
label- Peer label to return the status for
Return values
0- Peer is down
1- Peer is up
system.pipelines_for_symbol ( var  name)

Returns the pipeline id's for a given symbol.

Parameters
name- Name of symbol
Returns
- A table containing the id's of the matching pipelines
Return values
nil- No matching pipleines found
system.scriptid ( )

Retrieve the id of the currently running pipeline script.

Returns
The script id

The id that is returned is that configured in add-pipeline configuration group

system.set_status_down ( var  peer_label)

Set peer status down.

Parameters
peer_label- Label of peer to send status to - if not present then status sent to all peers
Return values
0- Success
-1- peer_label did not match any peers
system.set_status_up ( var  peer_label)

Set peer status up.

Parameters
peer_label- Label of peer to send status to - if not present then status sent to all peers
Return values
0- Success
-1- peer_label did not match any peers
system.strptime ( var  timestamp,
var  format 
)

Parse a timestamp according the give timestamp format.

Parameters
timestamp- Time stamp to parse
format- The format to apply
Returns
A table containing information regarding the date
Return values
nil- The timestamp could not be parsed

The table has the following fields: year (four digits), month (1–12), day (1–31), hour (0–23), min (0–59), sec (0–61), wday (weekday, Sunday is 1), yday (day of the year), and isdst (daylight saving flag, a boolean).

To obtain a value in unix timestamp format the returned table can be supplied to the standard os.time() function, and then operations such as difftime may be applied.

Should format not be supplied, then the format defaults to: "%Y-%m-%dT%H:%M:%SZ" as per timers

system.threadindex ( var  pattern)

Return the current thread number.

Returns
The currently executing thread index

This function will return the current thread number (from 0 to num-threads - 1). It is primarily of use for testing purposes

system.time ( )

Return the number of seconds since the Epoch.

Return values
numberof seconds since the Epoch
system.udp_sendto ( var  addr,
var  port,
var  message 
)

Send data to a UDP address.

Parameters
addr- The host name or IP address for the UDP port
port- The UDP port number
message- The data to send
Return values
Numberof bytes sent
-1- Error sending message
system.udpsignal_send ( var  msg)

Send a UDP message to this Transformer.

Parameters
msg- The message to send in the form "COMMAND ARG1 ARG2 ..."
Return values
None
Note
The UDP command should be the first field of the message string.
system.version ( )

Retrieve the version of the currently running pipeline module.

Returns
Pipeline module version

The version returned is in the form X.Y.Z where X is the major, Y the minor and Z the patch version.


Generated on Wed Jul 31 2024 18:00:22 for Transformer Pipeline Module API Reference