Changeset 6055
- Timestamp:
- Jan 19, 2006, 12:58:19 AM (21 years ago)
- Location:
- trunk/doc
- Files:
-
- 10 edited
-
Makefile (modified) (1 diff)
-
design/ippSSDD.tex (modified) (6 diffs)
-
dvo/dvo.tex (modified) (7 diffs)
-
pantasks/pantasks.tex (modified) (19 diffs)
-
pantasks/pcontrol.sxi (modified) ( previous)
-
pantasks/pics/pantasks.01.ps (modified) ( previous)
-
pantasks/pics/pantasks.02.ps (modified) ( previous)
-
pantasks/pics/pantasks.03.ps (modified) ( previous)
-
pantasks/pics/pantasks.04.ps (modified) ( previous)
-
pantasks/pics/pantasks.05.ps (modified) ( previous)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/Makefile
r6033 r6055 1 1 # Makefile for all IPP main engineering documents 2 2 3 DIR = pslib modules design hardware ipptools pantasks psphot misc3 DIR = pslib modules design hardware dvo ipptools pantasks psphot misc 4 4 5 5 all: -
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 -
trunk/doc/dvo/dvo.tex
r6035 r6055 19 19 \pagenumbering{arabic} 20 20 21 \subsection{Photometric systems and the DVO Photcodes} 21 \section{Overview} 22 23 DVO, the Desktop Virtual Observatory, is a software system which 24 stores data related to astronomical objects derived from various 25 sources, and provides mechanisms to related multiple detections 26 together as astronomical objects. DVO deals with two related 27 concepts: {\em objects} and {\em detections}. The {\em objects} are 28 descriptions of astronomical objects while the {\em detections} are 29 the specific measurements of those objects, typically measured from 30 astronomical images. A collection of {\em detections} may be used to 31 derive average quantities which describe a particular {\em object}. A 32 third class of measurement to be considered are those supplied by 33 external references. Such measurements may be treated as {\em 34 detections}, with the caveat that access to the raw measurements and 35 metadata are usually unavailable: the reported measurements and errors 36 must be accepted as they are reported. 37 38 DVO stores the collections of detections which were derived from 39 specific images. It provides a mechanism to determine the image from 40 which a specific detection was derived, and in conjunction with the 41 Image Server locate the corresponding data file. DVO also makes it 42 possible to extract all detections derived from a specific image and 43 to determine quantities such as the pixel coordinates of the detection 44 on the image. 45 46 DVO also has the capability to associate multiple detections of a 47 specific object. Several major classes of objects will be present, 48 each of which must be handled correctly. DVO distinguished the 49 following types of objects. 50 51 {\bf Stars, compact galaxies, and QSOs} will have nearly fixed 52 locations relative to other distant stars, with only small deviations 53 for individual measurements. The association between multiple 54 detections of such objects is made on the basis of their coincident 55 positions. DVO determines the average position of the object and the 56 deviations of the individual detections from that average on the basis 57 of the ensemble of individual detection. 58 59 {\bf Solar System Objects} do not have a fixed location. Detections 60 of such objects are linked by their orbits, and depend on both the 61 position and the time of the image. DVO does not attempt to make this 62 link; this is the role of the MOPS system. However, it has the 63 ability to accept identifications made externally with specified 64 detections and to return the identifier of the moving object 65 associated with the specific detections. These associations also 66 include descriptive information such as the offset of the detection 67 from the predicted location of the detection based on the orbit. This 68 functionality is required to allow DVO to ignore known moving object 69 detections from other types of queries. 70 71 {\bf High-proper-motion objects} in the general vicinity of the solar 72 system fall in between these first two classes of objects. Their 73 proper motion and parallax response is significant enough ($>0.2$ 74 arcsec in 1 year) that they are not well-described by an average 75 location and a collection of offsets. These objects are better 76 described by a distance and a proper motion vector. DVO provides the 77 association between the specific detections and an average object 78 which includes finite parallax and proper motion. 79 80 {\bf Orphaned detections} are not associated with a specific 81 astronomical object of any of the above classes. Most of these will 82 be spurious (not representing real objects), some will be from solar 83 system objects for which orbits are not yet determined, some will be 84 from faint stars near the detection limits, and some will be from 85 short-term transients which have only been detected once. DVO 86 maintains these detections until they have been associated with one of 87 the objects above. DVO provides mechanisms by which individual 88 detections may be migrated back and forth between the orphan state and 89 association with an astronomical object. 90 91 DVO stores the information about the detection, the related objects, 92 and the images which provided the measurements. For every detection, 93 DVO provides the mechanisms to link the detection back to the image 94 which supplied it. DVO also provides the capability to determine the 95 images containing a specific location but for which no detection was 96 made. The minimum set of information which must be carried for these 97 non-detections is the image and the associated object or orphan. 98 99 DVO also stores the relationships between various 100 photometric systems and the evolution of that relationship. It 101 provides mechanisms to convert between the measured instrumental 102 magnitude of a detection with a specific filter, detector, and 103 telescope, and at a particular time and the implied magnitude in the 104 average Pan-STARRS photometry system, given a determined set of 105 calibrations. It also provides the capability to convert magnitudes 106 in one system to the magnitudes in another system; an example of such 107 a conversion is between the average Pan-STARRS filter systems and the 108 various reference systems appropriate for those filters. 109 110 \section{Photometric systems and the DVO Photcodes} 22 111 23 112 One of the major roles of DVO is to relate different photometric … … 26 115 number of different detectors. We may have observations from 27 116 different telescopes in similar filters. We may have reference data 28 related to some filter, but obtained and published by other 29 observers. We would like to related these measurements together in 30 optimal ways, making use of whatever information we have available. 31 DVO providesseveral mechanisms to enable these relationships.117 related to some filter, but obtained and published by other observers. 118 We would like to related these measurements together in optimal ways, 119 making use of whatever information we have available. DVO provides 120 several mechanisms to enable these relationships. 32 121 33 122 We identify three distinct types of photometry measurements within … … 208 297 parameters. 209 298 210 \section{Overview}211 212 DVO, the Desktop Virtual Observatory, is a software system which213 stores data related to astronomical objects derived from various214 sources, and provides mechanisms to related multiple detections215 together as astronomical objects. DVO deals with two related216 concepts: {\em objects} and {\em detections}. The {\em objects} are217 descriptions of astronomical objects while the {\em detections} are218 the specific measurements of those objects, typically measured from219 astronomical images. A collection of {\em detections} may be used to220 derive average quantities which describe a particular {\em object}. A221 third class of measurement to be considered are those supplied by222 external references. Such measurements may be treated as {\em223 detections}, with the caveat that access to the raw measurements and224 metadata are usually unavailable: the reported measurements and errors225 must be accepted as they are reported.226 227 DVO stores the collections of detections which were derived from228 specific images. It provides a mechanism to determine the image from229 which a specific detection was derived, and in conjunction with the230 Image Server locate the corresponding data file. DVO also makes it231 possible to extract all detections derived from a specific image and232 to determine quantities such as the pixel coordinates of the detection233 on the image.234 235 DVO also has the capability to associate multiple detections of a236 specific object. Several major classes of objects will be present,237 each of which must be handled correctly. DVO distinguished the238 following types of objects.239 240 {\bf Stars, compact galaxies, and QSOs} will have nearly fixed241 locations relative to other distant stars, with only small deviations242 for individual measurements. The association between multiple243 detections of such objects is made on the basis of their coincident244 positions. DVO determines the average position of the object and the245 deviations of the individual detections from that average on the basis246 of the ensemble of individual detection.247 248 {\bf Solar System Objects} do not have a fixed location. Detections249 of such objects are linked by their orbits, and depend on both the250 position and the time of the image. DVO does not attempt to make this251 link; this is the role of the MOPS system. However, it has the252 ability to accept identifications made externally with specified253 detections and to return the identifier of the moving object254 associated with the specific detections. These associations also255 include descriptive information such as the offset of the detection256 from the predicted location of the detection based on the orbit. This257 functionality is required to allow DVO to ignore known moving object258 detections from other types of queries.259 260 {\bf High-proper-motion objects} in the general vicinity of the solar261 system fall in between these first two classes of objects. Their262 proper motion and parallax response is significant enough ($>0.2$263 arcsec in 1 year) that they are not well-described by an average264 location and a collection of offsets. These objects are better265 described by a distance and a proper motion vector. DVO provides the266 association between the specific detections and an average object267 which includes finite parallax and proper motion.268 269 {\bf Orphaned detections} are not associated with a specific270 astronomical object of any of the above classes. Most of these will271 be spurious (not representing real objects), some will be from solar272 system objects for which orbits are not yet determined, some will be273 from faint stars near the detection limits, and some will be from274 short-term transients which have only been detected once. DVO275 maintains these detections until they have been associated with one of276 the objects above. DVO provides mechanisms by which individual277 detections may be migrated back and forth between the orphan state and278 association with an astronomical object.279 280 DVO stores the information about the detection, the related objects,281 and the images which provided the measurements. For every detection,282 DVO provides the mechanisms to link the detection back to the image283 which supplied it. DVO also provides the capability to determine the284 images containing a specific location but for which no detection was285 made. The minimum set of information which must be carried for these286 non-detections is the image and the associated object or orphan.287 288 DVO also stores the relationships between various289 photometric systems and the evolution of that relationship. It290 provides mechanisms to convert between the measured instrumental291 magnitude of a detection with a specific filter, detector, and292 telescope, and at a particular time and the implied magnitude in the293 average Pan-STARRS photometry system, given a determined set of294 calibrations. It also provides the capability to convert magnitudes295 in one system to the magnitudes in another system; an example of such296 a conversion is between the average Pan-STARRS filter systems and the297 various reference systems appropriate for those filters.298 299 299 \section{DVO Database Tables} 300 300 … … 499 499 data types and input/output methods without significant re-coding. 500 500 501 \tbd{DVO mysql table storage is not yet implemented} 502 501 503 \section{addstar : Insert Image \& Detection Set} 502 504 … … 505 507 \caption{\label{catalog} \small a figure } 506 508 \end{figure} 507 508 \tbd{fill out discussion of the addstar client/server implementation}509 509 510 510 One of the most basic operations needed by DVO is to insert a … … 527 527 faint orphans. 528 528 529 \subsection{addstar -refs : Insert Reference Objects} 530 531 This operation is very similar to the previous one. A collection of 532 reference objects are added to the database as a collection of 533 detections. The reference photometry should in general be given its 534 own photometry code. The reference data is different from the image 535 detection set because the associated image information is not 536 included. Thus, no corresponding images are added to the database. 537 538 \section{relphot : Relative Photometry Analysis} 529 A wide range of options are available to addstar. These can be used 530 to modify the object matching rules, to reduce the number of tables 531 which are updated, to specify the output data format, and so forth. A 532 few options modify the behavoir in substantial ways, as discussed in 533 the two sections below. 534 535 \tbd{flesh out discussion of the options} 536 537 \subsection{Insert Reference Objects} 538 539 \code{addstar -ref (filename)} 540 541 This mode of addstar reads a text file and adds the listed objects to 542 the database as a reference photcode type. A collection of reference 543 objects are added to the database as a collection of detections. The 544 reference photometry should in general be given its own photometry 545 code. The reference data is different from the image detection set 546 because the associated image information is not included. Thus, no 547 corresponding images are added to the database. 548 549 \subsection{Insert Catalog Objects} 550 551 \code{addstar -cat (name) -region ra ra dec dec} 552 553 In this mode, any of several all-sky or large-scale reference catalogs 554 are used for the input sources. The catalog objects are added to the 555 database as reference objects. The valid catalogs consist of 2MASS, 556 USNO, GSC. Tycho and USNO-B will be added shortly. Specific 557 photcode names are defined for each of these catalogs, and must be 558 appropriately requested and defined in the photcode table. The 559 optional region restriction limits the insert to a subset of the sky. 560 The user does not always want to add 50GB of 2MASS detections to any 561 DVO database... 562 563 \subsection{Addstar Client/Server Interactions} 564 565 DVO currently uses stand-alone programs which are run from the command 566 line (like addstar, or the programs listed below), or it works with 567 the interactive DVO shell, which allows the user to query portions of 568 the database. These programs all interact with the database tables 569 directly, making use of file locking to prevent conflicts. 570 571 Unlike the other DVO programs (currently), it is possible to run 572 addstar as a client/server system. In this configuration, the program 573 \code{addstard} is launched to run in the background as a server. It 574 monitors a socket waiting for clients to contact it. The client 575 program, \code{addstarc} appears to the user identical to the 576 stand-alone addstar. However, rather than directly insert data into 577 the database, \code{addstarc} contacts the addstar server and sends it 578 the detections and associated image data (along with the information 579 about the user options). The daemons accepts the incoming data and 580 then loads this data into the database, just as the stand-alone 581 addstar does. 582 583 The purpose of the addstar client/server design is three-fold. First, 584 the client can be used by processes to send data to the DVO database 585 and then immediately exit. The addstar loading process is one of the 586 more time-critical functions within the IPP. However, unlike the 587 other portions of the IPP, the addstar processes must operate in 588 serial, at least when they are updating the same portion of the sky 589 (or the image table). If the IPP analysis routines all needed to run 590 the stand-alone addstar program, they would eventually block waiting 591 for each addstar to complete, preventing other processing from 592 continuing. The addstar client / server model allows the processing 593 node to invoke the addstar client, sending the data to the addstar 594 server. The addstar server will then be the entity that manages the 595 serialization of the incoming data stream. The addstar server has two 596 threads which run in parallel. One thread monitors the socket and 597 accepts new data sets from addstar clients, adding the data to an 598 internal queue. The other thread pulls data off of the queue and 599 updates the database with the data. 600 601 A second advantage of the client/server interaction is that only the 602 new detections need to be sent across the network. To update the 603 database, addstar must load the average objects for the region from 604 the database tables. In the stand-alone mode, the addstar program 605 loads this data via NFS across the network from whatever device stores 606 the addstar tables. In the client/server model, the addstar server 607 always runs locally on the machine which holds the database tables. 608 Thus, for the server, all database access is local disk access. 609 610 The final advantage of the client/server model is that it enables the 611 parallel database model, which is not yet implemented as of Jan 612 2006. In this model, there are multiple addstar servers. Each one has 613 a fraction of the sky in the local tables. The identification of 614 which table is managed by this host/addstar server is stored in the 615 SkyRegion table. The addstar server simply accepts incoming 616 detections from the addstar clients. Any detections which it receives 617 which fall within the boundaries of tables that it manages are updated 618 as normal. The server then identifies the other addstar servers which 619 are responsible for the other detections. It then sends these 620 detections to those servers using the same socket communication used 621 by the addstar clients. The addstar server must also be ready accept 622 detections from other addstar servers. This relationship is 623 completely parallel, and any addstar client may send its data to any 624 addstar server, letting the servers hash out who owns what. The only 625 difficulty with this model is in handling sources near the boundaries 626 of the tables. Note that this issues exists whether those tables are 627 distributed across multiple machines or not. 628 629 Addstar uses the following strategy to handle detections on the table 630 boundaries. Detections are first added to each table completely 631 ignoring the neighboring tables. A detection which is close to the 632 boundary may either be associated with an average object contained 633 within the table, or not. If it is, the detection is associated with 634 that average object. If not, a new average object is created at the 635 location of the detection. So far, this process is identical to the 636 behavoir in the middle of the table. One a longer time-scale, a 637 process is run which mediates the table boundaries. In this analysis, 638 the two neighboring tables are simultaneously examined. The border 639 region, in a strip wider than the correlation radius, is examined in 640 detail. If two objects within the border region fall within 2x the 641 correlation radius of each other, their individual detections are 642 re-examined. These detections are re-added to a temporary table which 643 encompases the overlap. the resulting objects will in general have 644 detections from either side of the boundary. The average objects are 645 kept within the table as normal, but the detections are allowed to 646 migrate between the tables to stay with their object. \tbd{this 647 boundary cleanup process is not implemented to date}. 648 649 \section{Relphot : Relative Photometry Analysis} 539 650 540 651 This operation uses the overlaps of images and multiple observations 541 652 of the same objects to determine the relative photometry zero-points 542 for a collection of images. This is a task that wil berun much more653 for a collection of images. This is a task that is run much more 543 654 infrequently than the object insertion tasks. 544 655 545 \section{relphot} 546 547 \begin{verbatim} 548 * load data 549 o images: match photcode and time range, reset flags 550 o measure: select subset matching restritions on: photcode, time, dM, Minst, Mag, dophot == 1 551 * iterate to find Mcal, image.flags: 552 * write out modified Mcal values to image table 553 * write out modified Mcal values to measure table 554 * write out modified Mrel values to average table 555 \end{verbatim} 556 557 relphot has two primary purposes: 558 559 \begin{verbatim} 560 * calculate Mcal for images / measures 561 * calculate Mrel for stars 562 \end{verbatim} 563 564 relphot can also be used to determine the mosaic grid used to generate photometrically corrected flats (-grid option). 565 566 \subsection{data exclusion} 567 568 relphot uses only a subset of the photometry data to calculate Mcal 569 and Mrel. In the first stage, calculation of the Mcal values, relphot 570 loads the photometry data from each relevant catalog and creates an 571 internal subset catalog with the function bcatalog, excluding some of 572 the irrelevant data. In addition, it uses flags to mark some of the 573 data as invalid for the processing. bcatalog exclusions 574 575 \begin{verbatim} 576 * measure.photcode not equivalent to requested photcode 577 * measure.dophot != 1 578 * measure.Mcat > MAG_LIM 579 * measure.dM > SIGMA_LIM 580 * measure.Minst out of range (ImagMin - ImagMax) [optional] 581 * measure.t out of range (TSTART, TSTOP) 582 \end{verbatim} 583 584 flagged data 585 flagged image data 586 587 images can be flagged by setting bits of image.code stars can be 588 flagged by setting bits of average.code measures can be flagged by 589 setting bits of measure.flag 590 591 \begin{verbatim} 592 image.code 593 ID_IMAGE_NOCAL : ignore, irrelevant 594 ID_IMAGE_POOR : image measured bad 595 ID_IMAGE_SKIP : externally known bad dMcal > VALUE 596 FLAG_IMAGE_SCATTER clean_images fabs(Mcal) > VALUE 597 FLAG_IMAGE_ZEROPT clean_images dMcal > VALUE 598 FLAG_IMAGE_SCATTER clean_mosaics fabs(Mcal) > VALUE 599 FLAG_IMAGE_ZEROPT clean_mosaics mark_images does not seem to do 600 anything useful? 601 average.code Ngood < MEAS_TOOFEW setMrel Ngood < 602 MEAS_TOOFEW clean_measures ChiSq > STAR_CHISQ clean_stars dM > 603 STAR_SCATTER clean_stars average.code (STAR_BAD) is not saved by 604 relphot: it is set by clean_stars, clean_measures, and setMrel, but 605 not setMrelOutput. STAR_BAD should only be internal since it depends 606 on the photcode, but is not associated with a specific photcode in the 607 data. Just in case, it is reset to 0 in setMrelFinal. measure.flag X,Y 608 out of range setExclusions 3 sigma clipping clean_measures 609 \end{verbatim} 610 611 setting Mrel final value 612 613 setMrelFinal is used to set the final average.Mrel values. We do this 614 in 4 stages. In each stage, we set the Mrel values for stars which 615 have not already been set, based on the current exclusion settings. At 616 successive stages, we relax the exclusions, allowing the more spurious 617 objects to have a valid Mrel value to be set. In this loop, we 618 actually run setMrelOutput twice: once to get the approximate Mrel 619 value, then we flag the outlier measurements with 620 \code{clean_measure}, then we redetermine the Mrel values on this 621 basis, and mark the stars for exclusion from the next iteration. 622 623 \begin{verbatim} 624 exclude on 625 photcode 0 1 2 3 626 time range 0 1 2 3 627 MEAS_POOR 0 1 2 3 628 MEAS_TOOFEW 0 1 2 3 629 dophot == 10 0 1 2 630 inst mag 0 1 2 631 dophot != 1,2 0 1 632 ID_IMAGE_POOR 0 1 633 ID_IMAGE_SKIP 0 1 634 dophot != 1 0 635 measure.dM 0 636 \end{verbatim} 637 638 for all relphot runs, Mrel is re-calculated, and measures are marked at least if they are outliers in mag or ccd area. setMrel.output needs to do a few things differently from setMrel: 639 640 \begin{verbatim} 641 * set measure.Mcal (skipped in setMrel.basic) 642 * set average.Mrel if N < TOO_FEW (not STAR_BAD) (optional!) 643 * use MAX (stats.error, stats.sigma) (optionally) 644 * allow STAR_BAD? 645 \end{verbatim} 646 647 \section{uniphot : Zero Point Analysis} 656 The relphot analysis is currently performed with a single Sky region 657 as the starting point. All images (or all chips from all mosaic 658 iamges) which overlap the sky region are identified in the image 659 table. This set of images are considered set A. Next, all skyregions 660 which are overlapped by all of these images are selected. Finally, 661 all additional images which overlapped the new regions only are 662 selected. These are considered as image set B. The image selections 663 are also restricted to images of a single, user-selected photcode. 664 665 All of the objects and detections which are contributed by the images 666 in sample A are extracted from the average and measure tables. Only a 667 subset of the detections for which the S/N is greater than a 668 user-selected limit are kept. Other restrictions, such as time range 669 or instrumental magnitude ranges may also be specified. The 670 collection of average objects, their detections, and the images from 671 which they were derived now define a system of photometry equations. 672 In this system, every image has a calibration offset magnitude 673 ($M_{cal}$), every object has an average magnitude in a relative 674 system ($M_{rel}$), and every detection of that object has a magnitude 675 defined by the equation $M = M_{rel} + M_{cal}$. The goal is to solve 676 for the values of $M_{ref}$ and $M_{cal}$. 677 678 There are two points to note about this operation. First, the system 679 of equations is generally much too large to solve directly; we must 680 use an iterative technique to converge on a solution. Second, it is 681 important in the analysis to use robust averaging and identify 682 detections, stars, or images which are deviant in some way. These 683 should be marked and given set weight in the solution. These cases 684 may represent poorly measured objects (perhaps detections on or near a 685 bad column), variable stars, and images obtained in poor weather 686 conditions. 687 688 Relphot can also be used to determine the mosaic grid used to generate 689 photometrically corrected flats (-grid option). 690 691 \section{Uniphot : Zero Point Analysis} 648 692 649 693 This operation uses the time history of relative photometry zero … … 1482 1526 \end{itemize} 1483 1527 1528 1529 1530 \subsection{Relphot data exclusion} 1531 1532 relphot uses only a subset of the photometry data to calculate Mcal 1533 and Mrel. In the first stage, calculation of the Mcal values, relphot 1534 loads the photometry data from each relevant catalog and creates an 1535 internal subset catalog with the function bcatalog, excluding some of 1536 the irrelevant data. In addition, it uses flags to mark some of the 1537 data as invalid for the processing. bcatalog exclusions 1538 1539 \begin{verbatim} 1540 * measure.photcode not equivalent to requested photcode 1541 * measure.dophot != 1 1542 * measure.Mcat > MAG_LIM 1543 * measure.dM > SIGMA_LIM 1544 * measure.Minst out of range (ImagMin - ImagMax) [optional] 1545 * measure.t out of range (TSTART, TSTOP) 1546 \end{verbatim} 1547 1548 flagged data 1549 flagged image data 1550 1551 images can be flagged by setting bits of image.code stars can be 1552 flagged by setting bits of average.code measures can be flagged by 1553 setting bits of measure.flag 1554 1555 \begin{verbatim} 1556 image.code 1557 ID_IMAGE_NOCAL : ignore, irrelevant 1558 ID_IMAGE_POOR : image measured bad 1559 ID_IMAGE_SKIP : externally known bad dMcal > VALUE 1560 FLAG_IMAGE_SCATTER clean_images fabs(Mcal) > VALUE 1561 FLAG_IMAGE_ZEROPT clean_images dMcal > VALUE 1562 FLAG_IMAGE_SCATTER clean_mosaics fabs(Mcal) > VALUE 1563 FLAG_IMAGE_ZEROPT clean_mosaics mark_images does not seem to do 1564 anything useful? 1565 average.code Ngood < MEAS_TOOFEW setMrel Ngood < 1566 MEAS_TOOFEW clean_measures ChiSq > STAR_CHISQ clean_stars dM > 1567 STAR_SCATTER clean_stars average.code (STAR_BAD) is not saved by 1568 relphot: it is set by clean_stars, clean_measures, and setMrel, but 1569 not setMrelOutput. STAR_BAD should only be internal since it depends 1570 on the photcode, but is not associated with a specific photcode in the 1571 data. Just in case, it is reset to 0 in setMrelFinal. measure.flag X,Y 1572 out of range setExclusions 3 sigma clipping clean_measures 1573 \end{verbatim} 1574 1575 setting Mrel final value 1576 1577 setMrelFinal is used to set the final average.Mrel values. We do this 1578 in 4 stages. In each stage, we set the Mrel values for stars which 1579 have not already been set, based on the current exclusion settings. At 1580 successive stages, we relax the exclusions, allowing the more spurious 1581 objects to have a valid Mrel value to be set. In this loop, we 1582 actually run setMrelOutput twice: once to get the approximate Mrel 1583 value, then we flag the outlier measurements with 1584 \code{clean_measure}, then we redetermine the Mrel values on this 1585 basis, and mark the stars for exclusion from the next iteration. 1586 1587 \begin{verbatim} 1588 exclude on 1589 photcode 0 1 2 3 1590 time range 0 1 2 3 1591 MEAS_POOR 0 1 2 3 1592 MEAS_TOOFEW 0 1 2 3 1593 dophot == 10 0 1 2 1594 inst mag 0 1 2 1595 dophot != 1,2 0 1 1596 ID_IMAGE_POOR 0 1 1597 ID_IMAGE_SKIP 0 1 1598 dophot != 1 0 1599 measure.dM 0 1600 \end{verbatim} 1601 1602 for all relphot runs, Mrel is re-calculated, and measures are marked at least if they are outliers in mag or ccd area. setMrel.output needs to do a few things differently from setMrel: 1603 1604 \begin{verbatim} 1605 * set measure.Mcal (skipped in setMrel.basic) 1606 * set average.Mrel if N < TOO_FEW (not STAR_BAD) (optional!) 1607 * use MAX (stats.error, stats.sigma) (optionally) 1608 * allow STAR_BAD? 1609 \end{verbatim} 1610 -
trunk/doc/pantasks/pantasks.tex
r6033 r6055 24 24 tool which manages the sequencing of data analysis steps and, with the 25 25 related tool `PControl', distributes the data processing across a 26 cluster of computers. 26 cluster of computers. \tbd{uses the 'opihi' shell-scripting system} 27 27 28 28 The purpose of PanTasks is to manage the automatic construction and … … 30 30 uses a set of rules to define UNIX commands, and their corresponding 31 31 command-line arguments, to be performed on some regular, repeated 32 basis. The utility of PanTasks is that it can easily define an 33 analysis system which is completely state-based, as opposed to an 34 event-driven system. 35 36 The two basic units of PanTasks operation are the 'task' and the 37 'job'. A 'job' is simply a command the user would execute on a 38 command line; it consists of a command along with optional command 39 line arguments. A 'task' is a generic description of a type of job in 40 which the details of any specific piece of data are omitted. The task 41 defines the UNIX command which corresponds to the job, and it provides 42 rules for determining the identity of data for the job. The task also 43 defines tests which are used to decide if the job may be executed. 44 Finally, it defines a polling frequency in which PanTasks should 45 attempt to construct a new job for the task. 46 47 For example, we may want to regularly copy files from one location to 48 another. Perhaps the name of the next available file is available in 49 a database table, and can be retrieved with the command 'nextFile'. 50 Perhaps we wish to check for new files every 60 seconds. Thus, the 51 task is to copy files, while a specific job of this task might be of 52 the form \code{cp newfile newpath}. With PanTasks, we would define a 53 copy task somewhat like the following: 54 55 \begin{verbatim} 56 task copyfile 57 periods -exec 60.0 58 59 task.exec 60 $file = `nextFile` 61 if ($file == "none") 62 break 63 end 64 command cp $file $newpath 65 end 66 67 task.exit 0 68 queuepush copied $file 69 end 70 71 task.exit 1 72 queuepush failure $file 73 end 74 end 75 \end{verbatim} 76 77 In this simple example, the task is attempted every 60 seconds. If 78 there is no new file (output of 'nextFile' is 'none'), then no job 79 results from this task. If there is a new file, the copy command is 80 performed. This example is deceptively simple because one could 81 easily imagine writing a stand-along program which performs the same 82 thing. The important advantages of using PanTasks for this type of 83 operation are: 84 \begin{itemize} 85 \item the output from one job can be used to spawn a number of other tasks. 86 \item the success or failure state of each job can be used to spawn 87 other tasks. 88 \item the details of the job and data test are kept separated from the 89 rules which connect tasks together. 90 \item the relationships between tasks are kept together in a single 91 location. 92 \end{itemize} 93 94 In addition to these organizational advantages, PanTasks also provides 95 a direct connection to the tool for monitoring parallel jobs, 96 pcontrol. Thus the jobs spawned by PanTasks can be defined to run in 97 the background locally or on any of the computers in the parallel 98 processing cluster. 99 100 101 \section{PanTasks : the Scheduler} 102 103 The purpose of PanTasks is to manage the automatic construction and 104 execution of inter-related (often repetative) operations. PanTasks uses 105 a set of rules to define UNIX commands, and their corresponding 106 command-line arguments, to be performed on some regular, repeated 107 basis. The utility of PanTasks is that it can easily define an analysis 108 system which is completely state-based, as opposed to an event-driven 109 system. 32 basis. The utility of PanTasks is that it can easily define and 33 manage an analysis system which is completely state-based, as opposed 34 to an event-driven system. 110 35 111 36 Consider, for example, a telescope which obtains a collection of … … 149 74 \subsection{Tasks vs Jobs} 150 75 151 The primary function of PanTasks is to repeatedly perform tasks, and 152 execute jobs on the basis of those tasks. A task consists of a set of 153 rules which describe system state tests to perform on a regular time 154 scale. Based on the results of those state tests, the task will then 155 choose whether or not to construct a job. The task also defines 156 actions to perform upon the completion of a job, based upon the output 157 and exit status of the job. A task thus defines the repeat period. It 158 may optionally define valid or invalid time ranges (eg, Mon-Fri or 159 10:00-17:00, etc). The task may also specify that the job be run 160 locally (ie, in the background on the same computer as PanTasks) or 161 remotely by the parallel process controller (pcontrol). A job may even 162 be restricted to a specific computer managed by pcontrol. An example 163 of a simple tasks is given below. 164 165 \begin{verbatim} 166 task datalist 167 command ls /data/foo 168 periods -exec 5.0 169 periods -timeout 50.0 170 periods -poll 1.0 171 172 task.exit 0 173 queueprint stdout 174 queuedelete stdout 175 end 176 177 task.exit 1 178 queuepush failure "task failed" 179 end 180 end 181 \end{verbatim} 182 183 184 This task does not perform any system state tests; it is simply 185 constructs a new job every 5.0 seconds. The job in this case is always 186 the same: ls /data/foo . When the job finished, if the job exit status 187 is 0 (normal UNIX success status), the resulting output is printed to 188 the screen. If the job returns an exit status of 1 (a failure), the 189 failure queue receives a single entry. Although they are not defined 190 in this case, it is also possible to specify the action to be taken if 191 the job crashes (does not exit normally) or if it times out (runs 192 beyond the specified timeout period). A slightly more complex task 193 which performs a state test and constructs a command based on that 194 test is shown below 195 196 \begin{verbatim} 197 task datalist 198 periods -exec 5.0 199 periods -timeout 50.0 200 periods -poll 1.0 201 202 task.exec 203 $file = `next.file` 204 if ($file == "none") 205 break 206 end 207 command cp /data/foo/$file /data/bar 208 end 209 210 task.exit 0 211 queueprint stdout 212 queuedelete stdout 213 queuepush copied $file 214 end 215 216 task.exit 1 217 queuepush failure $file 218 end 219 end 220 \end{verbatim} 221 222 The task.exec macro is executed by PanTasks every 5.0 seconds. This 223 macro executes a (hypothetical user-defined) UNIX command (next.file) 224 which examines the system state, return either a filename or the word 225 "none". If the result of this test is "none", the task does nothing: 226 no job is constructed. Otherwise, a job is constructed using the name 227 of the file returned by the state test. Successful jobs have the 228 filename added to the 'copied' queue, while failed jobs add the 229 filename to the 'failure' queue. 76 The two basic units of PanTasks operation are the 'task' and the 77 'job'. A 'job' is simply a command the user would execute on a 78 command line; it consists of a command along with optional command 79 line arguments. A 'task' is a generic description of a type of job in 80 which the details of any specific piece of data are omitted. The task 81 defines the UNIX command which corresponds to the job, and it provides 82 rules for determining the identity of data for the job. The task also 83 defines tests which are used to decide if the job may be executed. 84 Finally, it defines a polling frequency in which PanTasks should 85 attempt to construct a new job for the task. 86 87 For example, we may want to regularly copy files from one location to 88 another. Perhaps the name of the next available file is available in 89 a database table, and can be retrieved with the command 'nextFile'. 90 Perhaps we wish to check for new files every 60 seconds. Thus, the 91 task is to copy files, while a specific job of this task might be of 92 the form \code{cp newfile newpath}. With PanTasks, we would define a 93 copy task somewhat like the following: 94 95 \begin{verbatim} 96 task copyfile 97 periods -exec 60.0 98 99 task.exec 100 $file = `nextFile` 101 if ($file == "none") 102 break 103 end 104 command cp $file $newpath 105 end 106 107 task.exit 0 108 queuepush copied $file 109 end 110 111 task.exit 1 112 queuepush failure $file 113 end 114 end 115 \end{verbatim} 116 117 In this simple example, the task is attempted every 60 seconds. If 118 there is no new file (output of 'nextFile' is 'none'), then no job 119 results from this task. If there is a new file, the copy command is 120 performed. This example is deceptively simple because one could 121 easily imagine writing a stand-along program which performs the same 122 thing. The important advantages of using PanTasks for this type of 123 operation are: 124 \begin{itemize} 125 \item the output from one job can be used to spawn a number of other tasks. 126 \item the success or failure state of each job can be used to spawn 127 other tasks. 128 \item the details of the job and data test are kept separated from the 129 rules which connect tasks together. 130 \item the relationships between tasks are kept together in a single 131 location. 132 \end{itemize} 133 134 In addition to these organizational advantages, PanTasks also provides 135 a direct connection to the tool for monitoring parallel jobs, 136 pcontrol. Thus the jobs spawned by PanTasks can be defined to run in 137 the background locally or on any of the computers in the parallel 138 processing cluster. 230 139 231 140 \subsection{Parallel vs Local Job Processing} 232 141 233 142 Jobs which are generated by PanTasks tasks may either be run locally 234 (forked in the background on the same machine as PanTasks) or run on the235 IPP parallel process controller, pcontrol. The default is for the job 236 to be run locally. If a job should be run on the parallel controller, 237 this can be specified by including the command host (hostname) in the 238 definition of a task. If the value of (hostname) is 'anyhost', then 239 pcontrol may select any of its host computers to run the job according 240 t o its own rules. If the value of (hostname) is one of the computers241 managed by pcontrol, then that machine will be selected for the job, 242 if it is available. This amounts to a preference to use that machine, 243 but pcontrol is allowed to substitute a different machine if it244 chooses. If the host command is given the option -required, then245 pcontrol is forced to use the named host, even if the machine is down, 246 unknown, or otherwise unavailable. If the machine is not available, 247 pcontrol will simply hold onto the job until the machine is available248 or the job is deleted. Note that PanTasks may delete jobs from pcontrol 249 if they remain pending for too long (see period -timeout).143 (forked in the background on the same machine as PanTasks) or run on 144 the IPP parallel process controller, pcontrol. The default is for the 145 job to be run locally. If a job should be run on the parallel 146 controller, this can be specified by including the command host 147 (hostname) in the definition of a task. If the value of (hostname) is 148 'anyhost', then pcontrol may select any of its host computers to run 149 the job according to its own rules. If the value of (hostname) is one 150 of the computers managed by pcontrol, then that machine will be 151 selected for the job, if it is available. This amounts to a preference 152 to use that machine, but pcontrol is allowed to substitute a different 153 machine if it chooses. If the host command is given the option 154 -required, then pcontrol is forced to use the named host, even if the 155 machine is down, unknown, or otherwise unavailable. If the machine is 156 not available, pcontrol will simply hold onto the job until the 157 machine is available or the job is deleted. Note that PanTasks may 158 delete jobs from pcontrol if they remain pending for too long. 250 159 251 160 It is possible to interact directly with the parallel processor to … … 287 196 identified to the controller. If such a host is required, the 288 197 controller will simply keep the associated jobs in the pending state 289 until such a machine exists. See the pcontrol documentationfor198 until such a machine exists. See the pcontrol section below for 290 199 further discussion of the controller manipuation of jobs and hosts. 291 200 … … 373 282 \item external communications 374 283 \item job exit status 375 \item job stdout parsing284 \item job stdout/stderr parsing 376 285 \end{itemize} 377 286 … … 399 308 value of the stdout lines from the UNIX command, and the value 400 309 \code{$var:n} is set to the number of output lines. 310 % $ 401 311 402 312 Fine-grained control over the job exit status is available with the … … 411 321 status. 412 322 413 Jobs may transmit their results back to PanTasks for further evaluation 414 through the standard output and standard error streams. Whenever a job 415 exits, the complete stdout and stderr streams from the job are pushed 416 onto the PanTasks queues stdout and stderr. The job exit macros may then 417 parse these queues, moving the results into other PanTasks / Opihi data 418 containers (queues, variables, vectors, whatever is appropriate). Note 419 that currently, the output data is simply pushed onto these output 420 queues. It is currently the responsibility of the PanTasks programmer to 421 use or dispose of the data in these queues. This may change in the 422 future: the queues may be flushed for each job completion. 323 Jobs may transmit their results back to PanTasks for further 324 evaluation through the standard output and standard error 325 streams. Whenever a job exits, the complete stdout and stderr streams 326 from the job are pushed onto the PanTasks queues \code{stdout} and 327 \code{stderr}. The job exit macros may then parse these queues, moving 328 the results into other PanTasks / Opihi data containers (queues, 329 variables, vectors, whatever is appropriate). Note that currently, the 330 output data is simply pushed onto these output queues. It is currently 331 the responsibility of the PanTasks programmer to use or dispose of the 332 data in these queues. This may change in the future: the queues may be 333 flushed for each job completion. 334 335 \subsection{PanTasks Monitoring Loop} 336 337 \begin{figure} 338 \begin{center} 339 \includegraphics[scale=0.85,angle=-90]{pics/pantasks.01.ps} 340 \caption{\label{MonitorLoop} PanTasks Monitor Loop} 341 \end{center} 342 \end{figure} 343 344 Figure~\ref{MonitorLoop} illustrates the operation of PanTasks. 345 Currently, PanTasks is run as a stand-alone foreground process, not a 346 server. In this current operating mode, PanTasks accepts commands 347 from the user (left side) via a GNU readline interface. Readline 348 provides a mechanism to schedule an background process which is 349 executed on a regular basis, or in the interval after each keystroke. 350 This background processing is represented as the loop on the right. 351 In this loop, PanTasks checks on the status of pcontrol and on any 352 locally spawned background jobs. It also checks the list of tasks for 353 tasks which are ready to be executed. The tasks and the background 354 jobs are kept in rotating queues. Every time the loop is processed, 355 PanTasks runs through a number of the background jobs and tasks, 356 attempting to evaluate as many as possible, but stopping after a 357 limited number of milliseconds. This test stage cycles through the 358 tasks and/or jobs in their queue, but stops if it examines all of the 359 entries in the queue. If this testing process runs out of time before 360 the entire queue is searched, it leaves the sequence intact for the 361 next pass. The timeout is set to keep the keyboard small enough to 362 keep the human interaction from being troublesome. 363 364 \begin{figure} 365 \begin{center} 366 \includegraphics[scale=0.85,angle=-90]{pics/pantasks.02.ps} 367 \caption{\label{TaskLoop} PanTasks Task Check Loop} 368 \end{center} 369 \end{figure} 370 371 Figure~\ref{TaskLoop} shows the interactions performed for each check 372 of the list of tasks. The task timers are examined to see if the 373 specific task is ready to be executed. If so, then the task exec 374 macro is executed. If this macro exit status is false, the loop goes 375 to the next task. If the task exec macro is true, the job command is 376 constructed and the job is submitted to the correct location, either 377 the controller (pcontrol) or to the queue of local, background jobs. 378 379 \begin{figure} 380 \begin{center} 381 \includegraphics[scale=0.85,angle=-90]{pics/pantasks.03.ps} 382 \caption{\label{JobLoop} PanTasks Job Check Loop} 383 \end{center} 384 \end{figure} 385 386 Figure~\ref{JobLoop} shows the interactions performed for each check 387 of a single background job. The job timer is checked to see if the 388 job has timed out. Next, the job run status is examined to see if the 389 job has finished or not. If the job has finished, the appropriate 390 exit macro is executed and the job results are returned to the rest of 391 the PanTasks data structures (ie, stderr and stdout queues are filled 392 out). Users should not define exit macros which perform long running 393 jobs, or PanTasks will become quite sluggish to keyboard strokes. 394 395 PanTasks also checks the current status of pcontrol on each loop. 396 In this test, PanTasks requests from pcontrol a list of the jobs which 397 have finished. It then attempts to harvest the finished jobs one by 398 one and place the results in the approrpiate locations. This loop is 399 also limited to a fixed amount of time; any pcontrol jobs which remain 400 unharvested are left for the next pass by PanTasks. 423 401 424 402 \subsection{Running the scheduler} … … 458 436 \end{verbatim} 459 437 460 \begin{figure}461 \begin{center}462 \includegraphics[scale=0.85]{pics/pantasks.01.ps}463 \caption{\label{queues} PanTasks queues and MDDB tables}464 \end{center}465 \end{figure}466 467 \begin{figure}468 \begin{center}469 \includegraphics[scale=0.85]{pics/pantasks.02.ps}470 \caption{\label{queues} PanTasks queues and MDDB tables}471 \end{center}472 \end{figure}473 474 \begin{figure}475 \begin{center}476 \includegraphics[scale=0.85]{pics/pantasks.03.ps}477 \caption{\label{queues} PanTasks queues and MDDB tables}478 \end{center}479 \end{figure}480 481 438 \newpage 482 439 \section{pcontrol : the PanTasks parallel controller} … … 494 451 \subsection{Host States} 495 452 453 \begin{figure} 454 \begin{center} 455 \includegraphics[scale=0.85,angle=-90]{pics/pantasks.04.ps} 456 \caption{\label{HostStates} PanTasks Host States} 457 \end{center} 458 \end{figure} 459 496 460 pcontrol maintains a table of available processing computers (hosts) 497 461 and tracks their status. Hosts managed by pcontrol are allowed to be 498 in one of several states: off, down, idle, busy, and done. These 499 states have the following meanings: 500 501 If the host is off, it is known to pcontrol, but pcontrol does not 502 have an active connection to the machine. Hosts which are off are not 503 available for jobs, and pcontrol does not attempt to initiate a 504 connection to them. 462 in one of several states: \code{off}, \code{down}, \code{idle}, 463 \code{busy}, and \code{done} (see Figure~\ref{HostStates}). There are 464 also two virtual states: \code{new} and \code{delete}. These states 465 have the following meanings: 466 467 If the host is \code{off}, it is known to pcontrol, but pcontrol does 468 not have an active connection to the machine. Hosts which are 469 \code{off} are not available for jobs, and pcontrol does not attempt to 470 initiate a connection to them. A pcontrol user may force a host to 471 transition to the \code{off} state with the command host 472 \code{off~(hostname)}. (Note that this command will set only one of 473 the connections to the named host to \code{off}. If multiple 474 connections to a machine have been defined, multiple \code{off} 475 commands must be sent). 505 476 506 477 When pcontrol is told to consider a machine on, the machine is moved 507 from the off state to the down state. Pcontrol attempts to initiate a 508 connection to the host. Connections are made by running a remote 509 client on the host, using the specified connection method. The 510 connection method may be ssh, rsh, or an equivalent remote shell 511 connection. The choice is specified by the COMMAND Opihi variable. The 512 remote connection starts a dedicated remote client which must accept 513 the pcontrol client commands and respond appropriately. The provided 514 remote client is called pclient, though in principal other equivalent 515 programs could be used by setting the Opihi variable SHELL (this 516 feature more generally allows a user to specify a path to the remote 517 client, if it is not in the user's path). A pcontrol user may force a 518 host to transition to the off state with the command host off 519 (hostname). ( Note that this command will set only one of the 520 connections to the named host to off. If multiple connections to a 521 machine have been defined, multiple off commands must be sent). 478 from the \code{off} state to the \code{down} state. Pcontrol attempts 479 to initiate a connection to the host. Connections are made by running 480 a remote client on the host, using the specified connection 481 method. The connection method may be ssh, rsh, or an equivalent remote 482 shell connection. The choice is specified by the \code{COMMAND} Opihi 483 variable. The remote connection starts a dedicated remote client which 484 must accept the pcontrol client commands and respond 485 appropriately. The provided remote client is called {\em pclient}, 486 though in principal other equivalent programs could be used by setting 487 the Opihi variable \code{SHELL}. This feature more generally allows a 488 user to specify a path to the remote client, if it is not in the 489 user's path. 522 490 523 491 If the remote connection is successful, the connected host is moved by 524 pcontrol from the down state to the idle state. If the connection is525 unsuccessful, pcontrol will try again after a certain period of 526 time. If the connection continues to be unsuccessful, the retry period 527 is doubled for each successiver connection attempt. If the user wants 528 t o force pcontrol to retry the connection to a machine (if, for529 example, the timeout is now very long, but the user knows the492 pcontrol from the \code{down} state to the \code{idle} state. If the 493 connection is unsuccessful, pcontrol will try again after a certain 494 period of time. If the connection continues to be unsuccessful, the 495 retry period is doubled for each successiver connection attempt. If 496 the user wants to force pcontrol to retry the connection to a machine 497 (if, for example, the timeout is now very long, but the user knows the 530 498 machine's ethernet cable has been re-inserted...), this can be 531 achieved with the command host retry (hostname). A host which is down 532 is in the limbo state between off and idle. 499 achieved with the command host \code{retry (hostname)}. A host which 500 is \code{down} is in the limbo state between \code{off} and 501 \code{idle}. 533 502 534 503 Once pcontrol has made a successful connection to the host, the host 535 is in the idle state. At this point, it is ready to accept jobs from 536 pcontrol for execution. Pcontrol repeatedly queries the hosts to check 537 that they are still alive. If a host is discovered to be unresponsive, 538 and particularly if the remote pipe connection has closed, then the 539 machine is moved back to the down state. 540 541 Hosts which are idle may accept a job from pcontrol. A job simply 542 consists of a bare UNIX command, without redirection of standard input 543 or standard output. The host will initiate the job, and pcontrol will 544 place the host into the busy state. The remote client, pclient, runs 545 the job in the background and will continue to accept input from 546 pcontrol. pcontrol will continue to check the status of the host, and 547 now also the status of the specific job. As before, if the connection 548 breaks, pcontrol will migrate the host to the down state. Any job 549 already initiated on a host which goes down will be returned for later 550 processing, so the job will not be lost. 504 is in the \code{idle} state. At this point, it is ready to accept jobs 505 from pcontrol for execution. Pcontrol periodically queries the hosts 506 to check that they are still alive. If a host is discovered to be 507 unresponsive, and particularly if the remote pipe connection has 508 closed, then the machine is moved back to the \code{down} state. 509 510 Hosts which are \code{idle} may accept a job from pcontrol. A job 511 simply consists of a bare UNIX command, without redirection of 512 standard input or standard output. The host will initiate the job, and 513 pcontrol will place the host into the \code{busy} state. The remote 514 client, pclient, runs the job in the background and will continue to 515 accept input from pcontrol. pcontrol will continue to check the status 516 of the host, and now also the status of the specific job. As before, 517 if the connection breaks, pcontrol will migrate the host to the 518 \code{down} state. Any job already initiated on a host which goes down 519 will be returned to the pool of unexecuted jobs for later processing, 520 so the job will not be lost. 551 521 552 522 When the job exits, pclient tells pcontrol that the job is completed, 553 523 and specifies the exit status. At this point, pcontrol will move the 554 host from busy to done state. It will stay in this state until 555 pcontrol can determine the ending conditions and reset the remote 556 client. pcontrol requests the standard error and standard output from 557 the job from pclient. pcontrol stores this data with its information 558 about the completed job, and send a reset command to the remote 559 client. Once these cleanup tasks are successfully completed, pcontrol 560 will move the host to the idle state, ready for further jobs. 524 host from \code{busy} to \code{done} state. It will stay in this state 525 until pcontrol can determine the ending conditions and reset the 526 remote client. pcontrol requests the standard error and standard 527 output from the job from pclient. pcontrol stores this data with its 528 information about the completed job, and send a reset command to the 529 remote client. Once these cleanup tasks are successfully completed, 530 pcontrol will move the host to the \code{idle} state, ready for 531 further jobs. 561 532 562 533 Each physical computer may have multiple processors. pcontrol treats … … 574 545 \subsection{Jobs} 575 546 576 The pcontrol accepts new jobs with the command job ..., in which the 577 ellipsis represents the command and arguments of a valid UNIX 578 command. The commands are run under sh, and are executed in the user's 579 home directory. (If it is desired, we can easily add a command to tell 580 pclient to perform cd). Users should be wary of the conditions under 581 which the remote jobs are run. If the nodes in question all 547 The pcontrol accepts new jobs with the command \code{job ...}, in 548 which the ellipsis represents the command and arguments of a valid 549 UNIX command. The commands are run under \code{sh}, and are executed 550 in the user's home directory. Users should be wary of the conditions 551 under which the remote jobs are run. If the nodes in question all 582 552 cross-mount the same home directories, multiple jobs which interact 583 553 with the same named file may produce unexpected results. The … … 590 560 not realize that specific jobs do not behave the same on all machines, 591 561 or if a necessary resource (eg, some input data file) is only 592 available or accessible from some of the hosts. It is the562 available or accessible from some of the hosts. It is also the 593 563 responsibility of the task to wait for network lags (ie, NFS delays). 594 564 … … 597 567 pcontrol, the command echoes back the Job ID. This ID may be used by 598 568 other pcontrol commands to obtain information about or interact with 599 the job. 569 the job. For example, PanTasks uses the Job ID to examine specific 570 jobs. 600 571 601 572 A job may specify a specific host for the task execution. The host … … 634 605 (JobID). 635 606 636 Jobs are moved between the following states by pcontrol: 637 607 \begin{figure} 608 \begin{center} 609 \includegraphics[scale=0.85,angle=-90]{pics/pantasks.05.ps} 610 \caption{\label{queues} pcontrol job states. Transitions labeled Ux 611 are issued by the pcontrol user (including PanTasks). Transitions 612 labeled Px are initiated by pcontrol. Transitions labeled Tx are 613 the result of the job completion} 614 \end{center} 615 \end{figure} 616 617 Jobs are moved between the following states by pcontrol (see 618 Figure~\ref{JobStates}): 638 619 \begin{itemize} 639 620 \item pending: the job has not yet been executed. … … 647 628 648 629 It is possible to check the status of a single host or job with the 649 user command check.630 user command \code{check}. 650 631 651 632 pcontrol continuously examines the stack of jobs, adjusting their … … 658 639 number of microseconds for the timeout. 659 640 660 the pcontrol system status may be examined with the command641 The pcontrol system status may be examined with the command 661 642 status. This provides a dump of the job stacks and the host stacks. 662 643 … … 668 649 have exited or crashed. 669 650 670 A specific job may be killed with the command kill (JobID). This 671 command is only valid for a job in the busy state. Any job in the 672 pending, exit, or crash state may be deleted with the delete (JobID) 673 command. This is necessary to free the memory associated with the job 674 and its output streams. 675 676 The command verbose (mode) turns the verbosity of the pcontrol 651 A specific job may be killed with the command \code{kill 652 (JobID)}. This command is only valid for a job in the busy state. Any 653 job in the pending, exit, or crash state may be deleted with the 654 \code{delete (JobID)} command. This is necessary to free the memory 655 associated with the job and its output streams. PanTasks 656 automatically performs these job harvesting functions. 657 658 The command \code{verbose (mode)} turns the verbosity of the pcontrol 677 659 operations on or off. 678 660 679 The pcontrol and the IPP Image Server have related needs for 680 information from the combined storage-and-processing nodes regarding 681 which nodes are available. It is not yet clear if this information is 682 best stored in a single location (either pcontrol or IPP Image 683 Server), which provides the information to other systems on demand, or 684 if both systems should maintain the information. Also, it may be 685 necessary to distinguish nodes which are available for processing from 686 those that are available to serve data as part of the IPP Image 687 Server. 688 689 \subsection{Command Summary} 661 The pcontrol and Nebulous have related needs for information from the 662 combined storage-and-processing nodes regarding which nodes are 663 available. Currently, the two systems independently examine the 664 hardware to judge the availability. It is not yet clear if this 665 information is best stored in a single location (either pcontrol or 666 Nebulous), which provides the information to other systems on demand. 667 The current implementation allows the IPP system as a whole to 668 distinguih nodes which are available for processing from those that 669 are available to serve data as part of Nebulous. 670 671 \begin{figure} 672 \begin{center} 673 \includegraphics[scale=0.85,angle=-90]{pics/pantasks.06.ps} 674 \caption{\label{PControlLoop} PControl Job Monitor Loop} 675 \end{center} 676 \end{figure} 677 678 Figure~\ref{PControlLoop} illustrated the pcontrol job monitor loop. 679 This is very similar to the loop in PanTasks. A background process 680 launched by readline during idle periods cycles through the list of 681 hosts (children) and migrates jobs to and from them as needed. 682 683 \subsection{pcontrol Command Summary} 690 684 691 685 \begin{verbatim} … … 703 697 \end{verbatim} 704 698 705 \begin{figure}706 \begin{center}707 \includegraphics[scale=0.85]{pics/pantasks.04.ps}708 \caption{\label{queues} PanTasks queues and MDDB tables}709 \end{center}710 \end{figure}711 712 \begin{figure}713 \begin{center}714 \includegraphics[scale=0.85]{pics/pantasks.05.ps}715 \caption{\label{queues} PanTasks queues and MDDB tables}716 \end{center}717 \end{figure}718 719 \begin{figure}720 \begin{center}721 \includegraphics[scale=0.85]{pics/pantasks.06.ps}722 \caption{\label{queues} PanTasks queues and MDDB tables}723 \end{center}724 \end{figure}725 726 699 \newpage 727 700 \section{pclient} … … 739 712 recommended practice is to set up ssh to allow the connection to the 740 713 remote host without additional authentication using the appropriate 741 authorized keys (see this article on ssh issues). 714 authorized keys. The security is maintained by the security of ssh 715 logins to the computers used by PanTask and pcontrol. 742 716 743 717 It is convenient to keep a continuous connection to the remote … … 768 742 \begin{figure} 769 743 \begin{center} 770 \includegraphics[scale=0.85 ]{pics/pantasks.07.ps}744 \includegraphics[scale=0.85,angle=-90]{pics/pantasks.07.ps} 771 745 \caption{\label{queues} PanTasks queues and MDDB tables} 772 746 \end{center}
Note:
See TracChangeset
for help on using the changeset viewer.
