IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 36555 for trunk


Ignore:
Timestamp:
Feb 25, 2014, 2:12:24 PM (12 years ago)
Author:
bills
Message:

updates from ipp/tags/ipp-20140114

Location:
trunk
Files:
21 edited
6 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/Ohana/src/libohana/src

  • trunk/ippScripts/scripts/dist_advancerun.pl

    r35960 r36555  
    6969my $stacktool   = can_run('stacktool') or (warn "Can't find stacktool" and $missing_tools = 1);
    7070my $bgtool = can_run('bgtool') or (warn "Can't find bgtool" and $missing_tools = 1);
     71my $fftool = can_run('fftool') or (warn "Can't find fftool" and $missing_tools = 1);
    7172my $staticskytool = can_run('staticskytool') or (warn "Can't find staticskytool" and $missing_tools = 1);
    7273if ($missing_tools) {
     
    7778
    7879my $tool_cmd;
     80my $tool_cmd2;
    7981my $list_mode;
    8082my $component_key;
     
    127129    $list_mode = "-diffskyfile";
    128130    $component_key = "skycell_id";
     131} elsif ($stage eq "ff") {
     132    $tool_cmd = "$fftool -ff_id";
     133    $list_mode = "-result";
     134    $component_key = "dist_component";
     135    $tool_cmd2 = "$fftool -summary -ff_id"
    129136} else {
    130137    &my_die("Unexpected stage: $stage", $dist_id, $PS_EXIT_CONFIG_ERROR);
     
    132139
    133140$tool_cmd .= " $stage_id";
     141$tool_cmd2 .= " $stage_id" if $tool_cmd2;
    134142
    135143my $exportarg = '-exportrun';
     
    215223    my $components = parse_md_list($metadata) or
    216224        &my_die("Unable to parse metadata list", $dist_id, $PS_EXIT_UNKNOWN_ERROR);
     225
     226    if ($tool_cmd2) {
     227        my $command = "$tool_cmd2";
     228        $command .= " -dbname $dbname" if defined $dbname;
     229
     230        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     231            run(command => $command, verbose => $verbose);
     232            unless ($success) {
     233            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     234            &my_die("Unable to perform $command: $error_code", $dist_id, $error_code);
     235        }
     236        if (@$stdout_buf == 0) {
     237            &my_die("Unable to perform $command: $error_code", $dist_id, $error_code);
     238        }
     239        my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
     240            &my_die("Unable to parse metadata config doc", $dist_id, $PS_EXIT_UNKNOWN_ERROR);
     241        my $more_components = parse_md_list($metadata) or
     242            &my_die("Unable to parse metadata list", $dist_id, $PS_EXIT_UNKNOWN_ERROR);
     243        if (scalar @$more_components) {
     244            push @$components, @$more_components;
     245        }
     246    }
    217247
    218248    open MANIFEST, ">$resolved" or
  • trunk/ippScripts/scripts/dist_bundle.pl

    r36457 r36555  
    496496    } elsif ($stage eq "stack") {
    497497        $type = $stack_cleaned{$rule};
    498     } 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') {
    499499        $type = $empty_cleaned{$rule};
    500500    } else {
     
    588588        # stack_summary stage does not use a config dump file.
    589589        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        }
    590597    } else {
    591598        &my_die("$stage is not a valid stage", $component, $PS_EXIT_CONFIG_ERROR);
     
    742749}
    743750
     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
    744768sub my_die
    745769{
  • trunk/ippScripts/scripts/ipp_apply_burntool_single.pl

  • trunk/ippScripts/scripts/publish_file.pl

  • trunk/ippTasks/staticsky.pro

    r34814 r36555  
    6464end
    6565
     66$RA_POLL_MAX = 0
     67
     68macro set.ra.max
     69    if ($0 != 2)
     70        echo "USAGE: set.ra.max (ra_max_deg)"
     71        break
     72    end
     73    $RA_POLL_MAX = $1
     74end
     75macro get.ra.max
     76    echo $RA_POLL_MAX
     77end
     78
    6679### Load tasks for staticsky
    6780### Tasks are loaded into staticskyResult.
     
    8093    if ($LABEL:n == 0) break
    8194    $run = staticskytool -todo
     95    if ($RA_POLL_MAX > 0)
     96        $run = $run -ra_max $RA_POLL_MAX
     97    end
    8298    if ($DB:n == 0)
    8399      option DEFAULT
  • trunk/ippTools/share/Makefile.am

    r36543 r36555  
    190190        disttool_definebyquery_diff.sql \
    191191        disttool_definebyquery_fake.sql \
     192        disttool_definebyquery_ff.sql \
    192193        disttool_definebyquery_raw.sql \
    193194        disttool_definebyquery_raw_no_magic.sql \
     
    207208        disttool_pending_diff.sql \
    208209        disttool_pending_fake.sql \
     210        disttool_pending_ff.sql \
    209211        disttool_pending_raw.sql \
    210212        disttool_pending_sky.sql \
     
    498500        fftool_todo.sql \
    499501        fftool_toadvance.sql \
     502        fftool_export_run.sql \
     503        fftool_export_input.sql \
     504        fftool_export_result.sql \
     505        fftool_export_summary.sql \
    500506        remotetool_definebyquery_chip.sql \
    501507        remotetool_definebyquery_cam.sql \
     
    503509        remotetool_definebyquery_stack.sql \
    504510        remotetool_updatepoll.sql
    505 
    506 
    507 
  • trunk/ippTools/share/disttool_toadvance.sql

    r35960 r36555  
    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
  • trunk/ippTools/share/fftool_result.sql

    r36441 r36555  
    11SELECT
    22    fullForceResult.*,
    3     fullForceRun.skycal_id,
     3    fullForceRun.state,
    44    fullForceRun.label,
    55    fullForceRun.data_group,
     6    fullForceRun.skycal_id,
     7    fullForceRun.workdir,
     8    CONCAT_WS('.', warp_id, skycell_id) AS dist_component,
    69    stackRun.tess_id,
    710    stackRun.skycell_id,
  • trunk/ippTools/share/fftool_summary.sql

    r36441 r36555  
    55    fullForceRun.data_group,
    66    fullForceRun.skycal_id,
     7    fullForceRun.workdir,
     8    'summary' AS dist_component,
    79    stackRun.tess_id,
    810    stackRun.skycell_id,
  • trunk/ippTools/src/disttool.c

    r36248 r36555  
    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);
  • trunk/ippTools/src/fftool.c

    r36441 r36555  
    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}
  • trunk/ippTools/src/fftool.h

    r36441 r36555  
    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
  • trunk/ippTools/src/fftoolConfig.c

    r36441 r36555  
    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)) {
  • trunk/ippTools/src/laptool.c

    r35568 r36555  
    11701170  // we only want projection cells which do not already of an entry
    11711171  psStringAppend(&query, "\nWHERE lapGroup.projection_cell IS NULL\n");
    1172   psStringAppend(&query, "\nORDER by projection_cell\n");
     1172  // Projection cell's don't have a convienient order. Queue runs in the order of lap_id
     1173  // psStringAppend(&query, "\nORDER by projection_cell\n");
     1174  psStringAppend(&query, "\nORDER by lap_id_0\n");
    11731175
    11741176  if (limit) {
     
    12891291    psFree(whereClause);
    12901292  }
     1293  psStringAppend(&query, "\nGROUP by projection_cell ORDER by MIN(lap_id)");
    12911294  if (limit) {
    12921295    psString limitString = psDBGenerateLimitSQL(limit);
  • trunk/ippconfig/recipes/ppSub.config

  • trunk/ippconfig/recipes/reductionClasses.mdc

  • trunk/psphot/src

  • trunk/psphot/src/psphotCleanup.c

    r34086 r36555  
    2222    pmVisualCleanup ();
    2323    psLibFinalize();
     24#if (PS_TRACE_ON)
     25    // don't display memory leaks unless trace is on.
    2426    // fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, NULL, false), "psphot");
    2527    fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, stdout, false), "psphot");
     28#endif
    2629    return;
    2730}
  • trunk/psphot/src/psphotStackImageLoop.c

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