IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 36546


Ignore:
Timestamp:
Feb 25, 2014, 11:25:44 AM (12 years ago)
Author:
bills
Message:

Changes to support distribution of full force data and some
property updates from previous merges with the trunk

Location:
tags/ipp-20140114
Files:
6 added
12 edited

Legend:

Unmodified
Added
Removed
  • tags/ipp-20140114/ippScripts/scripts/dist_bundle.pl

    r36223 r36546  
    5050                     'PPSUB.INVERSE.MASK' => 'inv_mask',
    5151                     'PPSUB.INVERSE.VARIANCE' => 'inv_variance' );
    52 my %stack_cleaned = ( 'PPSTACK.OUTPUT' => 'image',
     52
     53my %stack_cleaned = ( 'PPSTACK.UNCONV' => 'image',
     54                      'PPSTACK.UNCONV.MASK' => 'mask',
     55                      'PPSTACK.UNCONV.VARIANCE' => 'variance',
     56                      'PPSTACK.UNCONV.EXP' => 'exp',
     57                      'PPSTACK.UNCONV.EXPNUM' => 'expnum',
     58                      'PPSTACK.UNCONV.EXPWT' => 'expwt'
     59                      );
     60
     61my %stack_convolved = ( 'PPSTACK.OUTPUT' => 'image',
    5362                      'PPSTACK.OUTPUT.MASK' => 'mask',
    54                       'PPSTACK.OUTPUT.VARIANCE' => 'variance' );
     63                      'PPSTACK.OUTPUT.VARIANCE' => 'variance',
     64                      'PPSTACK.OUTPUT.EXP' => 'exp',
     65                      'PPSTACK.OUTPUT.EXPNUM' => 'expnum',
     66                      'PPSTACK.OUTPUT.EXPWT' => 'expwt'
     67                      );
    5568my %empty_cleaned = ();
     69
    5670
    5771
     
    136150if (($stage ne 'raw') and ($stage ne 'fake') and ($stage ne 'stack_summary') and !$poor_quality) {
    137151    # If the file list is empty it is an error because we should at least get a config dump file
    138     # except for fake stage which doesn't do anything yet
     152    # except for fake stage which doesn't do anything yet, stack_summary stage, and of course raw files have
     153    # no config dump because they aren't processed
    139154    &my_die("empty file list", $component, $PS_EXIT_CONFIG_ERROR) if (!scalar @$file_list);
    140155}
     
    165180    my $image_type = get_image_type($stage, $file_rule);
    166181
     182    # skip useless empty trace files
     183    next if ($file_rule =~ /TRACE/);
     184
    167185    # if this is an image and we are building a clean bundle or if quality is bad skip this rule
    168186    next if $image_type and ($clean or $poor_quality);
     187
     188    if ($stage eq 'stack') {
     189        # skip convolved stacks since they are deleted just after they are created now
     190        next if $stack_convolved{$file_rule};
     191    }
    169192
    170193    # if magic is required, don't ship jpegs or binned fits images
     
    180203
    181204    my $file_name = $file->{name};
    182     my $base = basename($file_name);
    183205    my $path = $ipprc->file_resolve($file_name);
     206
     207    if (!$path and $file_rule =~ /LOG/) {
     208        my $compressed_file_name = $file_name . '.bz2';
     209        my $compressed_path = $ipprc->file_resolve($compressed_file_name);
     210        if ($compressed_path) {
     211            $path = $compressed_path;
     212            $file_name = $compressed_file_name;
     213        }
     214    }
     215
    184216
    185217    if (!$path) {
     
    194226        # XXX: perhaps only do this for stages where we know that this happens
    195227        next if $file_rule =~ /STATS/;
    196         # don't fail on these "non-essential files"
     228        # don't fail if these "non-essential files" are missing
     229        next if $file_rule =~ /LOG/;
    197230        next if $file_rule =~ /TRACE/;
    198         next if $file_rule =~ /LOG/;
    199231        next if $file_rule =~ /BIN/;
    200232
     
    236268        # create a symbolic link from the file in the nebulous repository
    237269        # in the temporary directory
    238         symlink $path, "$tmpdir/$base";
     270        symlink $path, "$tmpdir/" . basename($file_name);
    239271    }
    240272}
     
    464496    } elsif ($stage eq "stack") {
    465497        $type = $stack_cleaned{$rule};
    466     } elsif ($stage eq "sky" or $stage eq 'skycal' or $stage eq 'stack_summary') {
     498    } elsif ($stage eq "sky" or $stage eq 'skycal' or $stage eq 'stack_summary' or $stage eq 'ff') {
    467499        $type = $empty_cleaned{$rule};
    468500    } else {
     
    556588        # stack_summary stage does not use a config dump file.
    557589        return build_stack_summary_file_list($path_base, \@file_list);
     590    } elsif ($stage eq "ff") {
     591        if ($component eq 'summary') {
     592            # full force summary does not use a config dump file. Cobble together a file list
     593            return build_ff_summary_file_list($path_base, \@file_list);
     594        } else {
     595            $config_file_rule = "PSPHOT.SKY.CONFIG";
     596        }
    558597    } else {
    559598        &my_die("$stage is not a valid stage", $component, $PS_EXIT_CONFIG_ERROR);
     
    710749}
    711750
     751# psphotFullForceSummary does not produce a config dump file cobble together a file list
     752sub build_ff_summary_file_list {
     753    my ($path_base, $file_list) = @_;
     754
     755    my %cmf ;
     756    $cmf{file_rule} = "SOURCES";
     757    $cmf{name} = "$path_base.cmf";
     758    push @$file_list, \%cmf;
     759
     760    my %log;
     761    $log{file_rule} = "LOG";
     762    $log{name} = "$path_base.log";
     763    push @$file_list, \%log;
     764
     765    return $file_list;
     766}
     767
    712768sub my_die
    713769{
  • tags/ipp-20140114/ippScripts/scripts/ipp_apply_burntool_single.pl

  • tags/ipp-20140114/ippScripts/scripts/publish_file.pl

  • tags/ipp-20140114/ippScripts/scripts/queuestaticsky.pl

    r35329 r36546  
    3333};
    3434
     35# don't update the database if we are pretending
     36$no_update = 1 if $pretend;
    3537
    3638my $missing_tools;
     
    113115        }
    114116    }
     117    last if $pretend;   # only do the first (full) set if we are in pretend mode
    115118}
    116119{
  • tags/ipp-20140114/ippTools/share/Makefile.am

    r36441 r36546  
    189189        disttool_definebyquery_diff.sql \
    190190        disttool_definebyquery_fake.sql \
     191        disttool_definebyquery_ff.sql \
    191192        disttool_definebyquery_raw.sql \
    192193        disttool_definebyquery_raw_no_magic.sql \
     
    206207        disttool_pending_diff.sql \
    207208        disttool_pending_fake.sql \
     209        disttool_pending_ff.sql \
    208210        disttool_pending_raw.sql \
    209211        disttool_pending_sky.sql \
     
    496498        fftool_summary.sql \
    497499        fftool_todo.sql \
    498         fftool_toadvance.sql
     500        fftool_toadvance.sql \
     501        fftool_export_run.sql \
     502        fftool_export_input.sql \
     503        fftool_export_result.sql \
     504        fftool_export_summary.sql
    499505
     506
  • tags/ipp-20140114/ippTools/share/disttool_toadvance.sql

    r35960 r36546  
    308308        COUNT(diffSkyfile.skycell_id) = COUNT(distComponent.component)
    309309        AND SUM(distComponent.fault) = 0
     310UNION
     311-- ff stage
     312SELECT
     313    distRun.dist_id,
     314    stage,
     315    stage_id,
     316    outroot,
     317    distRun.label,
     318    clean
     319    -- ,COUNT(warp_id)
     320    -- ,COUNT(ff_id)
     321    FROM distRun
     322    JOIN fullForceRun ON stage_id = ff_id
     323    JOIN fullForceResult USING(ff_id)
     324    JOIN skycalRun USING(skycal_id)
     325    JOIN stackRun USING(stack_id)
     326    LEFT JOIN distComponent
     327        ON distRun.dist_id = distComponent.dist_id
     328        AND distComponent.component = CONCAT_WS('.', warp_id, stackRun.skycell_id)
     329    WHERE
     330        distRun.state = 'new'
     331        AND distRun.fault = 0
     332        AND distRun.stage = 'ff'
     333    GROUP BY
     334        distRun.dist_id,
     335        ff_id
     336    HAVING
     337        -- number of dist components is the number of warps plus 1 (for the summary component)
     338        COUNT(fullForceResult.ff_id) = COUNT(distComponent.component)
     339        AND SUM(distComponent.fault) = 0
    310340) as Foo
  • tags/ipp-20140114/ippTools/src/disttool.c

    r36248 r36546  
    413413
    414414      magic = false;
     415    } else if (!strcmp(stage, "ff")) {
     416      runJoinStr = "fullForceRun.ff_id";
     417      query = pxDataGet("disttool_definebyquery_ff.sql");
     418      if (!query) {
     419        psError(PXTOOLS_ERR_SYS, false, "failed to retrieve SQL statement");
     420        psFree(where);
     421        return(false);
     422      }
     423
     424      if (label) {
     425        psStringAppend(&query, " AND (fullForceRun.label = '%s') ", label);
     426      }
     427      if (dist_group) {
     428        psStringAppend(&query, " AND (fullForceRun.dist_group = '%s') ", dist_group);
     429      }
     430
     431      magic = false;
    415432    } else {
    416433        psError(PS_ERR_UNKNOWN, true, "unknown value for stage: %s", stage);
  • tags/ipp-20140114/ippTools/src/fftool.c

    r36441 r36546  
    4444static bool updatesummaryMode(pxConfig *config);
    4545static bool summaryMode(pxConfig *config);
     46static bool exportrunMode(pxConfig *config);
     47static bool importrunMode(pxConfig *config);
     48static bool summaryMode(pxConfig *config);
    4649
    4750static bool setfullForceRunState(pxConfig *config, psS64 sky_id, const char *state);
     
    7780        MODECASE(FFTOOL_MODE_UPDATESUMMARY,     updatesummaryMode);
    7881        MODECASE(FFTOOL_MODE_SUMMARY,           summaryMode);
     82        MODECASE(FFTOOL_MODE_EXPORTRUN,         exportrunMode);
     83        MODECASE(FFTOOL_MODE_IMPORTRUN,         importrunMode);
    7984        default:
    8085            psAbort("invalid option (this should not happen)");
     
    134139
    135140    psMetadata *warpWhereMD = psMetadataAlloc();
    136     pxAddLabelSearchArgs(config, warpWhereMD, "-select_warp_label",     "warpRun.label",           "LIKE");
    137     pxAddLabelSearchArgs(config, warpWhereMD, "-select_warp_data_group","warpRun.data_group",      "LIKE");
    138     PXOPT_COPY_S64(config->args, warpWhereMD, "-select_warp_id",        "warpRun.warp_id",         "==");
     141    pxAddLabelSearchArgs(config, warpWhereMD, "-select_warp_label",     "fullForceRun.label",           "LIKE");
     142    pxAddLabelSearchArgs(config, warpWhereMD, "-select_warp_data_group","fullForceRun.data_group",      "LIKE");
     143    PXOPT_COPY_S64(config->args, warpWhereMD, "-select_warp_id",        "fullForceRun.warp_id",         "==");
    139144    if (!psListLength(warpWhereMD->list)) {
    140145        psError(PXTOOLS_ERR_CONFIG, false, "warp search parameters are required");
     
    150155    }
    151156
    152     PXOPT_COPY_STR(config->args, warpWhereMD, "-select_tess_id",       "warpRun.tess_id",         "==");
    153     pxAddLabelSearchArgs(config, warpWhereMD, "-select_filter",        "warpRun.filter",          "LIKE");
     157    PXOPT_COPY_STR(config->args, warpWhereMD, "-select_tess_id",       "fullForceRun.tess_id",         "==");
     158    pxAddLabelSearchArgs(config, warpWhereMD, "-select_filter",        "fullForceRun.filter",          "LIKE");
    154159    if (!pxskycellAddWhere(config, warpWhereMD)) {
    155160        psError(PXTOOLS_ERR_CONFIG, false, "failed to add skycell search arguments");
     
    504509    PXOPT_COPY_STR(config->args, where, "-tess_id",    "stackRun.tess_id", "LIKE");
    505510    PXOPT_COPY_STR(config->args, where, "-skycell_id", "stackRun.skycell_id", "LIKE");
     511    PXOPT_COPY_STR(config->args, where, "-filter",      "stackRun.filter", "LIKE");
    506512    PXOPT_COPY_S16(config->args, where, "-fault",      "staticskyResult.fault", "==");
    507513    pxskycellAddWhere(config, where);
     
    864870    PXOPT_COPY_STR(config->args, where, "-tess_id",    "stackRun.tess_id", "LIKE");
    865871    PXOPT_COPY_STR(config->args, where, "-skycell_id", "stackRun.skycell_id", "LIKE");
     872    PXOPT_COPY_STR(config->args, where, "-filter",     "stackRun.filter", "LIKE");
    866873    PXOPT_COPY_S16(config->args, where, "-fault",      "staticskyResult.fault", "==");
    867874    pxskycellAddWhere(config, where);
     
    933940    return true;
    934941}
     942
     943bool exportrunMode(pxConfig *config)
     944{
     945  typedef struct ExportTable {
     946    char tableName[80];
     947    char sqlFilename[80];
     948  } ExportTable;
     949
     950    PS_ASSERT_PTR_NON_NULL(config, NULL);
     951
     952    // PXOPT_LOOKUP_S64(det_id,  config->args, "-warp_id", true,  false);
     953    PXOPT_LOOKUP_STR(outfile, config->args, "-outfile", true,  false);
     954    PXOPT_LOOKUP_U64(limit,   config->args, "-limit",   false, false);
     955//    PXOPT_LOOKUP_BOOL(clean,  config->args, "-clean", false);
     956
     957    FILE *f = fopen (outfile, "w");
     958    if (f == NULL) {
     959        psError(PS_ERR_UNKNOWN, false, "failed to open output file");
     960        return false;
     961    }
     962
     963    if (!pxExportVersion(config, f)) {
     964        psError(PS_ERR_UNKNOWN, false, "failed to write dbversion output file");
     965        return false;
     966    }
     967    psMetadata *where = psMetadataAlloc();
     968    PXOPT_COPY_S64(config->args, where, "-ff_id", "ff_id", "==");
     969
     970    ExportTable tables [] = {
     971      {"fullForceRun", "fftool_export_run.sql"},
     972      {"fullForceInput", "fftool_export_input.sql"},
     973      {"fullForceResult", "fftool_export_result.sql"},
     974      {"fullForceSummary", "fftool_export_summary.sql"},
     975    };
     976
     977    int numTables = sizeof(tables)/sizeof(tables[0]);
     978
     979    for (int i=0; i < numTables; i++) {
     980      psString query = pxDataGet(tables[i].sqlFilename);
     981      if (!query) {
     982          psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
     983          return false;
     984      }
     985
     986      if (where && psListLength(where->list)) {
     987          psString whereClause = psDBGenerateWhereSQL(where, NULL);
     988          psStringAppend(&query, " %s", whereClause);
     989          psFree(whereClause);
     990      }
     991
     992      // treat limit == 0 as "no limit"
     993      if (limit) {
     994        psString limitString = psDBGenerateLimitSQL(limit);
     995        psStringAppend(&query, " %s", limitString);
     996        psFree(limitString);
     997      }
     998
     999      if (!p_psDBRunQuery(config->dbh, query)) {
     1000        psError(PS_ERR_UNKNOWN, false, "database error");
     1001        psFree(query);
     1002        return false;
     1003      }
     1004      psFree(query);
     1005
     1006      psArray *output = p_psDBFetchResult(config->dbh);
     1007      if (!output) {
     1008          psError(PS_ERR_UNKNOWN, false, "database error");
     1009          return false;
     1010      }
     1011      if (!psArrayLength(output)) {
     1012        psError(PS_ERR_UNKNOWN, true, "no rows found");
     1013        psFree(output);
     1014        return false;
     1015      }
     1016
     1017      // we must write the export table in non-simple (true) format
     1018      if (!ippdbPrintMetadatas(f, output, tables[i].tableName, true)) {
     1019        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     1020        psFree(output);
     1021        return false;
     1022      }
     1023      psFree(output);
     1024    }
     1025
     1026    fclose (f);
     1027
     1028    return true;
     1029}
     1030
     1031bool importrunMode(pxConfig *config)
     1032{
     1033  unsigned int nFail;
     1034
     1035  int numImportTables = 3;
     1036
     1037  char tables[3] [80] = {"fullForceInput", "fullForceResult", "fullForceSummary"};
     1038
     1039  PS_ASSERT_PTR_NON_NULL(config, NULL);
     1040
     1041  PXOPT_LOOKUP_STR(infile, config->args, "-infile", true,  false);
     1042
     1043  psMetadata *input = psMetadataConfigRead (NULL, &nFail, infile, false);
     1044
     1045#ifdef notdef
     1046  fprintf (stderr, "---- input ----\n");
     1047  psMetadataPrint (stderr, input, 1);
     1048#endif
     1049
     1050  if (!pxCheckImportVersion(config, input)) {
     1051      psError(PS_ERR_UNKNOWN, false, "pxCheckImportVersion failed");
     1052      return false;
     1053  }
     1054
     1055  psMetadataItem *item = psMetadataLookup (input, "fullForceRun");
     1056  psAssert (item, "entry not in input?");
     1057  psAssert (item->type == PS_DATA_METADATA_MULTI, "entry not multi?");
     1058
     1059  psMetadataItem *entry = psListGet (item->data.list, 0);
     1060  assert (entry);
     1061  assert (entry->type == PS_DATA_METADATA);
     1062  fullForceRunRow *fullForceRun = fullForceRunObjectFromMetadata (entry->data.md);
     1063  fullForceRunInsertObject (config->dbh, fullForceRun);
     1064
     1065  // fprintf (stdout, "---- warp run ----\n");
     1066  // psMetadataPrint (stderr, entry->data.md, 1);
     1067
     1068  for (int i = 0; i < numImportTables; i++) {
     1069    item = psMetadataLookup (input, tables[i]);
     1070    psAssert (item, "entry not in input?");
     1071    psAssert (item->type == PS_DATA_METADATA_MULTI, "entry not multi?");
     1072
     1073    switch (i) {
     1074      case 0:
     1075        for (int i = 0; i < item->data.list->n; i++) {
     1076          entry = psListGet (item->data.list, i);
     1077          assert (entry);
     1078          assert (entry->type == PS_DATA_METADATA);
     1079          fullForceInputRow *fullForceInput = fullForceInputObjectFromMetadata (entry->data.md);
     1080          fullForceInputInsertObject (config->dbh, fullForceInput);
     1081
     1082          // fprintf (stdout, "---- row %d ----\n", i);
     1083          // psMetadataPrint (stderr, entry->data.md, 1);
     1084        }
     1085        break;
     1086
     1087      case 1:
     1088        for (int i = 0; i < item->data.list->n; i++) {
     1089          entry = psListGet (item->data.list, i);
     1090          assert (entry);
     1091          assert (entry->type == PS_DATA_METADATA);
     1092          fullForceResultRow *fullForceResult = fullForceResultObjectFromMetadata (entry->data.md);
     1093          fullForceResultInsertObject (config->dbh, fullForceResult);
     1094
     1095          // fprintf (stdout, "---- row %d ----\n", i);
     1096          // psMetadataPrint (stderr, entry->data.md, 1);
     1097        }
     1098        break;
     1099
     1100      case 2:
     1101        for (int i = 0; i < item->data.list->n; i++) {
     1102          entry = psListGet (item->data.list, i);
     1103          assert (entry);
     1104          assert (entry->type == PS_DATA_METADATA);
     1105          fullForceSummaryRow *fullForceSummary = fullForceSummaryObjectFromMetadata (entry->data.md);
     1106          fullForceSummaryInsertObject (config->dbh, fullForceSummary);
     1107
     1108          // fprintf (stdout, "---- row %d ----\n", i);
     1109          // psMetadataPrint (stderr, entry->data.md, 1);
     1110        }
     1111        break;
     1112    }
     1113  }
     1114  return true;
     1115}
  • tags/ipp-20140114/ippTools/src/fftool.h

    r36441 r36546  
    3636    FFTOOL_MODE_REVERTSUMMARY,
    3737    FFTOOL_MODE_UPDATESUMMARY,
    38     FFTOOL_MODE_SUMMARY
     38    FFTOOL_MODE_SUMMARY,
     39    FFTOOL_MODE_EXPORTRUN,
     40    FFTOOL_MODE_IMPORTRUN,
    3941} fftoolMode;
    4042
  • tags/ipp-20140114/ippTools/src/fftoolConfig.c

    r36441 r36546  
    186186    pxskycellAddArguments(revertsummaryArgs);
    187187
     188    // -exportrun
     189    psMetadata *exportrunArgs = psMetadataAlloc();
     190    psMetadataAddS64(exportrunArgs, PS_LIST_TAIL, "-ff_id", 0,          "export this full force ID (required)", 0);
     191    psMetadataAddStr(exportrunArgs, PS_LIST_TAIL, "-outfile", 0,          "export to this file (required)", NULL);
     192    psMetadataAddU64(exportrunArgs, PS_LIST_TAIL, "-limit",   0,          "limit result set to N items", 0);
     193//    psMetadataAddBool(exportrunArgs, PS_LIST_TAIL, "-clean",  0,          "export run in cleaned state", false);
     194
     195    // -importrun
     196    psMetadata *importrunArgs = psMetadataAlloc();
     197    psMetadataAddStr(importrunArgs, PS_LIST_TAIL, "-infile",  0,          "import from this file (required)", NULL);
     198
     199
     200
    188201    psFree(now);
    189202
     
    203216    PXOPT_ADD_MODE("-revertsummary", "revert faulted summary", FFTOOL_MODE_REVERTSUMMARY,  revertsummaryArgs);
    204217    PXOPT_ADD_MODE("-summary",       "list summary results", FFTOOL_MODE_SUMMARY,  summaryArgs);
     218    PXOPT_ADD_MODE("-exportrun",     "list summary results", FFTOOL_MODE_EXPORTRUN,  exportrunArgs);
     219    PXOPT_ADD_MODE("-importrun",     "list summary results", FFTOOL_MODE_IMPORTRUN,  importrunArgs);
    205220
    206221    if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) {
  • tags/ipp-20140114/ippconfig/recipes/ppSub.config

  • tags/ipp-20140114/ippconfig/recipes/reductionClasses.mdc

Note: See TracChangeset for help on using the changeset viewer.