External Module Developer's Manual

This document describes how to develop a Ninf-G External Module.



1. Introduction

Ninf-G implements a function called "External Module." External Module abstracts the functions of Ninf-G and implements the function as a separate process. These functions include (1) invocation of jobs (called "Invoke Server"), (2) communication between Ninf-G Client and Ninf-G Executable (called "Communication Proxy"), (3) Information services of Ninf-G Executable (called "Information Service"). Implementation of these functions depends on the underlying grid middleware. Abstracting the difference of the implementations, External Module provides the same interface for Ninf-G. In order to adopt a new grid middleware, it is required to implement External Module by the grid middleware.

Any user is able to implement an External Module to support a new grid middleware.

2. External Module

2.1 Detailed overview of External Module

Invoke Server, Communication Proxy, and Information Service are External Modules. Some features are common for all External Modules though each External Module has its own feature.

Common feature of External Module is as follows.

2.2 Protocol of External Module

2.2.1 Protocol Overview

A Ninf-G Client(Ninf-G Executable) and External Module exchange three types of messages: Request, Reply, and Notify. A Request message is sent from a Ninf-G Client(Ninf-G Executable) to External Module. Reply and Notify messages are sent from External Module to the Ninf-G Client(Ninf-G Executable). The Ninf-G Client(Ninf-G Executable) assumes that a Reply message must be returned from External Module when the Ninf-G Client (Ninf-G Executable) sends a Request message. A Notify message is used to send messages from External Module to the Ninf-G Client(Ninf-G Executable) asynchronously. Three different pipes are used for sending these three types of message.

Namefddirection
Requeststdin Ninf-G
Client
(Executable)
---->External
Module
Replystdout <----
Notifystderr <----

All messages are sent as plain text. The Return code (<RET>) is 0x0d0a. The Return code is a delimiter that determines the unit of messages.

2.2.2 Request

Request have two types, one is described by one line and the other one is described by multiple lines. Each request has respective type.

In one line type request, parameters for the request is delimited by space character, and the parameter cannot include space characters. The request is expressed as follows:


<Request Name> <Parameter> <Parameter> ...<RET>

On multiple line type request, request name is on the first line. Following lines are expressed as attribute name, space character and attribute value. The attribute name cannot include space character. The end of the request is expressed as "request name _END." The request is expressed as follows:


<Request Name><RET> 
<Attribute Name> <Attribute Value><RET> 
<Attribute Name> <Attribute Value><RET> 
... 
<Request Name>_END<RET> 

There is one common request on External Module. The QUERY_FEATURES request is prepared to query features implemented on the specific External Module. This request is issued just after the External Module process invocation. This request is a one line type request, and have no parameter.

2.2.3 Reply

Reply also has two types, one is described by one line and the other one is described by multiple lines. The each reply has respective type.

In one line type reply, return success or failure as a parameter followed by the return value. On successful, "S" is returned followed by a return value. On failure, "F" is returned followed by an error message. The reply is expressed as follows:


S <Return Value> | F <Error Message><RET>

On multiple line type reply, "SM" is returned on the first line. The failure cannot be expressed. Following lines are expressed as attribute name, space character and attribute value. The attribute name cannot include space character. The end of the reply is expressed as "REPLY_END." The request is expressed as follows:


SM<RET> 
<Attribute Name> <Attribute Value><RET> 
<Attribute Name> <Attribute Value><RET> 
... 
REPLY_END<RET> 

The QUERY_FEATURES reply is a multiple line type reply. On the reply, there are 3 type of information. "protocol_version", "feature" and "request" are replied.

2.2.4 Notify

Notify also has two types as same as Request.

In one line type request, the Notify is expressed as follows:


<Notify Name> <Parameter> <Parameter> ...<RET> 

In multiple line type request, the Notify is expressed as follows:


<Notify Name><RET> 
<Attribute Name> <Attribute Value><RET> 
<Attribute Name> <Attribute Value><RET> 
... 
<Notify Name>_END<RET> 

