Changeset 23861
- Timestamp:
- Apr 14, 2009, 3:14:27 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 8 edited
-
ippScripts/Build.PL (modified) (1 diff)
-
ippScripts/scripts/dist_advancerun.pl (modified) (1 diff)
-
ippScripts/scripts/dist_make_fileset.pl (modified) (6 diffs)
-
ippTasks/Makefile.am (modified) (1 diff)
-
ippTasks/rcserver.pro (added)
-
ippTools/share/disttool_pendingfileset.sql (modified) (1 diff)
-
ippTools/src/disttool.c (modified) (3 diffs)
-
ippTools/src/disttool.h (modified) (1 diff)
-
ippTools/src/disttoolConfig.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/Build.PL
r23250 r23861 82 82 scripts/dist_component.pl 83 83 scripts/dist_advancerun.pl 84 scripts/dist_make_fileset.pl 84 85 )], 85 86 dist_abstract => 'Scripts for running the Pan-STARRS IPP', -
trunk/ippScripts/scripts/dist_advancerun.pl
r23777 r23861 89 89 } 90 90 91 # XXX we should create a file rule for this91 # XXX should we create a file rule for this? 92 92 my $outfile = "$outdir/dbinfo.$stage.$stage_id.mdc"; 93 93 -
trunk/ippScripts/scripts/dist_make_fileset.pl
r23838 r23861 39 39 40 40 # Parse the command-line arguments 41 my ($dist_id, $dist_dir, $target_id, $stage, $stage_id, $prod_id, $product_name, $ product_root, $ds_dbhost, $ds_dbname);41 my ($dist_id, $dist_dir, $target_id, $stage, $stage_id, $prod_id, $product_name, $ds_dbhost, $ds_dbname); 42 42 my ($dbname, $save_temps, $verbose, $no_update, $logfile); 43 43 … … 50 50 'prod_id=s' => \$prod_id, # id for the product 51 51 'product_name=s' => \$product_name, # location of the data store directory for this product 52 'product_root=s' => \$product_root, # location of the data store directory for this product53 52 'ds_dbhost=s' => \$ds_dbhost, # database host for the datastore database 54 53 'ds_dbname=s' => \$ds_dbname, # database name for the datastore database … … 61 60 62 61 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 63 pod2usage( -msg => "Required options: --dist_id --dist_dir --target_id --stage --stage_id --prod_id -- product_root --ds_dbhost --ds_dbname",62 pod2usage( -msg => "Required options: --dist_id --dist_dir --target_id --stage --stage_id --prod_id --ds_dbhost --ds_dbname", 64 63 -exitval => 3) unless 65 64 defined $dist_id and … … 70 69 defined $prod_id and 71 70 defined $product_name and 72 defined $product_root and73 71 defined $ds_dbhost and 74 72 defined $ds_dbname; … … 156 154 157 155 # XXX: disttool -addrcdsfileset 158 159 # XXX todo: add rcRun's for the destinations 156 { 157 my $command = "$disttool -addfileset -dist_id $dist_id -prod_id $prod_id -name $fileset_name"; 158 $command .= " -dbname $dbname" if $dbname; 159 160 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 161 run(command => $command, verbose => $verbose); 162 unless ($success) { 163 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 164 &my_die("Unable to perform $command error_code: $error_code", $dist_id, $prod_id, $error_code); 165 } 166 } 167 160 168 161 169 … … 239 247 print STDERR "$msg\n"; 240 248 249 my $command = "$disttool -addfileset -dist_id $dist_id -prod_id $prod_id -fault $fault"; 250 $command .= " -dbname $dbname" if $dbname; 251 252 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 253 run(command => $command, verbose => $verbose); 254 unless ($success) { 255 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 256 print STDERR "Unable to perform $command error_code: $error_code\n"; 257 } 241 258 exit $fault; 242 259 } -
trunk/ippTasks/Makefile.am
r23480 r23861 21 21 replicate.pro \ 22 22 dist.pro \ 23 rcserver.pro \ 23 24 pstamp.pro 24 25 -
trunk/ippTools/share/disttool_pendingfileset.sql
r23842 r23861 5 5 stage_id, 6 6 CONCAT_WS('.', distRun.outroot, CONVERT(distRun.dist_id, CHAR)) as dist_dir, 7 rcDSProduct.* 7 rcDSProduct.name AS product_name, 8 rcDSProduct.prod_id, 9 rcDSProduct.dbname AS ds_dbname, 10 rcDSProduct.dbhost AS ds_dbhost 8 11 FROM rcDestination 9 12 JOIN rcInterest USING(dest_id) -
trunk/ippTools/src/disttool.c
r23842 r23861 41 41 static bool pendingfilesetMode(pxConfig *config); 42 42 static bool addfilesetMode(pxConfig *config); 43 static bool pendingdatastoresMode(pxConfig *config); 43 44 44 45 # define MODECASE(caseName, func) \ … … 71 72 MODECASE(DISTTOOL_MODE_PENDINGFILESET, pendingfilesetMode); 72 73 MODECASE(DISTTOOL_MODE_ADDFILESET, addfilesetMode); 74 MODECASE(DISTTOOL_MODE_PENDINGDATASTORES, pendingdatastoresMode); 73 75 default: 74 76 psAbort("invalid option (this should not happen)"); … … 893 895 } 894 896 897 static bool pendingdatastoresMode(pxConfig *config) 898 { 899 PS_ASSERT_PTR_NON_NULL(config, false); 900 #ifdef notyet 901 902 psMetadata *where = psMetadataAlloc(); 903 PXOPT_COPY_S64(config->args, where, "-dist_id", "dist_id", "=="); 904 PXOPT_COPY_STR(config->args, where, "-label", "label", "=="); 905 906 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 907 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 908 909 // look for "inputs" that need to processed 910 psString query = pxDataGet("disttool_pendingfileset.sql"); 911 if (!query) { 912 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 913 return false; 914 } 915 916 if (psListLength(where->list)) { 917 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 918 psStringAppend(&query, " AND %s", whereClause); 919 psFree(whereClause); 920 } 921 psFree(where); 922 923 // treat limit == 0 as "no limit" 924 if (limit) { 925 psString limitString = psDBGenerateLimitSQL(limit); 926 psStringAppend(&query, " %s", limitString); 927 psFree(limitString); 928 } 929 930 if (!p_psDBRunQuery(config->dbh, query)) { 931 psError(PS_ERR_UNKNOWN, false, "database error"); 932 psFree(query); 933 return false; 934 } 935 psFree(query); 936 937 psArray *output = p_psDBFetchResult(config->dbh); 938 if (!output) { 939 psErrorCode err = psErrorCodeLast(); 940 switch (err) { 941 case PS_ERR_DB_CLIENT: 942 psError(PXTOOLS_ERR_SYS, false, "database error"); 943 case PS_ERR_DB_SERVER: 944 psError(PXTOOLS_ERR_PROG, false, "database error"); 945 default: 946 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 947 } 948 949 return false; 950 } 951 if (!psArrayLength(output)) { 952 psTrace("disttool", PS_LOG_INFO, "no rows found"); 953 psFree(output); 954 return true; 955 } 956 957 if (psArrayLength(output)) { 958 // negative simple so the default is true 959 if (!ippdbPrintMetadatas(stdout, output, "pendingfileset", !simple)) { 960 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 961 psFree(output); 962 return false; 963 } 964 } 965 966 psFree(output); 967 # endif // notdef 968 return true; 969 } -
trunk/ippTools/src/disttool.h
r23842 r23861 35 35 DISTTOOL_MODE_PENDINGFILESET, 36 36 DISTTOOL_MODE_ADDFILESET, 37 DISTTOOL_MODE_PENDINGDATASTORES, 37 38 } disttoolMode; 38 39 -
trunk/ippTools/src/disttoolConfig.c
r23842 r23861 138 138 psMetadataAddStr(addfilesetArgs, PS_LIST_TAIL, "-name", 0, "define file name", NULL); 139 139 psMetadataAddS32(addfilesetArgs, PS_LIST_TAIL, "-fault", 0, "define fault code", 0); 140 // 141 // -pendingfileset 142 psMetadata *pendingdatastoresArgs = psMetadataAlloc(); 143 psMetadataAddS64(pendingdatastoresArgs, PS_LIST_TAIL, "-dist_id", 0, "define dist_id", 0); 144 psMetadataAddStr(pendingdatastoresArgs, PS_LIST_TAIL, "-label", 0, "limit results to label", NULL); 145 psMetadataAddStr(pendingdatastoresArgs, PS_LIST_TAIL, "-stage", 0, "limit results to runs for stage", NULL); 146 psMetadataAddU64(pendingdatastoresArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 147 psMetadataAddBool(pendingdatastoresArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 148 140 149 psMetadata *argSets = psMetadataAlloc(); 141 150 psMetadata *modes = psMetadataAlloc(); … … 151 160 PXOPT_ADD_MODE("-pendingfileset", "", DISTTOOL_MODE_PENDINGFILESET, pendingfilesetArgs); 152 161 PXOPT_ADD_MODE("-addfileset", "", DISTTOOL_MODE_ADDFILESET, addfilesetArgs); 162 PXOPT_ADD_MODE("-pendingdatastores", "", DISTTOOL_MODE_PENDINGDATASTORES, pendingdatastoresArgs); 153 163 154 164 if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) {
Note:
See TracChangeset
for help on using the changeset viewer.
