Goto Chapter: Top 1 2 3 4 5 6 7 8 9 Bib Ind
Top of Book Previous Chapter Next Chapter

9 Service functions
9.1 Tools for making documentation
9.1-1 SCSCPBuildManual
9.1-2 SCSCPBuildManualHTML
9.2 Other commands
9.2-1 PingSCSCPservice
9.2-2 PingStatistic
9.2-3 InfoSCSCP
9.2-4 InfoMasterWorker
9.2-5 DateISO8601
9.2-6 CurrentTimestamp
9.2-7 Hostname
9.2-8 MemoryUsageByGAPinKbytes
9.2-9 LastReceivedCallID
9.2-10 IO_PickleToString
9.2-11 IO_UnpickleFromString

### 9 Service functions

#### 9.1 Tools for making documentation

##### 9.1-1 SCSCPBuildManual

`> SCSCPBuildManual`( ) | ( function )

This function is used to build the manual in PDF and HTML formats and also in the plain text format for the online help. To build the PDF version, a recent and fairly complete TeX distribution is recommended.

Since the SCSCP manual is distributed together with the package, it is not necessary for the user to use this function, which is normally used only by developers.

##### 9.1-2 SCSCPBuildManualHTML

`> SCSCPBuildManualHTML`( ) | ( function )

This function is used to build the manual only in HTML format. This does not require TeX installation and works in any operating system.

Since the SCSCP manual is distributed together with the package, it is not necessary for the user to use this function, which is normally used only by developers.

#### 9.2 Other commands

##### 9.2-1 PingSCSCPservice

`> PingSCSCPservice`( hostname, portnumber ) | ( function )

Returns: `true` or `fail`

This function returns `true` if the client can establish connection with the SCSCP server at hostname:portnumber. Otherwise, it returns `fail`.

    gap> PingSCSCPservice("localhost",26133);
    #I  Creating a socket ...
    #I  Connecting to a remote socket via TCP/IP ...
    #I  Got connection initiation message
    true
    gap> PingSCSCPservice("localhost",26134);
    #I  Creating a socket ...
    #I  Connecting to a remote socket via TCP/IP ...
    Error: rec(
      number := 61,
      message := "Connection refused" )
    fail

##### 9.2-2 PingStatistic

`> PingStatistic`( hostname, portnumber, n ) | ( function )

Returns: nothing

The function is similar to the UNIX `ping`. It tries n times to establish connection with the SCSCP server at hostname:portnumber, and then displays statistical information.

    gap> PingStatistic("localhost",26133,5);
    #I  Creating a socket ...
    #I  Connecting to a remote socket via TCP/IP ...
    #I  Got connection initiation message nr 1
    ...
    #I  Creating a socket ...
    #I  Connecting to a remote socket via TCP/IP ...
    #I  Got connection initiation message nr 5
    100 packets transmitted, 100 received, 0% packet loss, time 26ms
    min/avg/max = [ 0, 13/50, 2 ]

##### 9.2-3 InfoSCSCP

`> InfoSCSCP` | ( info class )