3. Invoke Server

3.1 Introduction

A Ninf-G Client invokes a Ninf-G Executable on the server machine when a function requiring initialization of function/object handles, such as grpc_function_handle_init(), is called. Ninf-G, Version 2, implements the remote process invocation using the Globus Toolkit's Pre-WS GRAM feature. Implemented using the Globus API, the invocation mechanism has been embedded in Ninf-G. In order to utilize other systems, such as WS GRAM, UNICORE, or Condor for remote process invocation, Ninf-G, Version 5, implements the invocation mechanism as a separate module called "Invoke Server." This design enables users and developers to implement and add a new Invoke Server that can utilize any job invocation mechanism.

Ninf-G Version 5.0.0 includes the following Invoke Servers:

3.1.1 Overview of a typical client application

Here is a typical flow of a Ninf-G Client application:

Invoke Server is required to implement initialization and finalization of the function/object handles which are described in steps (2) and (4).

3.1.2 Requirements for underlying middleware

The only requirement for underlying middleware is that the middleware must be capable of remote process invocation. Examples of such middleware include the Globus Toolkit Pre-WS GRAM, Globus Toolkit WS GRAM, UNICORE, Condor, and SSH.

3.1.3 Implementation overview

Invoke Server is an adapter for the underlying middleware and it handles requests from a Ninf-G Client. Invoke Server analyzes and processes the request sent from the Ninf-G Client and replies to the Ninf-G Client. For example, if Invoke Server receives a JOB_CREATE request from the Ninf-G Client, Invoke Server creates a Job ID, returns the Job ID to the Ninf-G Client, and invokes the job processes called for in the request.

Invoke Server can be implemented using any language. The details of the protocol existing between the Ninf-G Client and Invoke Server are described in Section 3.2

3.1.4 Execution flow

This section describes a sample RPC flow to a server called serverA via the Invoke Server, IS_SAMPLE.

The following figure illustrates the interaction between the Ninf-G Client, Invoke Server, and the Ninf-G Executable.

Interaction of Invoke Server

Figure 1: Interaction between the Ninf-G Client, Invoke Server and the Ninf-G Executable

3.2 Specification of Invoke Server

This section describes a detailed overview of Invoke Server and the protocol existing between a Ninf-G Client and Invoke Server.

3.2.1 Details of Invoke Server
  1. Invoke Server is invoked when a Ninf-G Client initializes a function/object handle on the remote server which Ninf-G Client is configured to use with the Invoke Server.

  2. The maximum number of jobs per Invoke Server is limited. If the number of jobs exceeds the limit, a new Invoke Server is invoked.

  3. Invoke Server exits the process if it receives an EXIT request from the Ninf-G Client. This request is sent when the Ninf-G Client calls grpc_finalize(). Invoke Server also exits the process if it is managing the maximum number of jobs and all jobs are terminated.

  4. Ninf-G Client does not wait for the termination of Invoke Server after the Ninf-G Client sends an EXIT request to Invoke Server.

  5. If the Ninf-G Client exits abnormally, the pipes will be disconnected. When Invoke Server detects that the pipes have been disconnected, Invoke Server must cancel all jobs and exit the process.

  6. The file names used with Invoke Server must follow the naming convention of "ng_invoke_server" + suffix, where the suffix corresponds to rules for the underlying middleware used for remote process invocation.

3.2.2 Protocol between a Ninf-G Client and Invoke Server
3.2.2.1 Overview

A common feature of External Module protocol is described in Section 2.2. A protocol specific to Invoke Server is described in the following sections.

3.2.2.2 Request

Five Request messages, JOB_CREATE, JOB_STATUS, JOB_DESTROY, EXIT, and QUERY_FEATURES are supported.

  1. JOB_CREATE
  2. JOB_STATUS
  3. JOB_DESTROY
  4. EXIT
3.2.2.3 Reply

