Changeset 6055 for trunk/doc/design/ippSSDD.tex
- Timestamp:
- Jan 19, 2006, 12:58:19 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/doc/design/ippSSDD.tex (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/design/ippSSDD.tex
r6054 r6055 1 %%% $Id: ippSSDD.tex,v 1. 5 2006-01-19 06:49:50eugene Exp $1 %%% $Id: ippSSDD.tex,v 1.6 2006-01-19 10:58:19 eugene Exp $ 2 2 \documentclass[panstarrs]{panstarrs} 3 3 … … 779 779 \subsection{AP Database} 780 780 781 \tbd{this section needs to be updated with current implemetation; the 782 DVO SDD contains much of this information, but needs to be fleshed 783 out in places.} 784 781 785 \subsubsection{Corresponding Requirements} 782 786 … … 1199 1203 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1200 1204 1201 \subsection{Controller} 1202 \label{sec:Controller} 1203 1204 \subsubsection{Corresponding Requirements} 1205 1206 The Controller must meet the requirements specified in Section 3.4.4 1207 of the Pan-STARRS PS-1 IPP SRS (PSDC-430-005). The design must meet 1208 requirements 3.4.4.1 - 3.4.4.7. In particular, the Controller / Node 1209 Agent architecture is chosen to control the I/O flow between the 1210 Controller and the individual processes so that blocking on the I/O 1211 from many remote processes does not saturate the Controller 1212 processing. 1213 1214 \subsubsection{Overview} 1205 \subsection{PanTasks : the IPP Scheduler} 1206 1207 PanTasks is the IPP tool which manages the sequencing of data analysis 1208 steps and, with the related tool `PControl', distributes the data 1209 processing across a cluster of computers. \tbd{describe the 'opihi' 1210 shell-scripting system} 1211 1212 The purpose of PanTasks is to manage the automatic construction and 1213 execution of inter-related (often repetative) operations. PanTasks 1214 uses a set of rules to define UNIX commands, and their corresponding 1215 command-line arguments, to be performed on some regular, repeated 1216 basis. The utility of PanTasks is that it can easily define and 1217 manage an analysis system which is completely state-based, as opposed 1218 to an event-driven system. 1219 1220 Consider, for example, a telescope which obtains a collection of 1221 images over the course of a night. Every minute or two, it takes an 1222 image and writes the image to some disk. An event-driven analysis 1223 system would involve having the telescope initiate a process at the 1224 end of the exposure. This process would perform an analysis, write 1225 some output, then send trigger another process. This type of operation 1226 works very well for a simple set up with reliable hardware. Such a 1227 system becomes more difficult to maintain when hardware failures occur 1228 or when multiple systems need to interact with each other. When 1229 failures occur, the triggering information (the events) is easily 1230 lost, thus some mechanisms are needed to detect these failures and 1231 either re-send the trigger or send an alternative failure-mode 1232 trigger. Or, if two systems need to interact, one or the other system 1233 must block for results from the first. Stopping and restarting such an 1234 analysis system is very delicate since the appropriate triggers must 1235 be set up some how, eg by noticing which images have not succeeded and 1236 restarting them at the appropriate stage. All of these types of 1237 methods of handling complexity and failures are essentially 1238 state-based rules. PanTasks allows the easy definition of a totally 1239 state-based analysis system. 1240 1241 In a state-based system, some mechanism examines the state of the 1242 system and decides which actions to perform based on the current 1243 state. In the illustration above, the mechanism could examine the 1244 images available (either by examining the disk or by examining the 1245 state of a data table) and decide to perform an operation based on 1246 what images are available. This makes it very easy to handle 1247 complexity and errors. If an analysis fails, the state either is not 1248 successfully updated or the error state is recorded, both situations 1249 being easy to detect and easy to handle. Restarting the system simply 1250 involves starting the state-monitoring mechanism. Combining results 1251 from multiple input sources simply involves watching for the multiple 1252 inputs to be available. PanTasks provides a mechanism to define state 1253 monitors, and to define the actions which are performed when those 1254 states occur. PanTasks action consist of initiating UNIX commands, where 1255 the arguments of those commands may depend on the results of the state 1256 tests. 1257 1258 \subsubsection{Tasks vs Jobs} 1259 1260 The two basic units of PanTasks operation are the 'task' and the 1261 'job'. A 'job' is simply a command the user would execute on a 1262 command line; it consists of a command along with optional command 1263 line arguments. A 'task' is a generic description of a type of job in 1264 which the details of any specific piece of data are omitted. The task 1265 defines the UNIX command which corresponds to the job, and it provides 1266 rules for determining the identity of data for the job. The task also 1267 defines tests which are used to decide if the job may be executed. 1268 Finally, it defines a polling frequency in which PanTasks should 1269 attempt to construct a new job for the task. 1270 1271 For example, we may want to regularly copy files from one location to 1272 another. Perhaps the name of the next available file is available in 1273 a database table, and can be retrieved with the command 'nextFile'. 1274 Perhaps we wish to check for new files every 60 seconds. Thus, the 1275 task is to copy files, while a specific job of this task might be of 1276 the form \code{cp newfile newpath}. With PanTasks, we would define a 1277 copy task somewhat like the following: 1278 1279 \begin{verbatim} 1280 task copyfile 1281 periods -exec 60.0 1282 1283 task.exec 1284 $file = `nextFile` 1285 if ($file == "none") 1286 break 1287 end 1288 command cp $file $newpath 1289 end 1290 1291 task.exit 0 1292 queuepush copied $file 1293 end 1294 1295 task.exit 1 1296 queuepush failure $file 1297 end 1298 end 1299 \end{verbatim} 1300 1301 In this simple example, the task is attempted every 60 seconds. If 1302 there is no new file (output of 'nextFile' is 'none'), then no job 1303 results from this task. If there is a new file, the copy command is 1304 performed. This example is deceptively simple because one could 1305 easily imagine writing a stand-along program which performs the same 1306 thing. The important advantages of using PanTasks for this type of 1307 operation are: 1308 \begin{itemize} 1309 \item the output from one job can be used to spawn a number of other tasks. 1310 \item the success or failure state of each job can be used to spawn 1311 other tasks. 1312 \item the details of the job and data test are kept separated from the 1313 rules which connect tasks together. 1314 \item the relationships between tasks are kept together in a single 1315 location. 1316 \end{itemize} 1317 1318 In addition to these organizational advantages, PanTasks also provides 1319 a direct connection to the tool for monitoring parallel jobs, 1320 pcontrol. Thus the jobs spawned by PanTasks can be defined to run in 1321 the background locally or on any of the computers in the parallel 1322 processing cluster. 1323 1324 \subsubsection{Parallel vs Local Job Processing} 1325 1326 Jobs which are generated by PanTasks tasks may either be run locally 1327 (forked in the background on the same machine as PanTasks) or run on 1328 the IPP parallel process controller, pcontrol. The default is for the 1329 job to be run locally. If a job should be run on the parallel 1330 controller, this can be specified by including the command host 1331 (hostname) in the definition of a task. If the value of (hostname) is 1332 'anyhost', then pcontrol may select any of its host computers to run 1333 the job according to its own rules. If the value of (hostname) is one 1334 of the computers managed by pcontrol, then that machine will be 1335 selected for the job, if it is available. This amounts to a preference 1336 to use that machine, but pcontrol is allowed to substitute a different 1337 machine if it chooses. If the host command is given the option 1338 -required, then pcontrol is forced to use the named host, even if the 1339 machine is down, unknown, or otherwise unavailable. If the machine is 1340 not available, pcontrol will simply hold onto the job until the 1341 machine is available or the job is deleted. Note that PanTasks may 1342 delete jobs from pcontrol if they remain pending for too long. 1343 1344 It is possible to interact directly with the parallel processor to 1345 examine the current status, halt the parallel processor, etc. Commands 1346 to the parallel processor are defined under the controller 1347 command. The following controller commands are available: 1348 1349 \begin{itemize} 1350 1351 \item controller host (command) (hostname): Manage the parallel 1352 controller collection of hosts. This command can be used to add a 1353 new host, the delete one of the existing hosts, to turn a host on or 1354 off, and to check the status of a host 1355 1356 \begin{itemize} 1357 \item controller host add (hostname): add a new host. 1358 1359 \item controller host delete (hostname): delete a host. 1360 1361 \item controller host on (hostname): tell pcontrol that the host is on. 1362 1363 \item controller host off (hostname): tell pcontrol that the host is off. 1364 1365 \item controller host retry (hostname): tell pcontrol to retry the host connection. 1366 1367 \item controller host check (hostname): check the current status of a host. 1368 \end{itemize} 1369 1370 \item controller exit: stop controller execution. 1371 1372 \item controller status: report controller current status. 1373 1374 \item controller check: check job or host status. 1375 1376 \item controller output: print accumulated messages from the controller. 1377 \end{itemize} 1378 1379 It is also possible to specify a host for a task which has not been 1380 identified to the controller. If such a host is required, the 1381 controller will simply keep the associated jobs in the pending state 1382 until such a machine exists. See the pcontrol section below for 1383 further discussion of the controller manipuation of jobs and hosts. 1384 1385 \subsubsection{Task Restrictions} 1386 1387 Tasks may have restrictions on when they create jobs and how 1388 frequently they create jobs. The task command trange is used to 1389 specify a valid or invalid time range for a task. A valid time range 1390 limits the task evaluation to that time period. An invalid time range 1391 excludes task evaluation from the time period. Any number of time 1392 range restrictions may be defined, and the union of all restrictions 1393 will define if a job may be created. By default, the time range is an 1394 inclusive time range: the task is evaluated only if the current time 1395 falls within the specified time range. Alternatively, if the -exclude 1396 flag is given, the time range is exclusive, in which case the task is 1397 not evaluated if the current time falls within this range. 1398 1399 The time range may be given as a range of absolute dates as follows: 1400 1401 \begin{verbatim} 1402 trange YYYY/MM/DD,HH:MM:SS YYYY/MM/DD,HH:MM:SS 1403 \end{verbatim} 1404 1405 where the two dates specify the start and end of the time range. In 1406 either of these date representations, the least-significant elements 1407 of the date and time may be dropped, defaulting to 00 (in the case of 1408 hours, minutes, and seconds) or 01 (in the case of day and 1409 months). Rather than specifying an end date, it is also valid to 1410 specify a time interval from the starting date. The time interval is 1411 specified as a number followed by a unit indicated by a single letter: 1412 d (days), h (hours), m (minutes), s (seconds). 1413 1414 The time range may also be specified as a repeated period of time, 1415 either as a time of day or a day and time of week. In the first case, 1416 the time range is specified as follows: 1417 1418 1419 \begin{verbatim} 1420 trange HH:MM:SS HH:MM:SS 1421 \end{verbatim} 1422 1423 1424 where again the least-significant elements may be dropped and default 1425 to 00. This type of restriction defines a time range which is valid 1426 every day. The alternative is to specify a time range within the week, 1427 in the following form: 1428 1429 \begin{verbatim} 1430 trange DAY@HH:MM:SS DAY@HH:MM:SS 1431 \end{verbatim} 1432 1433 where the value of DAY may take on any of the three letter day-of-week 1434 names (Sun, Mon, Tue, etc). This restriction specifies a start and end 1435 time within a week which is evaluated for each week. 1436 1437 Below are several examples of valid time range restrictions 1438 1439 \begin{verbatim} 1440 trange 2005/01/01 2005/12/31 (only run during 2005!) 1441 trange 18:00 00:00 (only run from 6pm until midnight) 1442 trange 00:00 06:00 (only run from midnight until 6am) 1443 trange Mon@08:00 Fri@17:00 (only run between Mon morning and Fri afternoon) 1444 trange -exclude 12:00 13:00 (skip 1 hour from noon) 1445 \end{verbatim} 1446 1447 Note that the current definition of trange does not include time zone 1448 information. This means that all times are relative to UT. This should 1449 be addressed by adding a timezone environment variable to PanTasks and 1450 by allowing the trange to define a timezone offset. 1451 1452 It is also possible to restrict the total number of jobs which are 1453 spawned for a given task. This is done with the nmax command, which is 1454 given as part of the task definition. Once a task has constructed nmax 1455 jobs, it stops task evaluation. It is possible to redefine the value 1456 of nmax at any time by redefining the task. Any time the task is 1457 redefined, the new values for any task concept will override the 1458 existing values for the task concept. 1459 1460 \subsubsection{Inter-Task and Inter-Job Communications} 1461 1462 There are several ways in which the results of jobs may be used to 1463 influence other jobs. These include: 1464 1465 \begin{itemize} 1466 \item external communications 1467 \item job exit status 1468 \item job stdout/stderr parsing 1469 \end{itemize} 1470 1471 It is always possible for the interprocess communication to be 1472 performed externally: all jobs may simply write results to an external 1473 data source which is queried as part of the task evaluation. PanTasks 1474 may interact with UNIX programs using Opihi system interaction 1475 functions. These interaction methods include: the backticks for 1476 setting Opihi variables: 1477 1478 \begin{verbatim} 1479 $variable = `UNIX Command` 1480 \end{verbatim} 1481 1482 The exec command (which executes a UNIX command) and the backticks 1483 both receive the UNIX command exit status, setting the variable 1484 \code{$STATUS}. It is also possible to set a variable list to the 1485 output of a UNIX command: 1486 1487 \begin{verbatim} 1488 list var -x "UNIX Command" 1489 \end{verbatim} 1490 1491 In this last case, the values \code{$var:0 - $var:N-1} are set to the 1492 value of the stdout lines from the UNIX command, and the value 1493 \code{$var:n} is set to the number of output lines. 1494 % $ 1495 1496 Fine-grained control over the job exit status is available with the 1497 task.exit macro command. This allows a task to define an exit macro 1498 which is performed for different exit status conditions. The argument 1499 to the task.exit command is the exit status value which triggers the 1500 macro. This may consist of any valid numeric exit status value 1501 (0-255). It may also have the value crash, in which case the macro is 1502 executed if the program exited as a result of a signal (ie, 1503 segmentation fault, etc). Finally, if may have the value default, in 1504 which case, the macro is run if no other macro describes the exit 1505 status. 1506 1507 Jobs may transmit their results back to PanTasks for further 1508 evaluation through the standard output and standard error 1509 streams. Whenever a job exits, the complete stdout and stderr streams 1510 from the job are pushed onto the PanTasks queues \code{stdout} and 1511 \code{stderr}. The job exit macros may then parse these queues, moving 1512 the results into other PanTasks / Opihi data containers (queues, 1513 variables, vectors, whatever is appropriate). Note that currently, the 1514 output data is simply pushed onto these output queues. It is currently 1515 the responsibility of the PanTasks programmer to use or dispose of the 1516 data in these queues. This may change in the future: the queues may be 1517 flushed for each job completion. 1518 1519 \subsubsection{PanTasks Monitoring Loop} 1215 1520 1216 1521 \begin{figure} 1217 1522 \begin{center} 1218 \resizebox{4.5in}{!}{\includegraphics{pics/Controller}} 1219 \caption{Schematic illustration of the Controller components} 1220 \label{fig:Controller} 1523 \includegraphics[scale=0.85,angle=-90]{pics/pantasks.01.ps} 1524 \caption{\label{MonitorLoop} PanTasks Monitor Loop} 1221 1525 \end{center} 1222 1526 \end{figure} 1223 1527 1528 Figure~\ref{MonitorLoop} illustrates the operation of PanTasks. 1529 Currently, PanTasks is run as a stand-alone foreground process, not a 1530 server. In this current operating mode, PanTasks accepts commands 1531 from the user (left side) via a GNU readline interface. Readline 1532 provides a mechanism to schedule an background process which is 1533 executed on a regular basis, or in the interval after each keystroke. 1534 This background processing is represented as the loop on the right. 1535 In this loop, PanTasks checks on the status of pcontrol and on any 1536 locally spawned background jobs. It also checks the list of tasks for 1537 tasks which are ready to be executed. The tasks and the background 1538 jobs are kept in rotating queues. Every time the loop is processed, 1539 PanTasks runs through a number of the background jobs and tasks, 1540 attempting to evaluate as many as possible, but stopping after a 1541 limited number of milliseconds. This test stage cycles through the 1542 tasks and/or jobs in their queue, but stops if it examines all of the 1543 entries in the queue. If this testing process runs out of time before 1544 the entire queue is searched, it leaves the sequence intact for the 1545 next pass. The timeout is set to keep the keyboard small enough to 1546 keep the human interaction from being troublesome. 1547 1548 \begin{figure} 1549 \begin{center} 1550 \includegraphics[scale=0.85,angle=-90]{pics/pantasks.02.ps} 1551 \caption{\label{TaskLoop} PanTasks Task Check Loop} 1552 \end{center} 1553 \end{figure} 1554 1555 Figure~\ref{TaskLoop} shows the interactions performed for each check 1556 of the list of tasks. The task timers are examined to see if the 1557 specific task is ready to be executed. If so, then the task exec 1558 macro is executed. If this macro exit status is false, the loop goes 1559 to the next task. If the task exec macro is true, the job command is 1560 constructed and the job is submitted to the correct location, either 1561 the controller (pcontrol) or to the queue of local, background jobs. 1562 1563 \begin{figure} 1564 \begin{center} 1565 \includegraphics[scale=0.85,angle=-90]{pics/pantasks.03.ps} 1566 \caption{\label{JobLoop} PanTasks Job Check Loop} 1567 \end{center} 1568 \end{figure} 1569 1570 Figure~\ref{JobLoop} shows the interactions performed for each check 1571 of a single background job. The job timer is checked to see if the 1572 job has timed out. Next, the job run status is examined to see if the 1573 job has finished or not. If the job has finished, the appropriate 1574 exit macro is executed and the job results are returned to the rest of 1575 the PanTasks data structures (ie, stderr and stdout queues are filled 1576 out). Users should not define exit macros which perform long running 1577 jobs, or PanTasks will become quite sluggish to keyboard strokes. 1578 1579 PanTasks also checks the current status of pcontrol on each loop. 1580 In this test, PanTasks requests from pcontrol a list of the jobs which 1581 have finished. It then attempts to harvest the finished jobs one by 1582 one and place the results in the approrpiate locations. This loop is 1583 also limited to a fixed amount of time; any pcontrol jobs which remain 1584 unharvested are left for the next pass by PanTasks. 1585 1586 \subsubsection{Running the scheduler} 1587 1588 Once a set of tasks has been defined, the scheduler can be 1589 started. The scheduler will run in the background, at regular 1590 intervals examining the collection of tasks and jobs. In these 1591 periods, the scheduler attempts to construct new jobs and checks on 1592 the status of jobs which may have finished, either locally or on the 1593 controller. To start the scheduler, give the command run. To stop the 1594 scheduler, given the command stop. The current status of the 1595 scheduler, controller, and any jobs which have been spawned are listed 1596 with the status command. 1597 1598 It is also possible to kill or delete individual jobs by hand with the 1599 commands kill (jobID) or delete (jobID). Other features 1600 1601 \subsection{pcontrol : the PanTasks parallel controller} 1602 1224 1603 The IPP uses a group of computers to store and process images and to 1225 manipulate collections of detections. These computers perform any of1226 alarge number of analysis stages or other processing tasks without1227 significant interprocess communication. It is necessary to have a1604 manipulate collections of detections. These computers perform any of a 1605 large number of analysis stages or other processing tasks without 1606 significant interprocess communication. It is necessary to have a 1228 1607 mechanism which initiates computing tasks on the different computers, 1229 1608 which monitors the tasks as they are executed, which handles the 1230 1609 output and the errors from these tasks, and which reacts to the 1231 failure of any of the computing nodes. The system responsible for the 1232 tasks in the IPP is the IPP Controller. 1233 1234 The IPP Controller interacts with the collection of computers under 1235 its management and with other subsystems in the IPP. The IPP 1236 Controller receives a variety of inputs from other subsystems, 1237 described below, and initiates actions such as adding a new process to 1238 the queue of pending tasks. The IPP Controller also provides 1239 information to other subsystems on demand about its processing history 1240 and current state. Each physical computer may have multiple 1241 processors; since the IPP Controller is managing processing tasks, it 1242 treats each processor independently. It is up to the system 1243 configuration if each computer needs to reserve one of its CPUs to 1244 manage background tasks or if the IPP Controller should attempt to 1245 send one task per CPU and let the operating system handle the I/O 1246 load. The relationship between the different components of the 1247 Controller is illustrated in Figure~\ref{fig:Controller} and discussed 1248 below. 1249 1250 \subsubsection{Nodes} 1251 1252 The Controller maintains a table of available processing computers 1253 (`Nodes') and tracks the status of these Nodes. Nodes managed by the 1254 IPP Controller are allowed to be in one of several states, and the IPP 1255 Controller must interact with it in an appropriate way for each of 1256 those states. A Node may be {\tt alive}, {\tt dead} or {\tt off}. 1257 If the Node is {\tt alive}, it responds to commands from the IPP 1258 Controller and may be used for tasks subject to other constraints. If 1259 it is {\tt dead}, the Node is not responsive and must not be used 1260 for executing tasks. The IPP Controller must identify Nodes which 1261 have died (not responding) and occasionally test them to see if they 1262 are {\tt alive} again. Nodes which are {\tt off} are not 1263 available for tasks and must not be tested. Nodes may be set to 1264 the {\tt off} or {\tt dead} states by external subsystems; it is the 1265 responsibility of the IPP Controller to return a Node to the {\tt 1266 alive} state if possible. 1267 1268 The IPP Controller must honor requests (normally from the users) to 1269 change the mode of any computing node on demand between {\tt off} and 1270 {\tt dead}. This would normally be done after a Node has been 1271 rebooted and is released to the IPP Controller for its use. It must 1272 also be able to change the list of allowed tasks as requested by 1273 external commands. 1274 1275 Two example scenarios illustrate the transition between these states, 1276 and the basic concept of operations for the IPP Controller. First, 1277 imagine a computer crashes. At this point the IPP Controller should 1278 detect that the Node is no longer responsive and mark it as {\tt 1279 dead}. It should occasionally try to re-establish communication with 1280 the Node, potentially with longer and longer delays between attempts. 1281 A human could be notified if the Node seems to remain {\tt dead} for a 1282 very long time. In another scenario, a person needs to work on a 1283 Node. They notify the IPP Controller that the machine is {\tt off}, 1284 perhaps with a prior notification that the machine should be prepared 1285 to go off. When work on the machine is complete, it should be placed 1286 in the {\tt dead} state. Only when the person is done working and 1287 testing the machine, and tells the IPP Controller that the machine is 1288 now {\tt dead} can the IPP Controller attempt to re-start 1289 communications and re-new processing operations on that Node. 1290 1291 \subsubsection{Node Agents} 1292 1293 When the Controller starts, it attempts to launch a Node Agent on each 1294 of the available processing Nodes. Nodes which are not responsive are 1295 marked as {\tt dead} so they may be re-tried. A Node Agent runs on 1296 each of the individual nodes to execute the tasks as directed by the 1297 Controller. The Node Agents communicate with the Controller via a 1298 socket connection. 1299 1300 A Node Agent (which is only running on a Node in the {\tt alive} 1301 state) may be in one of four modes: {\tt idle}, {\tt busy}, {\tt 1302 done}, {\tt crash}. A Node Agent which is {\tt busy} currently has a 1303 task assigned to it which is executing. The IPP Controller may only 1304 assign one task to a Node at a time. A Node Agent which is in the 1305 {\tt idle} state may have a task assigned to it. When the Node Agent 1306 detects that a tasks has finished, it changes to either the {\tt done} 1307 or {\tt crash} states depending on the outcome of the process 1308 execution. The IPP Controller must also respect a list of task 1309 restrictions which may require specific tasks to run on specific CPUs 1310 or exclude specific tasks from specific CPUs. 1311 1312 A task being executed by the Node is run in the UNIX user space as a 1313 forked process. The Node Agent must monitor the standard error and 1314 standard output of the executing task and save them in separate 1315 buffers. If the process exits or dies, the Node Agent must detect 1316 this result and change state appropriately. The Node Agent must 1317 respond to various commands from the Controller, as follows: 1318 1319 \paragraph{Report status} 1320 1321 The Node Agent returns its state ({\tt idle}, {\tt busy}, {\tt done}, 1322 {\tt crash}) and the exit status of the current processing task, if 1323 available. The reported exit state, if the process has completed 1324 without crashing, is the UNIX exit state reported by the task: 0--256 1325 with 0 indicating a successful completion. 1326 1327 \paragraph{Report stdout} 1328 1329 Send and flush the current stdout buffer. The Node Agent will return 1330 the complete contents of the stdout buffer via a buffered write and 1331 flush the buffer when it is finished. The Node Agent will not accept 1332 more data on the stdout buffer from the current processing task until 1333 the send is complete and the buffer is flushed. The daemon must 1334 accept all of the buffer output. 1335 1336 \paragraph{Report stderr} 1337 1338 Identical to `report stdout', but for stderr. 1339 1340 \paragraph{Kill task } 1341 1342 The Node Agent should send a kill signal (\code{KILL} or \code{TERM}) 1343 to the current processing task. When the processing task has exited, 1344 the Node Agent should set its state to {\tt crash}. 1345 1346 \paragraph{Clear task} 1347 1348 The Node Agent should set its state {\tt idle}. If a processing stage 1349 is currently running, it should be killed (\code{KILL} or \code{TERM}) 1350 before the task is cleared. 1351 1352 \paragraph{Start processing stage} 1353 1354 The Node Agent forks a specified command. The command should be a 1355 standard UNIX command without command line redirection or 1356 backgrounding. The task is run with the same user ID as the Node 1357 Agent, which is also the same user ID as the Controller. 1358 1359 \subsubsection{Tasks} 1360 1361 The IPP Controller accepts tasks from other IPP subsystems. The task 1362 requests include the specific command to be executed and are in the 1363 form of a UNIX command which could be performed on any of the 1364 computing nodes. Any input or output data in the commands must be a 1365 valid resource regardless of the node on which the task is executed. 1366 Input and output data resources must be unique where necessary to 1367 avoid conflicts. It is the responsibility of the task to wait for 1368 network lags (ie, NFS delays). The IPP Controller gives each task a 1369 unique identifier, which is returned to the requesting entity. The 1370 requestor may then use that ID to obtain status information on that 1371 task or to send control signals to the specific task. 1372 1373 Task requests may specify a desired node for the task execution. The 1374 IPP Controller attempts to honor the request if the node is {\tt 1375 alive}, but will execute it on another node if the requested one is 1376 {\tt dead} or {\tt off}. Even if a node is {\tt alive}, the IPP 1377 Controller will choose another node if the specified task is not 1378 allowed on the requested node. In all other cases, the IPP Controller 1379 waits until the currently executing processes, and processes with 1380 higher priority, are completed before executing the specified task on 1381 the requested node. 1382 1383 Task requests may specify an urgency level. The IPP Controller 1384 determines the priority of the task on the basis of both the urgency 1385 and the age of the request. An executing task must be completed on a 1386 CPU before any new task is started on that CPU, regardless of 1387 priority. The urgency levels range from 0 to 2. Tasks with an 1388 urgency of 1 are scheduled whenever they reach the top of the stack. 1389 Tasks with an urgency of 2 are sent immediately to the top of the 1390 stack. Tasks assigned a priority of 0 are maintained in the queue and 1391 never executed. 1392 1393 It may be useful for the Controller to distinguish between tasks 1394 dominated by I/O and tasks dominated by data processing. It is 1395 possible that one of each of these types of tasks may be sent to the 1396 same node without significantly impacting the system performance. 1397 Alternatively, it may be necessary to limit a single machine with 2 1398 CPUs to only one of each of these types of tasks (i.e., one processor 1399 will be working on I/O while the other is working on processing). 1400 Such details will be studied by the IfA IPP Team. 1401 1402 The IPP Controller monitors the output streams from the executing 1403 tasks and the exit status of the tasks. Each task is associated with 1404 a log file, to which all output is written. The status, including the 1405 exit status, of each task is maintained by the IPP Controller so that 1406 other subsystems may determine if specific tasks have started or 1407 completed. 1408 1409 \subsubsection{Controller Interfaces} 1410 1411 The IPP Controller must accept commands from other IPP subsystems. 1412 These commands include those which govern the processing of specified 1413 tasks, those which govern the behavior of specific computing nodes, 1414 and those which request information from the IPP Controller. The IPP 1415 Controller must be able to halt the execution of a specified task, 1416 delete an unexecuted task from the task list, change the priority of 1417 tasks, and change the requested nodes for tasks. The IPP Controller 1418 must also be able to stop the current execution of a task and push it 1419 to the end of the queue and also change its priority. 1420 1421 The IPP Controller must respond to informational requests regarding the 1422 collection of machines and their states as well as the collection of 1423 tasks and their states. The IPP Controller must monitor the execution 1424 times of the different tasks and provide summary statistics. Finally, 1425 the IPP Controller must respond to three top-level commands: {\tt finish}, 1426 {\tt stop} and {\tt abort}. When {\tt finish} is requested, no more 1427 new tasks are accepted on the stack of task, and when all tasks in the 1428 stack have completed, the IPP Controller must exit. When {\tt stop} is 1429 requested, the currently executing tasks must be completed at which 1430 point the IPP Controller must exit, but tasks remaining in the stack which 1431 have not been started are flushed. When {\tt abort} is issued, the 1432 IPP Controller immediately kills all executing tasks and exits. 1433 1434 The IPP Controller and the IPP Image Server have related needs for 1435 information from the combined storage-and-processing nodes regarding 1436 which nodes are available. It is not yet clear if this information is 1437 best stored in a single location (either IPP Controller or IPP Image 1438 Server), which provides the information to other systems on demand, or 1439 if both systems should maintain the information. Also, it may be 1440 necessary to distinguish nodes which are available for processing from 1441 those that are available to serve data as part of the IPP Image 1442 Server. 1443 1444 The Controller maintains three tables of processing jobs: pending 1445 stages, active stages, and completed stages. The pending stages are 1446 those which have not yet been performed. The active stages are those 1447 currently being performed on one of the remote nodes. The completed 1448 stages are those which have finished, either successfully or with an 1449 error state. The Controller daemon monitors the collection of remote 1450 clients and sends them new pending stages when they become free. 1451 1452 The IPP Controller provides a mechanism for users (either other 1453 programs or humans) to interact with it. The user interface provides 1454 commands to check the current processing job queues, the tables of 1455 successful and failed jobs, to stop or delete jobs, etc. 1456 1457 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1458 1459 \subsection{Scheduler} 1460 \label{sec:scheduler} 1461 1462 \subsubsection{Corresponding Requirements} 1463 1464 The Scheduler must meet the requirements specified in Section 3.4.5 of 1465 the Pan-STARRS PS-1 IPP SRS (PSDC-430-005). The design must meet 1466 requirements 3.4.5.1 - 3.4.5.7. In particular, the Task / Test 1467 division is chosen to prevent the Scheduler from blocking while an 1468 analysis process is performed. Scheduling requirements will be met by 1469 defining appropriate Test periods for the different Tasks. 1470 1471 \subsubsection{Overview} 1472 1473 The IPP is responsible for a variety of analysis jobs: processing of 1474 the science images through several stages; routine assessment of the 1475 detrend (instrumental calibration) images used in processing the 1476 science images; construction of replacement detrend images when 1477 needed; generation of astrometric and photometric reference catalogs 1478 based on the collected dataset; and the performance of test analysis 1479 programs. At any point, decisions need to be made about which of 1480 these tasks should be performed, based on an analysis of the contents 1481 of the metadata database, the requirements of the people monitoring 1482 the IPP, and the near-term observing plans. The IPP Scheduler is the 1483 mechanism that assesses these various inputs to guide the decisions 1484 and initiate the actions. 1485 1486 The IPP Scheduler acts as an interface between several components of 1487 the IPP and also between the IPP and external agents such as OTIS and 1488 the users who must monitor the behavior of the IPP. The IPP Scheduler 1489 may be viewed as the central brain of the IPP. 1490 Figure~\ref{fig:Scheduler} illustrates the design of the IPP 1491 Scheduler. 1492 1493 \subsubsection{Scheduler Tasks and Tests} 1494 1495 The IPP Scheduler performs two types of actions. 'Tasks' are 1496 long-running programs which are executed by the Controller. These are 1497 not only background tasks, but are distributed computing tasks. 1498 Examples of these include the science analysis tasks (eg, Phase 1, 2, 1499 3, 4), the Calibration construction tasks, and data copy tasks (such 1500 as copying images and metadata from the summit system). 'Tests' are 1501 short-running programs which are used to decide which tasks should be 1502 run. Tests should be designed to return immediately ($< 100 ms$) and 1503 are not run in the background; the Scheduler will block until the test 1504 is complete. The IPP Scheduler daemon, which runs continuously, 1505 performs tests (eg, queries of the IPP Metadata Database, queries of 1506 OTIS, checks of the IPP hardware status, etc). Based on these tests, 1507 the daemon defines appropriate tasks and sends them to the Controller. 1508 When tasks are completed, their results may be used by the Scheduler 1509 to update the external systems (update the Metadata Database), or the 1510 tasks themselves may send their results directly to the Metadata 1511 Database or other subsystems. Based on the successful completion (or 1512 not!) of the tasks, and the new state of entries in the Metadata 1513 Database, the Scheduler can define new tasks. 1610 failure of any of the computing nodes. The system responsible for the 1611 tasks in the IPP is pcontrol. 1612 1613 \subsubsection{Host States} 1514 1614 1515 1615 \begin{figure} 1516 1616 \begin{center} 1517 \ resizebox{6in}{!}{\includegraphics{pics/Scheduler}}1518 \caption{ \label{fig:Scheduler} IPP Scheduler}1617 \includegraphics[scale=0.85,angle=-90]{pics/pantasks.04.ps} 1618 \caption{\label{HostStates} PanTasks Host States} 1519 1619 \end{center} 1520 1620 \end{figure} 1521 1621 1522 The IPP Scheduler sends tasks to the IPP Controller for execution. 1523 While the IPP Scheduler chooses the tasks to be performed, it is the 1524 IPP Controller's responsibility to manage the specific tasks executing 1525 on a given processing node. This division of responsibilities allows 1526 the different functionalities of the IPP Scheduler and the IPP 1527 Controller to be isolated and encapsulated. With this separation, the 1528 IPP Controller does not information about the details of the tasks it 1529 executes, while the IPP Scheduler does not need to monitor the 1530 computer hardware. 1531 1532 Communication between the IPP Scheduler and the IPP Controller is 1533 bi-directional; the IPP Scheduler sends tasks to the IPP Controller, 1534 while the IPP Controller informs the IPP Scheduler of the outcome of 1535 those tasks. For the PS-1 IPP, the IPP Scheduler and the IPP 1536 Controller are distinct, interacting software components. The 1537 interface mechanisms are described in Section~\ref{sec:interfaces}. 1538 1539 \subsubsection{Task Rules} 1540 1541 The IPP Scheduler takes as input a collection of rules which define 1542 the dependency of tasks on certain tests. The IPP Scheduler must 1543 choose between several types of analysis tasks based on those rules 1544 and on results of the tests. The timescale on which different tasks 1545 (and their related tests) are executed may vary from 10s of seconds to 1546 hours, days, or even as long as a week. The list of tasks which the 1547 IPP Scheduler must decide between, and the relevant timescale, follow: 1622 pcontrol maintains a table of available processing computers (hosts) 1623 and tracks their status. Hosts managed by pcontrol are allowed to be 1624 in one of several states: \code{off}, \code{down}, \code{idle}, 1625 \code{busy}, and \code{done} (see Figure~\ref{HostStates}). There are 1626 also two virtual states: \code{new} and \code{delete}. These states 1627 have the following meanings: 1628 1629 If the host is \code{off}, it is known to pcontrol, but pcontrol does 1630 not have an active connection to the machine. Hosts which are 1631 \code{off} are not available for jobs, and pcontrol does not attempt to 1632 initiate a connection to them. A pcontrol user may force a host to 1633 transition to the \code{off} state with the command host 1634 \code{off~(hostname)}. (Note that this command will set only one of 1635 the connections to the named host to \code{off}. If multiple 1636 connections to a machine have been defined, multiple \code{off} 1637 commands must be sent). 1638 1639 When pcontrol is told to consider a machine on, the machine is moved 1640 from the \code{off} state to the \code{down} state. Pcontrol attempts 1641 to initiate a connection to the host. Connections are made by running 1642 a remote client on the host, using the specified connection 1643 method. The connection method may be ssh, rsh, or an equivalent remote 1644 shell connection. The choice is specified by the \code{COMMAND} Opihi 1645 variable. The remote connection starts a dedicated remote client which 1646 must accept the pcontrol client commands and respond 1647 appropriately. The provided remote client is called {\em pclient}, 1648 though in principal other equivalent programs could be used by setting 1649 the Opihi variable \code{SHELL}. This feature more generally allows a 1650 user to specify a path to the remote client, if it is not in the 1651 user's path. 1652 1653 If the remote connection is successful, the connected host is moved by 1654 pcontrol from the \code{down} state to the \code{idle} state. If the 1655 connection is unsuccessful, pcontrol will try again after a certain 1656 period of time. If the connection continues to be unsuccessful, the 1657 retry period is doubled for each successiver connection attempt. If 1658 the user wants to force pcontrol to retry the connection to a machine 1659 (if, for example, the timeout is now very long, but the user knows the 1660 machine's ethernet cable has been re-inserted...), this can be 1661 achieved with the command host \code{retry (hostname)}. A host which 1662 is \code{down} is in the limbo state between \code{off} and 1663 \code{idle}. 1664 1665 Once pcontrol has made a successful connection to the host, the host 1666 is in the \code{idle} state. At this point, it is ready to accept jobs 1667 from pcontrol for execution. Pcontrol periodically queries the hosts 1668 to check that they are still alive. If a host is discovered to be 1669 unresponsive, and particularly if the remote pipe connection has 1670 closed, then the machine is moved back to the \code{down} state. 1671 1672 Hosts which are \code{idle} may accept a job from pcontrol. A job 1673 simply consists of a bare UNIX command, without redirection of 1674 standard input or standard output. The host will initiate the job, and 1675 pcontrol will place the host into the \code{busy} state. The remote 1676 client, pclient, runs the job in the background and will continue to 1677 accept input from pcontrol. pcontrol will continue to check the status 1678 of the host, and now also the status of the specific job. As before, 1679 if the connection breaks, pcontrol will migrate the host to the 1680 \code{down} state. Any job already initiated on a host which goes down 1681 will be returned to the pool of unexecuted jobs for later processing, 1682 so the job will not be lost. 1683 1684 When the job exits, pclient tells pcontrol that the job is completed, 1685 and specifies the exit status. At this point, pcontrol will move the 1686 host from \code{busy} to \code{done} state. It will stay in this state 1687 until pcontrol can determine the ending conditions and reset the 1688 remote client. pcontrol requests the standard error and standard 1689 output from the job from pclient. pcontrol stores this data with its 1690 information about the completed job, and send a reset command to the 1691 remote client. Once these cleanup tasks are successfully completed, 1692 pcontrol will move the host to the \code{idle} state, ready for 1693 further jobs. 1694 1695 Each physical computer may have multiple processors. pcontrol treats 1696 each processor independently. It is up to the system configuration if 1697 each computer needs to reserve one of its CPUs to manage background 1698 tasks or if pcontrol should attempt to send one task per CPU and let 1699 the operating system handle the I/O load. some of this behavior will 1700 probably be eventually more intelligent. For example, the commands 1701 which turn a host on or off should be able to do the same operation to 1702 all host connections for the same machine name. 1703 1704 A machine may be completely removed from pcontrol's host tables with 1705 the command host delete (hostname). 1706 1707 \subsubsection{Jobs} 1708 1709 The pcontrol accepts new jobs with the command \code{job ...}, in 1710 which the ellipsis represents the command and arguments of a valid 1711 UNIX command. The commands are run under \code{sh}, and are executed 1712 in the user's home directory. Users should be wary of the conditions 1713 under which the remote jobs are run. If the nodes in question all 1714 cross-mount the same home directories, multiple jobs which interact 1715 with the same named file may produce unexpected results. The 1716 controller cannot enforce good behavior on the part of the remote 1717 jobs; it is the responsibility of the user to ensure that conflicts do 1718 not arise by, eg, always using unique output file names. 1719 1720 Other issues may arise from the fact that pcontrol may be choosing any 1721 of the hosts to run the job. Typical failures arise if the user does 1722 not realize that specific jobs do not behave the same on all machines, 1723 or if a necessary resource (eg, some input data file) is only 1724 available or accessible from some of the hosts. It is also the 1725 responsibility of the task to wait for network lags (ie, NFS delays). 1726 1727 pcontrol gives each task a unique internal identifier (Job ID) 1728 equivalent to the process ID used in UNIX. When a job is submitted to 1729 pcontrol, the command echoes back the Job ID. This ID may be used by 1730 other pcontrol commands to obtain information about or interact with 1731 the job. For example, PanTasks uses the Job ID to examine specific 1732 jobs. 1733 1734 A job may specify a specific host for the task execution. The host 1735 specified for a job may be required, or desired. In the first case, 1736 pcontrol, will only run the job on the specified host, waiting until 1737 it is available before attempting the job. In the second case, 1738 pcontrol will attempt to send the job to the specified host, but if 1739 the host is unavailable (how long? what conditions?), pcontrol will 1740 allow the job to be sent to an alternative host. pcontrol attempts to 1741 honor the requests for required and desired hosts, giving priority 1742 first to required-host jobs, then to the desired-host jobs, and 1743 finally to all other jobs. To specify a host for a job, the following 1744 commands are used: 1745 1746 \begin{verbatim} 1747 job -host (command and arguments...) 1748 job +host (command and arguments...) 1749 \end{verbatim} 1750 1751 1752 The first case specifies a desired host, while the second specifies a 1753 required host. It is also possible to specify the special host name 1754 anyhost, which is equivalent to not specifying a host at all. 1755 1756 Job priority / urgency levels are not implemented at this time. 1757 1758 I/O vs CPU tasks are not currently distinguished by pcontrol 1759 1760 pcontrol stores the stdout and stderr for each completed job. To 1761 retrieve these data from these streams, the user issues the commands 1762 stdout (JobID) and stderr (JobID). The result is a single line 1763 specifying the number of bytes to expect, followed by a dump of the 1764 buffers, followed by the prompt. It is the user's responsibility to 1765 relieve pcontrol of this data load by deleting jobs once they are no 1766 longer needed. Job deletion is performed with the command delete 1767 (JobID). 1768 1769 \begin{figure} 1770 \begin{center} 1771 \includegraphics[scale=0.85,angle=-90]{pics/pantasks.05.ps} 1772 \caption{\label{queues} pcontrol job states. Transitions labeled Ux 1773 are issued by the pcontrol user (including PanTasks). Transitions 1774 labeled Px are initiated by pcontrol. Transitions labeled Tx are 1775 the result of the job completion} 1776 \end{center} 1777 \end{figure} 1778 1779 Jobs are moved between the following states by pcontrol (see 1780 Figure~\ref{JobStates}): 1548 1781 \begin{itemize} 1549 \item moving data from the Summit pixel server ($\sim 30$ second timescales)1550 \item running the science analysis stages ($\sim 30$ second timescales)1551 \item testing the validity of the current detrend images ($\sim$1552 nightly) 1553 \item c onstructing new detrend images ($\sim$ weekly)1782 \item pending: the job has not yet been executed. 1783 \item busy: the job is currently being executed. 1784 \item done: the job has completed, but the stdout/stderr has not been processed by pcontrol. 1785 \item exit: the job has completed with a valid exit status 1786 \item crash: the job has completed with a crash status (exit on signal). 1554 1787 \end{itemize} 1555 The scheduler may be viewed as a complex state machine. The goal is 1556 to design the scheduler so that rules may be specified independently 1557 from the engine which parses the rules to determine which specific jobs 1558 to send to the controller. 1559 1560 \subsubsection{User Interface} 1561 1562 The IPP Scheduler shall possess a user interface which allows a human 1563 operator, or other processes, to monitor the current state of the 1564 Scheduler. Users have the option to specify that a particular task or 1565 set of tasks is of higher or lower urgency (as defined in 1566 Section~\ref{sec:Controller}) than the norm, or to schedule a 1567 particular tasks on a different timescale from the basic rule. 1568 1569 The IPP Scheduler defines the operating state of the IPP and shares 1570 the same set of states: 1571 \begin{itemize} 1572 \item active state 1573 \item interactive state 1574 \item paused state 1575 \end{itemize} 1576 When the IPP Scheduler is in the {\em active state}, it performs the 1577 most appropriate of all possible tasks at a particular time. When the 1578 IPP Scheduler is in the {\em interactive state}, it performs only a 1579 specific requested action regardless of the outcome of the decision 1580 trees. In addition, in the interactive state, the IPP Scheduler must 1581 only perform the requested actions and not attempt to perform the 1582 other normally-required actions. The only exception to this exclusion 1583 is that, in the interactive state, data is still copied from the 1584 summit system. An additional IPP state is the {\em paused state}, 1585 intended for tests or maintenance, in which case the IPP Scheduler 1586 does not perform even the data copy tasks. Every task is performed on 1587 demand by the user. A user command sets the IPP Scheduler in one of 1588 these three states, {\em active}, {\em interactive}, and {\em paused}. 1788 1789 \subsubsection{Miscellaneous Commands} 1790 1791 It is possible to check the status of a single host or job with the 1792 user command \code{check}. 1793 1794 pcontrol continuously examines the stack of jobs, adjusting their 1795 state as needed and extracting their output when it is ready. These 1796 checks are performed in the background, with pcontrol ready to accept 1797 further commands from the user in the foreground. These checks are 1798 performed after every keystroke, and also after an inactivity 1799 timeout. The interrupt interval defaults to 1 second, but may be 1800 adjusted with the pulse command, which takes as an argument, the 1801 number of microseconds for the timeout. 1802 1803 The pcontrol system status may be examined with the command 1804 status. This provides a dump of the job stacks and the host stacks. 1805 1806 It is possible to list the jobs currently in a specific stack, 1807 corresponding to the list of jobs with a given state. This is done 1808 with the command jobstack (stackname). The valid stack names are 1809 pending, busy, exit, crash, and done. The result is a list of all jobs 1810 on the specified stack. This is useful to determine quickly which jobs 1811 have exited or crashed. 1812 1813 A specific job may be killed with the command \code{kill 1814 (JobID)}. This command is only valid for a job in the busy state. Any 1815 job in the pending, exit, or crash state may be deleted with the 1816 \code{delete (JobID)} command. This is necessary to free the memory 1817 associated with the job and its output streams. PanTasks 1818 automatically performs these job harvesting functions. 1819 1820 The command \code{verbose (mode)} turns the verbosity of the pcontrol 1821 operations on or off. 1822 1823 The pcontrol and Nebulous have related needs for information from the 1824 combined storage-and-processing nodes regarding which nodes are 1825 available. Currently, the two systems independently examine the 1826 hardware to judge the availability. It is not yet clear if this 1827 information is best stored in a single location (either pcontrol or 1828 Nebulous), which provides the information to other systems on demand. 1829 The current implementation allows the IPP system as a whole to 1830 distinguih nodes which are available for processing from those that 1831 are available to serve data as part of Nebulous. 1832 1833 \begin{figure} 1834 \begin{center} 1835 \includegraphics[scale=0.85,angle=-90]{pics/pantasks.06.ps} 1836 \caption{\label{PControlLoop} PControl Job Monitor Loop} 1837 \end{center} 1838 \end{figure} 1839 1840 Figure~\ref{PControlLoop} illustrated the pcontrol job monitor loop. 1841 This is very similar to the loop in PanTasks. A background process 1842 launched by readline during idle periods cycles through the list of 1843 hosts (children) and migrates jobs to and from them as needed. 1844 1845 \subsubsection{pclient} 1846 1847 pclient is the remote process monitor for pcontrol, the parallel 1848 process controller. 1849 1850 The program pclient is used to support the remote jobs which are run 1851 on the remote hosts by pcontrol. The concept of pclient is to act as a 1852 buffer between the job running on the remote host and pcontrol. The 1853 pcontrol design uses (by default) ssh connections initiated by 1854 pcontrol to the remote hosts. These connections execute the remote 1855 program of pclient. The use of a remote login process lets the UNIX 1856 system take care of the user authentication issues. In this case, the 1857 recommended practice is to set up ssh to allow the connection to the 1858 remote host without additional authentication using the appropriate 1859 authorized keys. The security is maintained by the security of ssh 1860 logins to the computers used by PanTask and pcontrol. 1861 1862 It is convenient to keep a continuous connection to the remote 1863 hosts. This avoids incurring the overhead of authentication for each 1864 command which is executed, while keeping a high-quality user 1865 authentication process in place. 1866 1867 pclient acts as a buffer between pcontrol and the remote background 1868 process, allowing the continuous connection to remain viable without 1869 samping pcontrol with output from the jobs. 1870 1871 \begin{figure} 1872 \begin{center} 1873 \includegraphics[scale=0.85,angle=-90]{pics/pantasks.07.ps} 1874 \caption{\label{queues} PanTasks queues and MDDB tables} 1875 \end{center} 1876 \end{figure} 1589 1877 1590 1878 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% … … 2507 2795 object analysis in the other analysis stages. 2508 2796 2509 \subsection{AstroRef: Astrometric Reference Catalog creation} 2510 2511 \tbd{needs to be fleshed out substantially} 2512 2513 This processing stage shall use many observations over a given time 2514 period to fit a consistent global astrometric solution, resulting in a 2515 high quality and internally-consistent astrometric catalog that may be 2516 published. 2517 2518 \subsection{PhotoRef: Photometric Reference Catalog creation} 2519 2520 \tbd{needs to be fleshed out substantially} 2521 2522 This processing stage shall use many observations over a given time 2523 period to fit a consistent global photometric solution, resulting in a 2524 high quality and internally-consistent photometric catalog that may be 2525 published. 2797 \section{IPPtools} 2798 2799 Above, we discussed PanTasks, the IPP scheduler which determines the 2800 new jobs to run and distributes them to computers across the network. 2801 PanTasks is a general tool; by it self it does not define the specific 2802 analysis tasks that the IPP requires. The previous few sections 2803 discussed in detail the analysis which is performed by the IPP 2804 analysis stages. IPPtools is the collection of PanTasks scripts, 2805 Metadata Database interaction programs, and other tools used to 2806 definet the specific analysis stages of the IPP. 2807 2808 \tbd{this section needs to be fleshed out with a summary of the 2809 ippTools functions. The stand-alone IPPTools document gives a 2810 detailed discussion of these issues}. 2526 2811 2527 2812 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% … … 3968 4253 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3969 4254 4255 \section{PanTasks Example : Pcopy.pro} 4256 4257 Below is an example script for psched which demonstrates the 4258 scheduling system. This parallel-copying script implements the 4259 Pan-STARRS image copying system, which requests images from the summit 4260 and copies them to the appropriate computer. The first task in the 4261 script queries an external system for new image names with the 4262 function new.images. In the case of Pan-STARRS, this would be a 4263 request from OTIS, the observatory controlling system. The second task 4264 initiates the individual image copies, with separate CCDs being copied 4265 to separate computers. This script uses the concept of having specific 4266 machines assigned to specific CCDs (as Pan-STARRS intends to 4267 operate). The association is determined by calling the external 4268 function chip.host, providing the identifier of the chip in 4269 question. This returns an appropriate host. The copy.image function 4270 copies the file and also sends a message to the summit system to 4271 inform it that the image has been successfully copied. 4272 4273 \begin{verbatim} 4274 verbose on 4275 queueinit newImages 4276 exec echo 0 > new.last 4277 exec cp -f raw.list new.list 4278 4279 controller host add po01 4280 controller host add po02 4281 controller host add po03 4282 controller host add po04 4283 4284 # identify the images ready for copy 4285 # new entries are added to queue newImages 4286 # need to compare the new list with the ones already being processed 4287 task new.images 4288 command new.images 4289 host local 4290 4291 periods -poll 1 4292 periods -exec 5 4293 periods -timeout 5 4294 4295 # success 4296 task.exit 0 4297 local i j Nstdout Nimages 4298 # compare output with new.image queue 4299 # keep only new entries 4300 queuesize stdout -var Nstdout 4301 for i 0 $Nstdout 4302 queuepop stdout -var line 4303 queuepush newImages -uniq -key 0 "$line" 4304 end 4305 end 4306 4307 # locked list 4308 task.exit 1 4309 echo "new.images: exec failure" 4310 $new.image.failure ++ 4311 end 4312 4313 # default exit status 4314 task.exit default 4315 echo "new.images: unknown exit status: $EXIT" 4316 $new.image.failure ++ 4317 end 4318 4319 # operation times out? 4320 task.exit timeout 4321 echo "new.images: timeout" 4322 $new.image.failure ++ 4323 end 4324 end 4325 4326 # copy new images, sending job to desired host 4327 task copy.images 4328 periods -poll 0.2 4329 periods -exec 1 4330 periods -timeout 5 4331 4332 task.exec 4333 queuesize newImages -var N 4334 if ($N == 0) break 4335 # if ($network == 0) break 4336 # if ($filesystem == 1) break 4337 4338 queuepop newImages -var line 4339 list tmp -split $line 4340 $filename = $tmp:0 4341 $chip = $tmp:1 4342 $state = $tmp:2 4343 if ($state == new) 4344 # copy this image 4345 queuepush newImages -replace -key 0 "$filename $chip run" 4346 else 4347 # ignore this image 4348 queuepush newImages -replace -key 0 "$filename $chip $state" 4349 break 4350 end 4351 # echo $chip 4352 $host = `chip.host $chip` 4353 # echo $host 4354 host $host 4355 # echo "starting copy for $filename on $host..." 4356 command copy.image $filename $chip 4357 end 4358 4359 # can I have access to argc,argv? 4360 4361 # success 4362 task.exit 0 4363 echo "done copy..." 4364 queuepop stdout -var line 4365 list tmp -split $line 4366 $filename = $tmp:0 4367 $chip = $tmp:1 4368 exec mark.image $filename 4369 queuepush newImages -replace -key 0 "$filename $chip copy" 4370 end 4371 4372 # default exit status 4373 task.exit default 4374 echo "new.images: unknown exit status: $EXIT" 4375 $new.image.failure ++ 4376 end 4377 4378 # operation times out? 4379 task.exit timeout 4380 echo "new.images: timeout" 4381 $new.image.failure ++ 4382 end 4383 end 4384 4385 \end{verbatim} 4386 3970 4387 \input{glossary.tex} 3971 4388 … … 3976 4393 * output data products 3977 4394 * DVO 3978 * PanTasks3979 4395 * ipptools / ippMonitor? 3980 4396 * analysis stages, versions and iterations
Note:
See TracChangeset
for help on using the changeset viewer.
