Ophidia terminal is a robust, comprehensive, effective and extremely usable command line client. We chose to develop a program without GUI with characteristics similar to the bash program present in almost all Unix-like environments. In fact, the client is a real terminal (or shell) full of useful features such as the management of the commands history, the management of specific environment variables, a manual with the description of commands and variables, the management of key combinations for the smart-editing of the command line and more. The terminal is able to interact with the Ophidia server, allowing proper authentication of the user in addition to the rendering of responses.
The terminal handles requests for execution of a particular Ophidia operator sending the server the sequence of the appropriate parameters; in case of local commands the corresponding functions of Oph-Terminal are directly called instead. In both situations, once obtained the required output, the program provides a mechanism for the proper display of the contents, and then returns back in the state of waiting for a new command.
This guide provides the essential knowledege necessary to execute Ophidia operations, however the terminal provides a lot of other features and functionalities which are depicted in the terminal advanced features section.
Oph-Terminal provides several options to be specified on the command line. It is possible to start the terminal simply by running the executable file with no special options; in this case the terminal looks for all its variables, such as OPH_USER or OPH_TERM_PS1, in the Linux environment, and for each defined and non-empty variable consequently sets its environment. The user can specify the values of these recurring variables directly at the start-up of the system shell, with the appropriate startup files like .bashrc in his home.
Another possibility is to specify the connection parameters directly at startup with certain options, similarly to what happens for example with the MySQL CLI:
-u oph-testyou can specify the value to assign to OPH_USER;
-p abcdyou can specify the value of OPH_PASSWD;
-H server.hostnameyou can specify the value of OPH_SERVER_HOST;
-P 11732you can specify the value of OPH_SERVER_PORT.
Using one or more of the above options, any corresponding value defined in the user Linux environment is not used, so as to ensure a higher priority to the parameters explicitly specified by the user at boot time. An example of command to start the terminal will look like the following:
/usr/local/ophidia/oph-terminal/bin/oph_term -H 127.0.0.1 -u oph-test -p abcd -P 11732
In case of options
-v Ophidia Terminal is not started but it returns information relating respectively to the different ways to start the application and the version of the program.
In addition to the synchronous mode, it is also possible to start the application and run a command in asynchronous mode with the
Immediately after the start, the user is able to use all the implemented commands, with the tranquility of always receiving a notice explaining an eventual error and with the possibility to continue the work session without restarting the program. At the end of the session the terminal can be closed simply typing quit or exit.
Any operation involving one or more operators present in the Ophidia framework can be performed directly calling that operator, using a submission string characterized by the following syntax:
Immediately after the operator name, you must enter the submission string to be sent to the server, which is responsible for interpreting it correctly. The above string consists of key-value pairs containing the equal sign and separated by semicolons. The values assigned to the terms param1,..., paramN can contain any spaces, unlike the names of these parameters, which must occur as single words, separated by ; and =.
There are five more special parameters (keywords), common to all operators:
The exec_mode parameter may be async, to start an operator in asynchronous mode and receive only the identifier of the running job, or sync, to start an operator in synchronous mode waiting for the response arriving from the server. The user has the option to explicitly specify the value of exec_mode or not: in the first case it is always used the value contained in the submission string, while, in case of absence, the terminal first tries to concatenate the value of the OPH_EXEC_MODE environment variable, if present, or lets the server assign the default value async.
The same procedure is performed for the other parameters. In case of ncores the corresponding variable is OPH_NCORES and the default value is equal to 1. Regarding sessionid the associated variable is OPH_SESSION_ID and the corresponding value, if present, is concatenated to the string, if the user does not specify it directly at the time of executing the command. However, in case of no usable value, the server does not use a default value but creates a completely new session with a new identifier that Oph-Terminal manages to automatically associate to OPH_SESSION_ID, so that it can be used in subsequent requests.
Once a request has been sent to the server the obtained response may be of two types:
In both situations, the command automatically extracts from the JobID the sessionid and sets the variable OPH_SESSION_ID to that value. The user may possibly perform a switch between one session and another by changing the environment variable OPH_SESSION_ID with the setenv command, or it can ask the server to create a new session using the command unsetenv OPH_SESSION_ID. The server will actually create the new working session upon reception of the first request with no session associated with it.
[OPH_TERM] >> oph_reduce cube=http://localhost/1/1;operation=max;
Other examples can be found for each operator in the Operator Manual Operators Manual section.