]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
RFIO args added. Sergey.
authorhadaq <hadaq>
Thu, 15 Apr 2010 17:33:01 +0000 (17:33 +0000)
committerhadaq <hadaq>
Thu, 15 Apr 2010 17:33:01 +0000 (17:33 +0000)
hadaq/evtbuild.c

index 77eb73b80f98ee892dfccd201fe3f503c4a98bbc..4cbea2d6924a19517c62f6df53a5682b57b21c2e 100644 (file)
@@ -1,4 +1,4 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.100 2010-01-27 17:29:50 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.101 2010-04-15 17:33:01 hadaq Exp $";
 
 #define _POSIX_C_SOURCE 199309L
 #define SYSLOG_NAMES
@@ -99,6 +99,11 @@ typedef struct TheArgsS {
 
        char rfioRemotePath[PARAM_MAX_VALUE_LEN];
        char rfioLustrePath[PARAM_MAX_VALUE_LEN];
+       char rfio_pcOption[PARAM_MAX_VALUE_LEN];
+       unsigned short rfio_iCopyMode;
+       unsigned short rfio_iCopyFrac;
+       unsigned short rfio_iMaxFile;
+       unsigned short rfio_iPathConv;
        char lustrePath[PARAM_MAX_VALUE_LEN];
        unsigned short buffStat;
        unsigned short epicsCtrl;
@@ -189,6 +194,14 @@ static void usage(const char *progName)
 #ifdef RFIO
        syslog(LOG_ERR, "Usage: [--rfio path_to_tape_archive] example: --rfio rfiodaq:gstore:/hadaqtest/test002");
        syslog(LOG_ERR, "Usage: [--rfiolustre path] example: --rfiolustre /lustre/hades/daq");
+       syslog(LOG_ERR, "Usage: [--rfio_pcoption option] internal RFIO options (do not set anything if not sure)");
+       syslog(LOG_ERR,
+                  "Usage: [--rfio_icopymode mode]   0 : standard RFIO, ignore following arguments, 1 : copy the data to Lustre path after the file is written to a write cache (this is for the high data rates), 2 : for lustre only");
+       syslog(LOG_ERR,
+                  "Usage: [--rfio_icopyfrac frac]   0 : write only to a tape, i (>0) : copy each i-th file to lustre (pcCopyPath). If migration to a tape fails, ignore iCopyFraction and copy each file to lustre.");
+       syslog(LOG_ERR,
+                  "Usage: [--rfio_imaxfile maxnum]  0 : no file number limit, i (>0) : maximum number of files to be written to a directory");
+       syslog(LOG_ERR, "Usage: [--rfio_ipathconv conv] #  0 : default convention, 1 : HADES convention");
 #endif
        syslog(LOG_ERR, "Usage: [--buffstat] show fill levels of buffers");
        syslog(LOG_ERR, "Usage: [--epicsctrl] enable synch and distribution of RUN Id by Epics for parallel event builders");
@@ -232,12 +245,14 @@ static void argsDump(TheArgs *my)
        if (my->write_data == 1) {
                syslog(LOG_DEBUG, "sec_path: %s", my->sec_path);
        }
+#ifdef RFIO
        if (strcmp(my->rfioRemotePath, "") != 0) {
                syslog(LOG_DEBUG, "rfio path: %s", my->rfioRemotePath);
        }
        if (strcmp(my->rfioLustrePath, "") != 0) {
                syslog(LOG_DEBUG, "rfio lustre path: %s", my->rfioLustrePath);
        }
+#endif
        if (strcmp(my->lustrePath, "") != 0) {
                syslog(LOG_DEBUG, "lustre path: %s", my->lustrePath);
        }
@@ -278,6 +293,11 @@ static void argsDefault(TheArgs *my)
 
        strcpy(my->rfioRemotePath, "");
        strcpy(my->rfioLustrePath, "");
+       strcpy(my->rfio_pcOption, "wb");
+       my->rfio_iCopyMode = 0;
+       my->rfio_iCopyFrac = 0;
+       my->rfio_iMaxFile = 200;
+       my->rfio_iPathConv = 0;
        strcpy(my->lustrePath, "");
        my->buffStat = 0;
        my->epicsCtrl = 0;
@@ -308,6 +328,11 @@ static int argsFromCL(TheArgs *my, int argc, char *argv[])
                        {"help", 0, 0, 'H'},
                        {"rfio", 1, 0, 'R'},
                        {"rfiolustre", 1, 0, 'A'},
+                       {"rfio_pcoption", 1, 0, 'W'},
+                       {"rfio_icopymode", 1, 0, 'M'},
+                       {"rfio_icopyfrac", 1, 0, 'F'},
+                       {"rfio_imaxfile", 1, 0, 'X'},
+                       {"rfio_ipathconv", 1, 0, 'C'},
                        {"buffstat", 0, 0, 'b'},
                        {"epicsctrl", 0, 0, 'E'},
                        {"lustre", 1, 0, 'L'},
@@ -317,7 +342,8 @@ static int argsFromCL(TheArgs *my, int argc, char *argv[])
                        {"ignore", 0, 0, 'i'},
                        {0, 0, 0, 0}
                };
