Changeset 28141 for trunk/ippScripts/scripts/lossy_compress_imfile.pl
- Timestamp:
- May 27, 2010, 11:22:52 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/lossy_compress_imfile.pl
r27718 r28141 61 61 defined $state; 62 62 63 my $ipprc = PS::IPP::Config->new() or my_die( "Unable to set up", $exp_id, $exp_name, $class_id, $uri, $ PS_EXIT_CONFIG_ERROR );63 my $ipprc = PS::IPP::Config->new() or my_die( "Unable to set up", $exp_id, $exp_name, $class_id, $uri, $state, $PS_EXIT_CONFIG_ERROR ); 64 64 if (defined($logfile)) { 65 $ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $exp_id, $exp_name, $class_id, $uri, $ PS_EXIT_SYS_ERROR );65 $ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $exp_id, $exp_name, $class_id, $uri, $state, $PS_EXIT_SYS_ERROR ); 66 66 } 67 67 … … 87 87 if ($state eq 'goto_compressed') { 88 88 # Find the actual filename for this run: 89 &my_die("Couldn't find input file: $uri\n", $exp_id,$exp_name,$class_id,$uri,$ PS_EXIT_SYS_ERROR)89 &my_die("Couldn't find input file: $uri\n", $exp_id,$exp_name,$class_id,$uri,$state,$PS_EXIT_SYS_ERROR) 90 90 unless ($ipprc->file_exists($uri)); 91 91 my $uriReal = $ipprc->file_resolve( $uri ); … … 93 93 # Create a compressed version: 94 94 my $compUri = $uri . ".fz"; 95 &my_die("Output compressed file already exists: $compUri\n", $exp_id,$exp_name,$class_id,$uri,$ PS_EXIT_SYS_ERROR)95 &my_die("Output compressed file already exists: $compUri\n", $exp_id,$exp_name,$class_id,$uri,$state,$PS_EXIT_SYS_ERROR) 96 96 if ($ipprc->file_exists($compUri)); 97 97 my $compReal= $ipprc->file_resolve( $compUri, 'create'); … … 109 109 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 110 110 &my_die("Unable to uncompress file: $uri -> $compUri: $error_code", 111 $exp_id,$exp_name,$class_id,$uri, $ PS_EXIT_SYS_ERROR);111 $exp_id,$exp_name,$class_id,$uri, $state, $PS_EXIT_SYS_ERROR); 112 112 } 113 113 my $compress_command = "$fpack -h -s 8 -S $tempReal > $compReal"; … … 118 118 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 119 119 &my_die("Unable to compress file: $uri -> $compUri: $error_code", 120 $exp_id,$exp_name,$class_id,$uri, $ PS_EXIT_SYS_ERROR);120 $exp_id,$exp_name,$class_id,$uri, $state, $PS_EXIT_SYS_ERROR); 121 121 } 122 122 my $database_command = "$regtool -updateprocessedimfile -exp_id $exp_id -class_id $class_id -set_state compressed"; 123 123 $database_command .= " -dbname $dbname" if defined $dbname; 124 124 125 &my_die("Expected output compressed file not found: $compUri\n", $exp_id,$exp_name,$class_id, $uri,$ PS_EXIT_SYS_ERROR)125 &my_die("Expected output compressed file not found: $compUri\n", $exp_id,$exp_name,$class_id, $uri,$state, $PS_EXIT_SYS_ERROR) 126 126 unless ($ipprc->file_exists($compUri)); 127 127 … … 135 135 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 136 136 &my_die("Unable to update database file: $uri -> $compUri: $error_code", 137 $exp_id,$exp_name,$class_id,$uri, $ PS_EXIT_SYS_ERROR);137 $exp_id,$exp_name,$class_id,$uri, $state, $PS_EXIT_SYS_ERROR); 138 138 } 139 139 } … … 149 149 if ($state eq 'goto_lossy') { 150 150 # Confirm we have both files 151 &my_die("Couldn't find original file: $uri\n", $exp_id,$exp_name,$class_id,$uri,$ PS_EXIT_SYS_ERROR)151 &my_die("Couldn't find original file: $uri\n", $exp_id,$exp_name,$class_id,$uri,$state,$PS_EXIT_SYS_ERROR) 152 152 unless($ipprc->file_exists($uri)); 153 153 my $uriReal = $ipprc->file_resolve( $uri ); … … 156 156 unless($ipprc->file_exists($compUri)) { 157 157 &my_die("Couldn't find compressed version of the file: $compUri\n", 158 $exp_id,$exp_name,$class_id,$uri,$ PS_EXIT_SYS_ERROR);158 $exp_id,$exp_name,$class_id,$uri,$state,$PS_EXIT_SYS_ERROR); 159 159 160 160 # If that die is removed, this will compress things as well. … … 185 185 $neb->swap($uri,$compUri) or 186 186 &my_die("Nebulous swap failed between $uri and $compUri", 187 $exp_id,$exp_name,$class_id,$uri,$ PS_EXIT_SYS_ERROR);187 $exp_id,$exp_name,$class_id,$uri,$state,$PS_EXIT_SYS_ERROR); 188 188 } 189 189 # Update database … … 204 204 $neb->swap($uri,$compUri) or 205 205 &my_die("DB update failed and Nebulous swap-back failed between $uri and $compUri", 206 $exp_id,$exp_name,$class_id,$uri,$ PS_EXIT_SYS_ERROR);206 $exp_id,$exp_name,$class_id,$uri,$state,$PS_EXIT_SYS_ERROR); 207 207 &my_die("Unable to update database file: $uri -> $compUri: $error_code", 208 $exp_id,$exp_name,$class_id,$uri, $ PS_EXIT_SYS_ERROR);208 $exp_id,$exp_name,$class_id,$uri, $state,$PS_EXIT_SYS_ERROR); 209 209 } 210 210 # remove original version … … 224 224 my $class_id = shift; # Class identifier 225 225 my $uri = shift; # uri for the file 226 my $state = shift; 226 227 my $exit_code = shift; # Exit code 227 228 # outputImage and path_base are globals 229 my $fail_state = $state; 230 $fail_state =~ s/goto_/error_/; 231 my $error_command = "$regtool -updateprocessedimfile -exp_id $exp_id -class_id $class_id -set_state $fail_state "; 232 $error_command .= " -dbname $dbname" if defined $dbname; 233 my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) = 234 run(command => $error_command, verbose => $verbose); 235 unless($success) { 236 warn("Failed at setting the error state too."); 237 } 228 238 229 239 $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code;
Note:
See TracChangeset
for help on using the changeset viewer.
