hosts(n,h s;j)

Description:

Return a sequence of available nodes.

Syntax

hosts(n,hs;j)

Note:

The function finds the number of memory zone holding task j across a node list hs, and returns a sequence of available nodes in the format of 1,…,n.

 

If the target memory zone cannot be found on a certain node, execute initiation using init.dfx on it where the function gets null. The function returns null if it cannot find the sufficient number of available nodes.

 

The function returns a sequence of all nodes, where the unavailable nodes are recorded as nulls.

Parameter:

n

The number of nodes

hs

A node sequence

j

Task name

Return value:

A node sequence

Example:

Parameter configuration for init.dfx on node 192.168.46.1:

Parameter configuration for init.dfx on node 192.168.31.39:

init.dfx script:

 

A

B

 

1

if i>0

 

 

2

 

=file("emp.ctx":i)

1.emp.ctx and 2.emp.ctx are respectively stored in the main paths of node 192.168.46.1 and node 192.168.31.39.

3

 

=B2.open().cursor().fetch()

 

4

 

>env(EMP,B3)

Store B3’s result in global variable EMP.

Start node 192.168.46.1:8281 and node 192.168.31.39:8281, search for the available nodes, and compute data stored in the specified memory zone:

 

A

B

 

1

[192.168.46.1:8281,192.168.31.39:8281,192.168.46.1:8282]

 

 

2

=hosts(2,A1;"task1")

 

Return a sequence of nodes containing task 1 in memory zones 1 and 2 from A1’s node sequence.

3

if A2!=null

 

Judge whether A2 can find an enough number of available nodes after it is executed, and return null if it cannot.

4

 

=memory(A2,EMP)

Generate a cluster composite table using the global variables EMP stored in the memory zones of all nodes found in A2.

5

 

=B4.cursor().fetch()

Query data in A4’s cluster composite table.

6

else

 

 

7

 

>output("ERROR!")

 

8

=hosts(0,A1;"task1")

 

With parameter n being 0, return a sequence of all nodes the unavailable one is recorded as null.