callx(spl,...;hs;rspl)

Read(1043) Label: node, cellset file, reduce,

Description:

Allocate tasks of executing a script among a sequence of nodes, execute the script, and return a sequence of values returned by all tasks.

Syntax:

callx(spl,;hs;rdfx)

Note: 

The function allocates computing tasks among a sequence of nodes, executes spl script file, inherits task spaces, and returns a sequence of values returned by all tasks.

 

A subtask that abnormally terminates will be automatically given to another node to handle(skip one that already has a task to process). The subtask fails if there isn’t an available node. By default, the task will be allocated in order (The ith subtask is given to hs.m@r(i)) until each node reaches the specified workload limit. The allocation begins again when any one of the nodes releases resources and continues until all subtasks are allocated.

 

 

 

Only supported by esProc Enterprise Edition.

Parameter:

spl

A script file of .dfx/.splx format, for which an absolute or a relative path can be set.

The relative path is the Search Path under the Tool->Option-> [Environment] menu. When esProc is integrated into a third-party application, the search path is the value of splPath node set in raqsoftConfig.xml.

The parameter for passing value to .dfx/.splx. It is usually in the form of a sequence. The number of parameters to be passed to .dfx/.splx is the number of members in the sequence.

The parallel algorithm will divide a computational task into multiple subtasks according to the length of the parameter sequence and pass each member of the sequence to the corresponding subtask as the parameter value of .dfx/.splx.

hs

The server sequence in which each server is represented by a string in the form of "IP address:port number", such as "192. 168. 0. 86: 4001";

The absence of IP address means another process in the current physical machine; the absence of both IP address and port number while maintaining ":" means the current process.

rspl

A splx script that uses two parameters; it is used to specify a reduce action script. The script can be omitted.

The two parameters respectively represent the current cumulative value and the current returned value. The value returned by the splx script will be used as the new cumulative value. The initial cumjlative value is null.

By defining custom logics in the rspl script file, the parameter concatenates values returned by the multiple subtasks handled in nodes into a sequence, where members are arranged according to the server sequence.

 

Option:

@a

Allocate subtasks among nodes randomly.

@l

Allocating the one and single task to all available nodes; the task is regarded as completed as long as one of the nodes successfully gets it done, and processes  on the other nodes are then terminated.

Example:

test.splx is the node deployment file. The sequence of node machines is ["192.168.31.165:8281","192.168.31.39:8281"].

 

1. Single parameter

Below is test.splx:

 

A

1

=connect("demo").query("select * from SCORES  where SUBJECT=?",arg1)

2

return A1, A1.(SCORE)

 

Below is reduce.splx: 

 

A

 

1

=a|b

a and b are parameters used in reduce.splx; a represents the current cumulative value (initial value is null) and b is the current returned value (result returned by executing the script on the current node). “|” concatenates values returned by the current node. When all subtasks on the current node are finished, values returned by all subtasks will be concatenated and returned as  a sequence.

 

 

A

 

1

=["192.168.31.165:8281","192.168.31.39:8281"]

A sequence of nodes.

2

=callx("test.splx",["English","Math","PE"];A1)

Allocate the task in turn and return a sequence of values returned by all substasks.

3

=callx("test.splx",["English","Math","PE"];A1;"reduce.splx")

Allocate the task in turn, perform reduce action, and return a sequence of values returned by all substasks.

4

=callx@a("test.splx",["English","Math","PE"];A1;"reduce.splx")

Use @a option to allocate subtasks randomly.

5

=callx@1("test.splx",["English","Math","PE"];A1)

Use @1 option to terminate the other subtasks if one node finishes its job.

6

=callx("test.splx",["English","Math","PE"];":8281")

Execute script at port 8281 on the current machine.

7

=callx("test.splx",["English","Math","PE"];":")

Execute script in the current process.

2.  Multiple parameters

reduce.splx is the same, and test.splx is as follows:

 

A

1

=connect("demo")

2

=A1.query("select * from EMPLOYEE where EID in (?) and GENDER=?",arg1,arg2)

3

=A1.close()

4

return A2

 

 

A

 

1

=["192.168.31.165:8281","192.168.31.39:8281"]

A sequence of nodes.

2

=callx("test.splx",[1,20,6,14,5],"F";["192.168.31.165:8281"])

Pass two parameters  to one node, in which the query result of parameter [6,F] is null:

3

=callx("test.splx",[1,20,6,14,5],"F";A1;"reduce.splx")

Send multiple parameters to multiple nodes and distribute subtasks in turn, that is, giving [1,F], [6,F] and [5,F] to node "192.168.31.165:8281" and [20,F] and [14,F] to node "192.168.31.39:8281".

4

=callx("test.splx",[[1,20,6,14,5],[22,33,44]],"F";A1)

When multiple nodes receive the same value for one parameter, the parameter can be passed in the form of a single value, that is, passing [ [1,20,6,14,5],F ] to node "192.168.31.165:8281" and [[22,33,44],F] to node "192.168.31.39:8281".

5

=callx("test.splx",[[1,20,6,14,5],[22,33,44]],["F","M"];A1)

When multiple nodes receive the same parameter with different values, the parmeter will be passed in the form of a sequence, that is, passing [ [1,20,6,14,5],F ] to node "192.168.31.165:8281" and [[22,33,44],M] to node "192.168.31.39:8281".