CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

Views: 418346
1
###########################################################################
2
##
3
#W todo.txt The SCSCP package Alexander Konovalov
4
#W Steve Linton
5
##
6
###########################################################################
7
8
9
###########################################################################
10
1.Early development notes (in case of discrepancies, trust the manual)
11
###########################################################################
12
13
The GAP package "SCSCP" has two main components:
14
15
1) GAP Server
16
2) GAP Client
17
18
Description:
19
20
1) GAP Server is started from the GAP session or during GAP startup.
21
During GAP Server startup it:
22
* loads all functions which has to be acessible as SCSCP services
23
* loads lookup mechanisms for them
24
* starts to listen specified port (default 26133, as registered by IANA)
25
26
For example, the service provider can write a file "myservice.g" looking like:
27
28
LoadPackage("scscp");
29
InstallSCSCPprocedure("factorial", Factorial, ["integer"],
30
"computes factorials of positive integers");
31
.....
32
InstallSCSCPprocedure("Simplify", OM-Simplify, ["raw-openmath"],
33
"does some special simplification of OpenMath objects");
34
35
RunSCSCPserver( "servername", portnumber );
36
37
After this to start the GAP server it remains to do
38
39
gap myservice.g
40
41
RunSCSCPserver:
42
* accepts connection from client via port 26133
43
* performs an exchange of connection initionation messages with the client
44
* sends, if requested, the meta-information about provided services
45
* starts read-evaluate-write loop:
46
- obtains OM message "procedure_call"
47
- performs lookup of the appropriate GAP function and checks all input,
48
with the message "procedure_terminated" if this step fails
49
- starts computation, during which it controls GAP and returns
50
"procedure_terminated" message if:
51
a) interrupt sygnal was obtained
52
b) system is out of resources (in multiuser mode the limits may be
53
specified by WS provider and the user may not have control over them,
54
in single-user they must be specified by the user within bounds
55
specified by WS provider)
56
c) computation was terminated by GAP:
57
- Error message with brk> loop (how can we catch this? are we
58
going two run an interface from GAP to GAP??? Can/should we
59
manage to do this within single copy of the system? This
60
must be possible, provided sygnal kernel and time-space
61
limits control will be implemented in the kernel)
62
- system crash (in this case the client detects broken connection,
63
and eventually we may want some way to start new GAP server process
64
automatically in this case, but anyway there is no point to try to
65
pick up the ongoing session)
66
- if none of this was happened, returns the result in the form of the
67
"procedure_completed" message and returns to the beginning of
68
read-evaluate-print loop
69
70
In a multi-user mode it never stops until it will be terminated by the service
71
provider. Multi-user mode is intended to perform single quickly computed requests.
72
Thus, on each iteration SCSCP server accepts next request from the queue.
73
74
In a single user mode for each client there is one copy of GAP. This can be
75
reduced to multi-user mode, if the client will be able to launch GAP SCSCP
76
wrapper which will create its personal SCSCP service (Can we do this???).
77
That SCSCP service will be stopped by the client's initiative or under some
78
other specified conditions to prevent forgotten jobs from infinite running.
79
80
3) GAP Client (to connect to SCSCP server):
81
* establishes connection with the SCSCP server via the specified port
82
* performs an exchange of connection initionation messages with the server
83
* requests, if necessary, the meta-information about provided services
84
* starts exchange loop:
85
- sends OM message "procedure_call"
86
- waits for the result of computation, and while waiting it must be able
87
to send the interrupt sygnal in case of timeout
88
- analyze the returned result and continues in case of "procedure_completed"
89
or leave the loop in case of "procedure_terminated"
90
91
###########################################################################
92
2.RELEASE HOW-TO
93
###########################################################################
94
95
* replace version number in PackageInfo.g and doc/manual.xml
96
97
* rebuild the manual
98
99
* commit PackageInfo.g and doc/manual.xml
100
101
* copy package to another location to wrap archives
102
103
* remove SVN subdirectories
104
rm -r .svn/ */.svn/ */*/.svn/
105
106
* replace paths from my local machine to something more neutral in gapd.sh
107
108
* remove files: parscscp.g, todo.txt, example/private.g, example/rings.g,
109
tracing/glue.sh, and all from 'par' directory except parlist.g
110
111
* remove possibly hidden files left e.g. '.DS_Store' left by Mac OS
112
113
* remove lines for loading example/private.g file from example/myserver.g
114
115
* remove getting IP address of the client, if it is not yet using IO package
116
117
* wrap the archive with the right version number:
118
cd ..
119
tar cfvz scscp-1.2.0.tar.gz scscp/
120
tar cjvf scscp-1.2.0.tar.bz2 scscp/
121
122
* copy archive, PackageInfo.g, README to web page:
123
scp scscp-* scscp/PackageInfo.g scscp/README.scscp [email protected]:~/public_html/scscp/
124
125
* copy manual to the web page:
126
scp scscp/doc/*.html scscp/doc/*.css scscp/doc/*.pdf [email protected]:~/public_html/scscp/
127
128
* check the PackageInfo.g, README, archive and the manual online:
129
http://www.cs.st-andrews.ac.uk/~alexk/scscp.htm
130
131
* update the web-page: modify version and links.
132
133
###########################################################################
134
3.TODO
135
###########################################################################
136
137
* Think about authentication using private/public keys or another method
138
139
* Parameter to regulate the queue length on the server
140
141
* Allow to restrict the range of IP addresses from which it accepts request
142
143
* CDs: matrix1, polynomial4, order1 (in openmath)
144
145
* Is SCSCP version restored after session if it was altered?
146
147
* Check more carefully examples and demo files, esp. upper/lowercasing etc.
148
149
* Implement verification of arguments for procedures with non-trivial
150
signatures
151
152
* Revise TerminateProcess, redo interrupts and check handling of other
153
processing instructions
154
155
* Extend test files with more examples
156
157
* Log servers activity in some GAP-readable format for analysing:
158
where incoming requests came from, when and when reply was sent?
159
Maybe we may even view them using EdenTV?
160
161
* Automatically glue trace files and start EdenTV (path to it should
162
be in some config.file)
163
164
* Automatic adjustments of the timeout (see Runtimes() record) in parlist.g
165
166
* Par{Quick/List}WithSCSCP may accept option specifying the list of services
167
to use if not coinciding with SCSCPservers
168
169
* TODO (suggested by SL): A useful trick which Google uses is that they
170
automatically restart the last 5% or so of the computations to finish,
171
without actually knowing whether the servers have died or not. That way
172
they also compensate for servers that are just running very slowly,
173
and they lose nothing, since there are always idle servers by that point.
174
175
* Possible idea: if a list of procedure names is given, they are applied
176
recursively, e.g.
177
EvaluateBySCSCP( [ "WS_Factorial", "WS_Phi" ], [ 10 ], ... );
178
179
* An idea we might consider in the future: change the structure of
180
OMsymRecord to cd.symbol.method, cd.symbol.role etc, then transient
181
CD record could me merged with OMsymRecord. Storing cd.symbol.role
182
may be useful, for example, GetAllowedHeads then will be able to
183
select only OMA.
184
185
* INTERRUPTS:
186
187
Once we tried to do CloseStream(process![1]), but closing stream too
188
early (for example, when server writes to it) causes server crash
189
because of the broken pipe :(
190
We need to send a proper Ctrl-C signal to the server, then it
191
will enter into a break loop and will send an error message from the
192
break loop to the client - this happens when you press Ctrl-C in the
193
server's window.
194
195
Another possible scenarios:
196
197
1) Multi-user service: the SCSCP server accepts A:1 incoming request and
198
starts another process B:2. The client communicates with B:2, and then
199
sends to A:1 request to interrupt the service B:2. Then A:1 performs
200
(in GAP) either "IO_kill(<pid>,15);" or Exec("kill -s SIGUSR2 <pid>");
201
202
2) Single-user service: We start two parallel services, A:1 is the
203
production service, and B:1 is used to interrupt (and restart somehow?)
204
the service A:1
205
206
3) Remote user executes (in GAP) Exec("ssh <hostname> kill -s SIGUSR2 <pid>");"
207
(need have enough credentials to login into remote machine).
208
209
(3) Works remotely. However, the user must be an owner of the process,
210
since only the super-user may send signals to other users' processes,
211
and there are other possible issues as well.
212
213
(1) and (2) require some care of a register of users and their respective
214
pid so the request like
215
216
<OMS cd="scscp1" name="interrupt_computation" />
217
<OMSTR>call_identifier</OMSTR>
218
219
should lead to terminate that session for which the client is authorised.
220
This must be feasible.
221
222