`InfoSCSCP` is a special Info class for the SCSCP package. The amount of information to be displayed can be specified by the user by setting InfoLevel for this class from 0 to 4, and the default value of InfoLevel for the package is specified in the file `scscp/config.g`. The higher the level is, the more information will be displayed. To change the InfoLevel to `k`, use the command `SetInfoLevel(InfoSCSCP, k)`. In the following examples we demonstrate various degrees of output details using Info messages.

    gap> EvaluateBySCSCP( "WS_Factorial",[10],"localhost",26133);
    #I  Creating a socket ...
    #I  Connecting to a remote socket via TCP/IP ...
    #I  Got connection initiation message
    #I  Request sent ...
    #I  Waiting for reply ...
    rec( object := "3628800", attributes := [ [ "call_id", "localhost:26133:38" ] ] )

    gap> SetInfoLevel(InfoSCSCP,0);
    gap> EvaluateBySCSCP( "WS_Factorial",[10],"localhost",26133);
    rec( object := "3628800", attributes := [ [ "call_id", "localhost:26133:41" ] ] )

    gap> SetInfoLevel(InfoSCSCP,3);
    gap> G:=SymmetricGroup(4);;
    gap> gens:=GeneratorsOfGroup(G);
    [ (1,2,3,4), (1,2) ]
    gap> EvaluateBySCSCP( "GroupIdentificationService",[gens],"localhost",26133);
    #I  Creating a socket ...
    #I  Connecting to a remote socket via TCP/IP ...
    #I  Got connection initiation message
    #I Composing procedure_call message:
    <?scscp start ?>
    <OMOBJ>
        <OMATTR>
    		<OMATP>
    			<OMS cd="scscp1" name="call_id"/>
    			<OMSTR>localhost:26133:1212</OMSTR>
    		</OMATP>
    		<OMA>
    			<OMS cd="scscp1" name="procedure_call"/>
    			<OMA>
    				<OMS cd="scscp_transient_1" name="GroupIdentificationService"/>
    				<OMA>
    					<OMS cd="list1" name="list"/>
    					<OMA>
    						<OMS cd="permut1" name="permutation"/>
    						<OMI> 2</OMI>
    						<OMI> 3</OMI>
    						<OMI> 4</OMI>
    						<OMI> 1</OMI>
    					</OMA>
    					<OMA>
    						<OMS cd="permut1" name="permutation"/>
    						<OMI> 2</OMI>
    						<OMI> 1</OMI>
    					</OMA>
    				</OMA>
    			</OMA>
    		</OMA>
    	</OMATTR>
    </OMOBJ>
    <?scscp end ?>
    #I  Request sent ...
    #I  Waiting for reply ...
    #I  <?scscp start ?>
    #I Received message:
    <OMOBJ>
    	<OMATTR>
    		<OMATP>
    			<OMS cd="scscp1" name="call_id"/>
    			<OMSTR>localhost:26133:1212</OMSTR>
    		</OMATP>
    		<OMA>
    			<OMS cd="scscp1" name="procedure_completed"/>
    			<OMA>
    				<OMS cd="list1" name="list"/>
    				<OMI> 24</OMI>
    				<OMI> 12</OMI>
    			</OMA>
    		</OMA>
    	</OMATTR>
    </OMOBJ>
    #I  <?scscp end ?>
    #I  Got back: object [ 24, 12 ] with attributes [ [ "call_id", "localhost:26133:1212" ] ]
    rec( object := [ 24, 12 ], attributes := [ [ "call_id", "localhost:26133:1212" ] ] )

##### 9.2-4 InfoMasterWorker

`> InfoMasterWorker` | ( info class )

`InfoMasterWorker` is a special Info class for the Master-Worker skeleton `ParListWithSCSCP` (8.2-1). The amount of information to be displayed can be specified by the user by setting InfoLevel for this class from 0 to 5, and the default value of InfoLevel for the package is specified in the file `scscp/config.g`. The higher the level is, the more information will be displayed. To change the InfoLevel to `k`, use the command `SetInfoLevel(InfoMasterWorker, k)`. In the following examples we demonstrate various degrees of output details using Info messages.

    gap> SetInfoLevel(InfoSCSCP,0);
    gap> SetInfoLevel(InfoMasterWorker,2);
    gap> ParListWithSCSCP( List( [2..6], n -> SymmetricGroup(n)), "WS_IdGroup" );
    #I  1/5:master --> localhost:26133
    #I  2/5:master --> localhost:26134
    #I  3/5:master --> localhost:26133
    #I  4/5:master --> localhost:26134
    #I  5/5:master --> localhost:26133
    [ [ 2, 1 ], [ 6, 1 ], [ 24, 12 ], [ 120, 34 ], [ 720, 763 ] ]

    gap> SetInfoLevel(InfoSCSCP,0);
    gap> SetInfoLevel(InfoMasterWorker,0);
    gap> ParListWithSCSCP( List( [2..6], n -> SymmetricGroup(n)), "WS_IdGroup" );
    [ [ 2, 1 ], [ 6, 1 ], [ 24, 12 ], [ 120, 34 ], [ 720, 763 ] ]

    gap> SetInfoLevel(InfoMasterWorker,5);
    gap> ParListWithSCSCP( List( [2..6], n -> SymmetricGroup(n)), "WS_IdGroup" );
    #I  1/5:master --> localhost:26133 : SymmetricGroup( [ 1 .. 2 ] )
    #I  2/5:master --> localhost:26134 : SymmetricGroup( [ 1 .. 3 ] )
    #I  localhost:26133 --> 1/5:master : [ 2, 1 ]
    #I  3/5:master --> localhost:26133 : SymmetricGroup( [ 1 .. 4 ] )
    #I  localhost:26134 --> 2/5:master : [ 6, 1 ]
    #I  4/5:master --> localhost:26134 : SymmetricGroup( [ 1 .. 5 ] )
    #I  localhost:26133 --> 3/5:master : [ 24, 12 ]
    #I  5/5:master --> localhost:26133 : SymmetricGroup( [ 1 .. 6 ] )
    #I  localhost:26134 --> 4/5:master : [ 120, 34 ]
    #I  localhost:26133 --> 5/5:master : [ 720, 763 ]
    [ [ 2, 1 ], [ 6, 1 ], [ 24, 12 ], [ 120, 34 ], [ 720, 763 ] ]

