callx( dfx,...;h,s;x )

Description:

Compute cellset file dfx with parallel processing and return a sequence composed of result sets of the multiple subtasks.

Syntax:

callx(dfx,;h,s;x)

Note: 

The function distributes the computing task among the node process list h and executes script dfx. If the value of parameter … is a multi-member sequence, pass the members to their corresponding threads; if the parameter is a single value, just copy it to pass to every thread. The length of the sequence is the number of subtasks to be performed; if the parameter is omitted, the number of subtasks to be performed is that of the nodes and parameters s and x will be ignored.

A subtask that terminates due to abnormal termination will be given to another node to handle. It fails if there isn’t an available node. It is regarded as an abnormal termination if a subtask happens to be given to an unavailable node.

Parameter x defines a reduce action. The function returns a sequence consisting of the result sets of the subtasks if x is absent. When x is present, the function calculates the reduce expression using ~, the result of each subtask, and ~~, the current reduce result, replaces ~~ with the result of x to go on calculating reduce and returns the final result of ~~, which is the sequence of all node results.  

 

Parameters:

dfx

The cellset file, for which an absolute or a relative path can be set. The relative path is the Search Path under the Tool->Option-> [Environment] menu.

x

Reduce action; can be omitted

The parameter for passing value to dfx. It is usually in the form of a sequence. The number of parameters to be passed to dfx is the number of the sequences. 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. If a parameter is single-value, then it will be copied to every subtask.

h

The server sequence in which each server is represented by a string in the form of "address:port number", like "192. 168. 0. 86: 4001". By default, the servers will not be specified, and the computation will be distributed to multiple threads in the current process.

s

A sequence made up of integer sequences

Options:

  @a  Enable a random allocation that allocates subtasks randomly and evenly to nodes and where both parameter s and parameter x are ignored and computing capcity isnn’t taken into consideration. If a node happens to be invalid or returns an error, replace it with another.

@l

Enable a simple allocation that allocates subtasks to nodes according to computing capacity before starting nodes to compute and where both parameter s and parameter x are ignored and the number of subtasks is less than that of the nodes.

@m

Enable a heavy allocation where the number of subtasks is greater than that of the nodes.

Find the node(s) that have the largest computing capacity and allocate subtasks randomly to it/them until the number of the remaining subtasks is less than a certain threshold value. Then start nodes to compute. A node will ask for more subtasks after it finishes the current one(s). The whole task fails if any one of the subtask fails. An unavailable node (whose value is null in the server sequence h) won’t receive any job.

When parameter s is present, the corresponding data zone s(i) is needed to handle subtask i. So the subtask should be allocated to a node containing data zone s(i).

When parameter s is absent, allocate subtasks randomly among all available nodes.

Return a sequence consisting of the result sets of the subtasks if x is absent. When x is present, perform a certain reduce action on each node and return a sequence of all node results. An unavailable node will take a place in the returned sequence.

 

Example:

test.dfx is the deployment file for the remote node server. The node machines are respectively the [”192.168.0.204”,” 192.168.0.205”,” 192.168.0.206”], and the port number is 8081. The file contents are shown below:

1)  Single Parameter

 

A

B

1

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

2

return A1

return A1.(SCORE)

 

 

A

 

1

=callx("test.dfx",["English","Math","PE"];["192.168.0.204:8081","192.168.0.205:8281","192.168.0.206:8081"])

Subtasks are allocated strictly in order as there are same number of servers 

2

=callx@a("test.dfx",["English","Math","PE"];["192.168.0.204:8081","192.168.0.205:8081"])

A random allocation that allocates subtask parameters randomly to nodes

3

=callx@l("test.dfx",["English"];["192.168.0.204:8081","192.168.0.205:8081"])

A simple allocation that allocates subtask parameters to nodes according to computing capacity

4

=callx@m("test.dfx",["English","Math","PE","Chinese"];["192.168.0.204:8081","192.168.0.205:8081","192.168.0.206:8081"])

A heavy allocation that allocates subtask parameters to nodes; since node 192.168.0.204:8081 is unavailable, it won’t receive any job

2)  Multiple Parameters

 

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

=callx("test.dfx",[[1,20,6,14,5]],"F";"192.168.0.204:8081")

Pass two parameters, which are string type and sequence type respectively, to one node machine.

2

=callx("test.dfx",[[1,20,6,14,5],[22,33,44]],"F";["192.168.0.204:8081","192.168.0.205:8081"])

Send multiple parameters to multiple node machines. For a parameter that has the same value, it can be passed in the form of single value.

3

=callx("test.dfx",[[1,20,6,14,5],[22,33,44]],["F","M"];["192.168.0.204:8081","192.168.0.205:8081"])

When multiple node machines receive the same parameter with different values, the parmeter should be passed in the form of a sequence.

4

=callx@l("test.dfx",[[1,20,6,14,5]],"M";["192.168.0.204:8081","192.168.0.205:8081"])

A simple allocation that allocates subtask parameters to nodes according to computing capacity

5

=callx@m("test.dfx",[[1,20,6,14,5],[5,89,100],[58,62,99]],"M";["192.168.0.204:8081","192.168.0.205:8081"])

A heavy allocation that allocates subtask parameters to nodes; both nodes contain zones 1,2,3, so the subtask 1 is given to zone 1 on node 192.168.0.204:8081, subtask 2 is given to zone 2 on node 192.168.0.205:8081, and subtask 3 is given to zone 3 on node 192.168.0.204:8081