IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changes between Initial Version and Version 1 of Pantasks_server_mode


Ignore:
Timestamp:
Feb 24, 2009, 4:23:57 PM (17 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Pantasks_server_mode

    v1 v1  
     1The pantasks "server" mode allows to pantasks to run using a server/client interface.  This is especially handy if you want to be able to control pantasks from multiple locations (e.g., check processing from home) or accounts (e.g., multiple people controlling or eavesdropping on the processing).
     2
     3There is a small convenience issue when running pantasks in the "server" mode: some commands which you would usually run in a standalone pantasks are only available when wrapped inside a macro; see below.
     4
     5
     6=== Configuration ===
     7
     8Ensure the following is in your <code>~/.ptolemyrc</code> file:
     9<pre>
     10PANTASKS_SERVER         XXXXX.ifa.hawaii.edu
     11PASSWORD                XXXXX
     12#PANTASKS_SERVER_STDOUT  pantasks.stdout.log
     13#PANTASKS_SERVER_STDERR  pantasks.stderr.log
     14</pre>
     15
     16 * <code>PANTASKS_SERVER</code> defines the name of the server for the client to connect to.  There's no real need to update this, since we'll use a script to set this on the fly, allowing multiple pantasks servers to be used simultaneously.
     17 * <code>PASSWORD</code> provides minimal access control for the pantasks server.  Set this to a unique word.
     18 * <code>PANTASKS_SERVER_STDOUT</code> and <code>PANTASKS_SERVER_STDERR</code> define where the output goes that is usually displayed in the pantasks session.  Since setting these also affects the standalone version of pantasks, I recommend leaving them commented out; we'll use a script to set them on the fly.
     19
     20
     21If you are using Nebulous, you will also need to set up an ipphosts.config file.  This config file has METADATA cards that assign a particular host to each chip on the camera, so that nebulous can distribute every  exposure consistently, without piling too many chips onto the same machine.  There is also a metadata card for indicating which hosts are to be used for skycell processing.  Here is an example of how this config file should look:
     22
     23<pre>
     24ipphosts MULTI
     25
     26ipphosts METADATA
     27  camera STR skycell
     28  count S32  8
     29  sky00 STR  ipp006
     30  sky01 STR  ipp007
     31  sky02 STR  ipp008
     32  sky03 STR  ipp009
     33  sky04 STR  ipp010
     34  sky05 STR  ipp011
     35  sky06 STR  ipp020
     36  sky07 STR  ipp021
     37END
     38
     39ipphosts METADATA
     40  camera STR GPC1
     41
     42  XY01  STR  ipp014
     43  XY02  STR  ipp014
     44  XY03  STR  ipp014
     45  XY04  STR  ipp014
     46
     47  XY05  STR  ipp023
     48  XY06  STR  ipp023
     49  XY10  STR  ipp023
     50  XY11  STR  ipp023
     51
     52  XY12  STR  ipp024
     53  XY13  STR  ipp024
     54
     55  < etc. ...  >
     56
     57  XY75  STR  ipp015
     58  XY76  STR  ipp015
     59END
     60</pre>
     61
     62
     63
     64=== Helpful scripts ===
     65
     66Here are some convenient scripts for starting the pantasks server and client.
     67
     68 * Save the following script as '''start_pantasks_server''' in some directory on your path
     69<pre>
     70#!/bin/bash
     71# Start up a pantasks server
     72# Output is redirected to files
     73                                                                               
     74server_redirect="-D PANTASKS_SERVER_STDOUT pantasks.stdout.log -D PANTASKS_SERVER_STDERR pantasks.stderr.log"
     75                                                                               
     76echo pantasks_server $server_redirect
     77pantasks_server $server_redirect
     78</pre>
     79
     80 * Save this one as '''start_pantasks_client''' on your path
     81
     82<pre>
     83#!/bin/bash
     84# start up pantasks_client
     85# 1st argument is the name of the host to connect to
     86                                                                               
     87server_arg=""
     88server_host=$1
     89                                                                               
     90if [ $server_host ]; then
     91   server_arg="-D PANTASKS_SERVER $server_host"
     92   echo pantasks_client $server_arg
     93   pantasks_client $server_arg
     94else
     95   echo "Please provide the hostname of the pantasks server."
     96fi
     97</pre>
     98
     99
     100=== Starting pantasks ===
     101
     102Starting the server is as easy as:
     103<pre>
     104% start_pantasks_server
     105bound to port: 2000
     106</pre>
     107You can start it in the background if you want: it's not going to print anything more to the terminal.
     108
     109In a different window (or machine or user), start the client:
     110<pre>
     111% start_pantasks_client mymachine
     112</pre>
     113where <code>mymachine</code> is the name of the machine on which the server is running.
     114
     115You should be presented with the usual pantasks environment.  However, some things are subtly different: the environment you see before you is particular to the client, not the server, and it's the server that runs everything.  This is important to keep in mind, and it means that you should bury within macros some commands that you would ordinarily just type on the pantasks command-line.
     116
     117=== Setting up ===
     118
     119Here are some useful definitions for controlling pantasks using the server mode:
     120 * Save this as server.pro in your pantasks modules directory
     121
     122<pre>
     123macro setup
     124    $LABEL = "my_label"
     125    $DBNAME = "mydatabase"
     126    module pantasks.pro
     127    module.tasks
     128    all.off
     129         # NEXT LINES ARE ONLY NEEDED IF USING NEBULOUS
     130    $default_host = machine1
     131    queueload tmp -x "cat ipphosts.config"
     132    ipptool2book tmp ipphosts -key camera
     133         # END NEBULOUS ONLY
     134    add.database $DBNAME
     135    echo Using database $DBNAME
     136    echo Current active label is $LABEL
     137end
     138 
     139macro change_label
     140    $LABEL = $1
     141    echo Current active label is $LABEL
     142end
     143 
     144macro print_label
     145    echo Current active label is $LABEL
     146end
     147
     148macro machines
     149    controller host add machine1 -threads $1
     150    controller host add machine2 -threads $1
     151    controller host add machine3 -threads $1
     152    controller host add machine4 -threads $1
     153end
     154</pre>
     155
     156 * If you're not using Nebulous, you can remove the lines that are specific to Nebulous use (these send jobs to particular machines).
     157 * Ensure the <code>my_label</code> is changed to the label of the data you're processing (or <code>"NONE"</code> including quotes if none).
     158 * Ensure the <code>my_database</code> is changed to the database you're using.
     159 * Ensure the <code>machineN</code> are changed according to your system.
     160
     161So, now in the pantasks client, you can say:
     162<pre>
     163pantasks: server input server.pro
     164</pre>
     165to load the macro file.  Note that the server has to do this command, hence the prefix <code>server</code>.
     166
     167Here is how you would set up for processing, and add hosts with a maximum of 4 threads each:
     168<pre>
     169pantasks: setup
     170pantasks: machines 4
     171</pre>
     172
     173Now you should be able to simply say:
     174<pre>
     175pantasks: run
     176</pre>
     177and pantasks will run as usual.  The <code>status</code>, <code>stop</code> and <code>halt</code> commands are also available as usual (no need to prepend <code>server</code> or anything like that).  But if you want to change the label, then you should do:
     178<pre>
     179pantasks: change_label "new_label"
     180</pre>
     181whereas in the standalone pantasks, you could have done:
     182<pre>
     183pantasks: $LABEL = "new_label"
     184</pre>
     185Such commands now have to be buried within macros.
     186
     187=== Shutdown ===
     188
     189You can quit out of the client at any time by saying:
     190<pre>
     191pantasks: quit
     192</pre>
     193
     194This does not stop the server from continuing to process.  You can reconnect to the server as you please.
     195
     196When you're all done, you can force the server to quit by issuing the following command from the client:
     197<pre>
     198pantasks: shutdown now
     199</pre>