Invoke Server must send a Reply message to a Ninf-G Client if Invoke Server receives a Request message from that Ninf-G Client.

3.2.2.4 Notify

A Notify message is used to send an asynchronous message from Invoke Server to a Ninf-G Client. Two types of Notify message are provided.

  1. CREATE_NOTIFY
  2. STATS_NOTIFY
3.2.2.6 JOB_CREATE Request

This section describes the details of a JOB_CREATE Request.

3.3 How to specify Invoke Server

Invoke Server is specified by the Ninf-G Client using a Client configuration file.
3.3.1 How to specify Invoke Server

Invoke Server is specified by using the invoke_server attribute in the <SERVER> section.


invoke_server [type]

Type specifies the type of the Invoke Server, such as GT4py or UNICORE.

3.3.2 How to pass information to Invoke Server

Invoke Server may require options for its execution. Such options can be specified by an option attribute in the <INVOKE_SERVER> section or by an invoke_server_option attribute in the <SERVER> section.


option [String]
invoke_server_option [String]

Multiple attributes can be specified in the <SERVER> or <INVOKE_SERVER> sections.

3.3.3 Polling interval

Invoke Server must check the status of jobs, and this may be implemented using polling. The polling interval can be specified by the status_polling attribute in the <INVOKE_SERVER> section.


status_polling [interval (seconds)]

3.3.4 Logfile

The filename of the Invoke Server's execution log can be specified by the invoke_server_log attribute in the <CLIENT> section.


invoke_server_log [filename]

If this attribute is specified, Invoke Server outputs logs to a file with the specified filename and file type of that Invoke Server.

The log_filePath attribute in the <INVOKE_SERVER> section can be used to specify a log file for a specific Invoke Server.


log_filePath [Log file name]

3.3.5 Maximum number of jobs per Invoke Server

The maximum number of jobs per Invoke Server can be limited by the max_jobs attribute in the <INVOKE_SERVER> section. If the number of requested jobs exceeds this value, the Ninf-G Client invokes a new Invoke Server and requests that Invoke Server to manage the new jobs.


max_jobs [maximum number of jobs]

3.3.6 How to specify the path of Invoke Server

If Invoke Server is not located in a pre-defined directory, the path attribute in <INVOKE_SERVER> can be used to specify the path of the Invoke Server.


path [path of the Invoke Server]

3.4 Miscellaneous Information

3.4.1 Job Timeout

The Job Timeout function is managed by the Ninf-G Client. Invoke Server is not responsible for the timeout.

3.4.2 Redirect stdout/stderr implemented using files

Redirect stdout/stderr is implemented using files.

4. Communication Proxy

4.1 Introduction

Communication Proxy mediates communications between Ninf-G Executable and Ninf-G Client.

Ninf-G Client communicates with Ninf-G Executables. At this time, if Communication Proxy is not used, direct TCP/IP connection from the Ninf-G Executable to the Ninf-G Client is performed.

If the Communication Proxy is used, following connection is performed.

  1. Ninf-G Executable invokes the Remote Communication Proxy and connects to it.

  2. Remote Communication Proxy connects to the Client Communication Proxy.

  3. Client Communication Proxy connects to the Ninf-G Client.

About connection of 2., any the communication method and Grid Middleware can be used to implement a Communication Proxy.

In communications between Ninf-G Client and Client Communication Proxy, and in communications between Ninf-G Executable and Remote Communication Proxy, a socket is used as Ninf-G protocol while the External Module protocol (request, reply and notify) is communicated with three pipes.

Ninf-G Version 5.0.0 includes the following Communication Proxy:

4.1.1 Execution flow