-               i = getopt_long(argc, argv, "am:f:r:o:d:q:p:v:x:I:tz:e:n:h:w:tz:e:n:Hs:l:R:A:bEL:S:B:O:i", long_options, &option_index);
+               i = getopt_long(argc, argv, "am:f:r:o:d:q:p:v:x:I:tz:e:n:h:w:tz:e:n:Hs:l:R:A:bEL:S:B:O:iW:M:F:X:C:", long_options,
+                                               &option_index);
                if (i == -1)
                        break;
                switch (i) {
@@ -384,6 +410,21 @@ static int argsFromCL(TheArgs *my, int argc, char *argv[])
                case 'A':
                        strcpy(my->rfioLustrePath, optarg);
                        break;
+               case 'W':
+                       strcpy(my->rfio_pcOption, optarg);
+                       break;
+               case 'M':
+                       my->rfio_iCopyMode = strtoul(optarg, NULL, 0);
+                       break;
+               case 'F':
+                       my->rfio_iCopyFrac = strtoul(optarg, NULL, 0);
+                       break;
+               case 'X':
+                       my->rfio_iMaxFile = strtoul(optarg, NULL, 0);
+                       break;
+               case 'C':
+                       my->rfio_iPathConv = strtoul(optarg, NULL, 0);
+                       break;
                case 'L':
                        strcpy(my->lustrePath, optarg);
                        break;
@@ -1440,7 +1481,11 @@ static int rfio_openConnection(TheArgs *theArgs)
                fprintf(stderr, "<I> evtbuild.c, rfio_fopen(): trying to open connection to Data Mover: %s\n", rfioBase);
                /* fRemote = rfio_fopen( rfioBase, "wb" ); */
 
-               fRemote = rfio_fopen_gsidaq(rfioBase, "wb", 1, theArgs->rfioLustrePath, 1, 10, 1);
+               fRemote = rfio_fopen_gsidaq(rfioBase,
+                                                                       theArgs->rfio_pcOption,
+                                                                       theArgs->rfio_iCopyMode,
+                                                                       theArgs->rfioLustrePath,
+                                                                       theArgs->rfio_iCopyFrac, theArgs->rfio_iMaxFile, theArgs->rfio_iPathConv);
 
                if (fRemote == NULL) {
                        syslog(LOG_ERR, "%s, %d: trying to open connection to Data Mover %s: %s",
@@ -1490,6 +1535,7 @@ int main(int argc, char *argv[])
        setlogmask(LOG_UPTO(LOG_INFO));
 
        argsDefault(theArgs);
+
        argsFromParam(theArgs, argc, argv);
 
        if (0 > argsFromCL(theArgs, argc, argv)) {