##### 9.2-5 DateISO8601

`> DateISO8601`( ) | ( function )

Returns: string

Returns the current date in the ISO-8601 YYYY-MM-DD format. This is an internal function of the package which is used by the SCSCP server to generate the transient content dictionary, accordingly to the definition of the OpenMath symbol `meta.CDDate`.

    gap> DateISO8601();
    "2010-03-30"

##### 9.2-6 CurrentTimestamp

`> CurrentTimestamp`( ) | ( function )

Returns: string

Returns the result of the call to `date`. This is an internal function of the package which is used to add the timestamp to the SCSCP service description.

    gap> CurrentTimestamp();
    "Tue 30 Mar 2010 11:19:38 BST"

##### 9.2-7 Hostname

`> Hostname`( ) | ( function )

Returns: string

Returns the result of the call to `hostname`. This function may be used in the configuration file `scscp/config.g` to specify that the default hostname which will be used by the SCSCP server will be detected automatically using `hostname`.

    gap> Hostname();
    "scscp.symbolic-computation.co.uk"

##### 9.2-8 MemoryUsageByGAPinKbytes

`> MemoryUsageByGAPinKbytes`( ) | ( function )

Returns: integer

Returns the current volume of the memory used by GAP in kylobytes. This is equivalent to calling `ps -p <PID> -o vsz`, where `<PID>` is the process ID of the GAP process. This is an internal function of the package which is used by the SCSCP server to report its memory usage in the `info_memory` attribute when being called with the option `debuglevel=2` (see options in `EvaluateBySCSCP` (6.1-4) and `NewProcess` (6.1-2)).

    gap> MemoryUsageByGAPinKbytes();
    649848

##### 9.2-9 LastReceivedCallID

`> LastReceivedCallID`( ) | ( function )

Returns: string

Returns the call ID contained in the most recently received message. It may contain some useful debugging information; in particular, the call ID for the GAP SCSCP client and server contains colon-separated server name, port number, process ID and a random string.

    gap> LastReceivedCallID();
    "scscp.symbolic-computation.co.uk:26133:77372:choDZBgA"

##### 9.2-10 IO_PickleToString

`> IO_PickleToString`( obj ) | ( function )

Returns: string containing "pickled" object

This function "pickles" or "serialises" the object obj using the operation `IO_Pickle` (IO: IO_Pickle) from the IO package, and writes it to a string, from which it could be later restored using `IO_UnpickleFromString` (9.2-11). This provides a way to design SCSCP procedures which transmit GAP objects in the "pickled" format as OpenMath strings, which may be useful for objects which may be "pickled" by the IO package but can not be converted to OpenMath or for which the "pickled" representation is more compact or can be encoded/decoded much faster.

See `IO_Pickle` (IO: IO_Pickle) and `IO_Unpickle` (IO: IO_Unpickle) for more details.

    gap> f := IO_PickleToString( GF( 125 ) );
    "FFIEINTG\>15INTG\>13FAIL"

##### 9.2-11 IO_UnpickleFromString

`> IO_UnpickleFromString`( s ) | ( function )

Returns: "unpickled" GAP object

This function "unpickles" the string s which was created using the function `IO_PickleToString` (9.2-10), using the operation `IO_Unpickle` (IO: IO_Unpickle) from the IO package. See `IO_PickleToString` (9.2-10) for more details and suggestions about its usage.

    gap> IO_UnpickleFromString( f );
    GF(5^3)
    gap> f = IO_UnpickleFromString( IO_PickleToString( f ) );
    true

Top of Book Previous Chapter Next Chapter
Goto Chapter: Top 1 2 3 4 5 6 7 8 9 Bib Ind

generated by GAPDoc2HTML