Following is the flow of connection from Ninf-G Executable to Ninf-G Client via Communication Proxy.

  1. If the Client Communication Proxy is not invoked, Ninf-G Client invokes the Client Communication Proxy and sends INITIALIZE Request to the Client Communication Proxy.

  2. The Client Communication Proxy receives INITIALIZE Request and initializes itself. Then returns INITIALIZE Reply to the Ninf-G Client.

  3. The Ninf-G Client sends PREPARE_COMMUNICATION Request, before requesting Invoke Server to invoke job related to function/object handle.

  4. The Client Communication Proxy returns the Reply, and prepares communication.

  5. The Client Communication Proxy sends COMMUNICATION_REPLY Notify to Ninf-G Client after the preparation of the communication is completed. At this time, COMMUNICATION_REPLY attributes sent to Ninf-G Client includes the information to connect to the Client Communication Proxy(We note "CCP connect info" here).

  6. The Ninf-G Client requests to the Invoke Server to invoke a Ninf-G Executable on the server. "CCP connect info" is also send to the Invoke Server.

  7. By the Invoke Server, a Ninf-G Executable on the server is invoked. The Ninf-G Executable invokes a Remote Communication Proxy.

  8. The Ninf-G Executable sends INITIALIZE Request to the Remote Communication Proxy with "CCP connect info."

  9. The Ninf-G Executable waits the INITIALIZE Reply from the Remote Communication Proxy.

  10. The Remote Communication Proxy prepares the connection from the Ninf-G Executable, and the address information to connect to the Remote Communication Proxy is returned to the Ninf-G Executable by INITIALIZE Reply.

  11. The Ninf-G Executable connects to the address which was returned from the Remote Communication Proxy.

  12. The Remote Communication Proxy connects to the address which is described in "CCP connect info", by respective way of Communication Proxy defines.

4.2 Specification of Communication Proxy

4.2.1 Details of Communication Proxy
4.2.2 Protocol between a Ninf-G Client (Ninf-G Executable) and Communication Proxy
4.2.2.1 Overview

A common feature of External Module protocol is described in Section 2.2. A protocol specific to Communication Proxy is described in the following sections.

4.2.2.2 Request

Four Request messages, INITIALIZE, PREPARE_COMMUNICATION, EXIT and QUERY_FEATURES are supported.

  1. INITIALIZE
  2. PREPARE_COMMUNICATION
  3. EXIT
4.2.2.3 Reply

Communication Proxy must send a Reply message to a Ninf-G Client (Ninf-G Executable) if Communication Proxy receives a Request message from that Ninf-G Client (Ninf-G Executable).

4.2.2.4 Notify

A Notify message is used to send an asynchronous message from Communication Proxy to a Ninf-G Client. One type of Notify message is provided.

  1. COMMUNICATION_REPLY

5. Information Service

5.1 Introduction

Information Service searches and retrieves the Ninf-G Executable information. Ninf-G Executable information is required when a function handle is creating. Information Service is a External Module, which enable to search and retrieve Ninf-G Executable information, without depending on specific Grid Middleware.

Ninf-G Version 5.0.0 includes the following Information Service:

5.2 Specification of Information Service

5.2.1 Details of Information Service
5.2.2 Protocol between a Ninf-G Client (Ninf-G Executable) and Information Service
5.2.2.1 Overview

A common feature of External Module protocol is described in Section 2.2. A protocol specific to Information Service is described in the following sections.

5.2.2.2 Request

Four Request messages, QUERY_REMOTE_EXECUTABLE_INFORMATION, CANCEL_QUERY, EXIT and QUERY_FEATURES are supported.

  1. QUERY_REMOTE_EXECUTABLE_INFORMATION
  2. CANCEL_QUERY
  3. EXIT
5.2.2.3 Reply

Information Service must send a Reply message to a Ninf-G Client if Information Service receives a Request message from that Ninf-G Client.

5.2.2.4 Notify

A Notify message is used to send an asynchronous message from Information Service to a Ninf-G Client. One type of Notify message are provided.

  1. REMOTE_EXECUTABLE_INFORMATION_NOTIFY

last update : $Date: 2008-11-11 18:22:06 +0900 (火, 11 11月 2008) $