Changeset 32852 for branches/eam_branches/ipp-20111122/pstamp/scripts
- Timestamp:
- Dec 2, 2011, 11:45:13 AM (15 years ago)
- Location:
- branches/eam_branches/ipp-20111122/pstamp/scripts
- Files:
-
- 5 edited
-
pstamp_checkdependent.pl (modified) (1 diff)
-
pstamp_cleanup.pl (modified) (2 diffs)
-
pstamp_get_image_job.pl (modified) (7 diffs)
-
pstamp_job_run.pl (modified) (2 diffs)
-
pstamp_parser_run.pl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111122/pstamp/scripts/pstamp_checkdependent.pl
r32364 r32852 255 255 # caller will fault the jobs 256 256 return $error_code; 257 } elsif ($chip->{dsRun_state} eq 'failed_revert') {257 } elsif ($chip->{dsRun_state} =~ /failed_revert/) { 258 258 # XXX: revert failures are rarely fixed. give up but say it's just not available not GONE 259 259 print "magicDSRun.state = $dsRun_state for chipRun $stage_id is in state failed_revert cannot update\n"; -
branches/eam_branches/ipp-20111122/pstamp/scripts/pstamp_cleanup.pl
r27874 r32852 23 23 24 24 use PS::IPP::Config qw( :standard ); 25 use PS::IPP::PStamp::Job qw( :standard ); 25 26 26 27 my $req_id; … … 95 96 } 96 97 98 { 99 my $command = "$pstamptool -listfile -req_id $req_id"; 100 $command .= " -dbname $dbname" if $dbname; 101 $command .= " -dbserver $dbserver" if $dbserver; 102 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 103 run(command => $command, verbose => $verbose); 104 unless ($success) { 105 die("Unable to perform $command error code: $error_code"); 106 } 107 my $output = join "", @$stdout_buf; 108 if ($output) { 109 my $files = parse_md_fast($mdcParser, $output); 110 foreach my $file (@$files) { 111 $ipprc->file_delete($file->{path}); 112 } 113 } 114 } 115 97 116 # now go find the workdir for this request 98 117 # XXX: we finally *have* to store this in the database -
branches/eam_branches/ipp-20111122/pstamp/scripts/pstamp_get_image_job.pl
r30663 r32852 25 25 26 26 my $output_base; 27 my $bundleroot; 27 28 28 29 my $verbose; 29 my $i pprc;30 my $imagedbname; 30 31 my $dbname; 31 32 my $dbserver; … … 41 42 'rownum=s' => \$rownum, 42 43 'output_base=s' => \$output_base, 44 'bundleroot=s' => \$bundleroot, 45 'imagedbname=s' => \$imagedbname, 43 46 'dbname=s' => \$dbname, 44 47 'dbserver=s' => \$dbserver, … … 52 55 53 56 my_die( $err, $PS_EXIT_PROG_ERROR) if $err; 57 58 my $ipprc = PS::IPP::Config->new(); 54 59 55 60 my $params_file = $output_base . ".mdc"; … … 91 96 my $missing_tools; 92 97 my $dist_bundle = can_run('dist_bundle.pl') or (warn "Can't find dist_bundle.pl" and $missing_tools = 1); 98 my $pstamptool = can_run('pstamptool') or (warn "Can't find pstamptool" and $missing_tools = 1); 93 99 if ($missing_tools) { 94 100 warn("Can't find required tools."); … … 96 102 } 97 103 104 $pstamptool .= " -dbname $dbname" if $dbname; 105 $pstamptool .= " -dbserver $dbserver" if $dbserver; 106 98 107 my $outdir = dirname($output_base); 99 108 my $basename = basename($path_base); 100 my $outroot = $output_base ."_" . $basename;101 109 my $results_file = $output_base . ".bundle_results"; 110 my $outroot; 111 if ($bundleroot) { 112 my (undef, undef, undef, $mday, $month, $year) = gmtime(time()); 113 $month += 1; 114 $year += 1900; 115 116 # This will generate an outroot like: 117 # neb://any/pstamp/bundles/2011/11/22/14026916_1_1_o5739g0358o.353654.wrp.215092.skycell.2083.025 118 119 $outroot = $bundleroot . sprintf("/%4d/%02d/%02d/${job_id}_", $year, $month, $mday) . basename($output_base) . "_". $basename; 120 } else { 121 $outroot = $output_base ."_" . $basename; 122 } 102 123 103 124 { … … 105 126 $command .= " --results_file $results_file"; 106 127 $command .= " --component $component --path_base $path_base --outroot $outroot"; 107 # XXX: we need to do some work if we want to support muggle bundles108 # $command .= " --no_magic if $no_magic";128 # XXX: we need to do some work if we want to support muggle bundles 129 # $command .= " --no_magic if $no_magic"; 109 130 $command .= " --magicked" if $magicked; 110 $command .= " --dbname $ dbname" if $dbname;131 $command .= " --dbname $imagedbname" if $imagedbname; 111 132 $command .= " --verbose" if $verbose; 112 133 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 147 168 } 148 169 170 if ($bundleroot) { 171 { 172 # delete any existing pstampFile in case this job has faulted and 173 # been reverted 174 my $command = "$pstamptool -deletefile -job_id $job_id"; 175 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 176 run(command => $command, verbose => $verbose); 177 unless ($success) { 178 my_die("Unable to perform $command: $error_code", $error_code >> 8); 179 } 180 } 181 my $linkname = "$outdir/$file_name"; 182 if (-l $linkname or -e $linkname) { 183 unlink $linkname or my_die("Failed to unlink existing symlink: $linkname", $PS_EXIT_UNKNOWN_ERROR); 184 } 185 my $bundle_name = dirname($outroot) . "/$file_name"; 186 my $resolved = $ipprc->file_resolve($bundle_name); 187 if (!$resolved) { 188 my_die("failed to resolve $bundle_name", $PS_EXIT_UNKNOWN_ERROR); 189 } 190 symlink $resolved, $linkname or my_die("failed to create symlink to $resolved in $outdir", 191 $PS_EXIT_UNKNOWN_ERROR); 192 193 my $command = "$pstamptool -addfile -job_id $job_id -path $bundle_name"; 194 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 195 run(command => $command, verbose => $verbose); 196 unless ($success) { 197 my_die("Unable to perform $command: $error_code", $error_code >> 8); 198 } 199 } 200 201 149 202 print REGLIST "$file_name|$bytes|$md5sum|tgz|\n"; 150 203 -
branches/eam_branches/ipp-20111122/pstamp/scripts/pstamp_job_run.pl
r31508 r32852 88 88 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 89 89 90 my $params = read_params_file($outputBase); 91 90 92 my $jobStatus; 91 93 if ($jobType eq "stamp") { 92 my $params = read_params_file($outputBase);93 94 94 95 my $argString; … … 272 273 } elsif ($jobType eq "get_image") { 273 274 274 my $uri = ""; 275 my $pstamp_bundle_root = metadataLookupStr($ipprc->{_siteConfig}, "PSTAMP_BUNDLE_ROOT"); 276 my $imagedb = $params->{imagedb}; 277 275 278 my $command = "$pstamp_get_image_job --job_id $job_id --output_base $outputBase --rownum $rownum"; 279 $command .= " --bundleroot $pstamp_bundle_root" if $pstamp_bundle_root; 280 $command .= " --imagedb $imagedb" if $imagedb; 276 281 $command .= " --dbname $dbname" if $dbname; 277 282 $command .= " --dbserver $dbserver" if $dbserver; -
branches/eam_branches/ipp-20111122/pstamp/scripts/pstamp_parser_run.pl
r30317 r32852 89 89 # outdir is where all of the files generated for this request are placed 90 90 # NOTE: this location needs to be kept in sync with the web interface ( request.php ) 91 my $datestr = strftime "%Y %m%d", gmtime;91 my $datestr = strftime "%Y/%m/%d", gmtime; 92 92 my $datedir = "$pstamp_workdir/$datestr"; 93 93 if (! -e $datedir ) { 94 mkdir $datedir or my_die( "failed to create working directory $datedir for request id $req_id", $req_id, 95 $PS_EXIT_CONFIG_ERROR); 94 my $rc = system "mkdir -p $datedir"; 95 if ($rc) { 96 my $status = $rc >> 8; 97 $status = $PS_EXIT_CONFIG_ERROR if !$status; 98 my_die( "failed to create working directory $datedir for request id $req_id", $req_id, 99 $status); 100 } 96 101 } 97 102
Note:
See TracChangeset
for help on using the changeset viewer.
