Changeset 73
- Timestamp:
- 11/30/05 01:49:31 (19 years ago)
- Location:
- trunk/soft/ObsData
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/soft/ObsData/ObsData/Repository.pm
- Property cvs2svn:cvs-rev changed from 1.17 to 1.18
r70 r73 112 112 #} 113 113 114 # TODO Define return code for this function, storing result somewhere to 115 # pass to child. 114 116 sub file_need_parse { 115 117 my ($self) = @_; … … 119 121 if ($self->{status}->SectionExists($self->{archivefile})) { 120 122 $self->loging(0, "File %s found in status, checking...", $self->{archivefile}); 121 my ($mtimeok, $sizeok ) = (0, 0);123 my ($mtimeok, $sizeok, $conftimeok) = (0, 0, 0); 122 124 my $olddatatype = $self->{status}->val($self->{archivefile}, 'datatype'); 123 125 my $oldmtime = $self->{status}->val($self->{archivefile}, 'mtime'); 124 126 my $oldsize = $self->{status}->val($self->{archivefile}, 'size'); 127 my $oldconftime = $self->{status}->val($self->{archivefile}, 'configtime'); 125 128 if ($oldmtime) { 126 129 if ($oldmtime == $filestats[9]) { … … 143 146 } 144 147 } 148 149 # Comparing time of the conf with time of conf during last process 150 # if config has changed, maybe something better will happend 151 my $configtime = (stat($self->{obsdata}->{config}->GetFileName))[9]; 152 if (defined($oldconftime) && $configtime <= $oldconftime) { 153 $conftimeok = 1; 154 } 145 155 146 156 #if ($olddatatype) { … … 152 162 ($mtimeok ? "" : sprintf(" mtime %d => %d", $oldmtime, $filestats[9])), 153 163 ); 154 } 155 # $self->loging(0, "%s has been allready processed: was %s", $file, $olddatatype); 164 } elsif (!$conftimeok) { 165 $self->loging(0, "config has changed since last process: %d vs %d, retrying it", 166 $oldconftime, 167 $configtime 168 ); 169 return 1; 170 } 156 171 return 0; 157 172 } else { … … 174 189 $self->loging(0, "%s is new files", $self->{archivefile}); 175 190 $self->{status}->AddSection($self->{archivefile}); 176 $self->{status}->newval($self->{archivefile}, 'mtime', $filestats[9]); 177 $self->{status}->newval($self->{archivefile}, 'size', $filestats[7]); 191 $self->update_status; 178 192 return 1; 179 193 } 194 } 195 196 sub update_status { 197 my ($self) = @_; 198 my @filestats = stat("$self->{dir}/$self->{archivefile}"); 199 200 $self->{status}->newval($self->{archivefile}, 'mtime', $filestats[9]); 201 $self->{status}->newval($self->{archivefile}, 'size', $filestats[7]); 202 203 my $configtime = (stat($self->{obsdata}->{config}->GetFileName))[9]; 204 $self->{status}->newval($self->{archivefile}, 'configtime', $configtime); 180 205 } 181 206 … … 194 219 return; 195 220 }; 196 221 222 $self->update_status; 197 223 foreach my $datafile ($self->{Oarchive}->ls) { 198 224 $self->loging(0, "archive %s: content %s", $self->{archivefile}, $datafile); … … 225 251 #} 226 252 227 sub dispatch { 228 my ($self) = @_; 229 253 # TODO Define return code for this function, storing result somewhere to 254 # pass to child. 255 sub data_need_parse { 256 my ($self) = @_; 230 257 my $last_process = $self->{status}->val($self->{archivefile}, "data_processtime_$self->{datafile}"); 231 258 if ($last_process) { … … 237 264 return; 238 265 } 266 return 1; 267 } 268 269 sub dispatch { 270 my ($self) = @_; 271 272 $self->data_need_parse or return; 239 273 240 274 my ($datatype, $destfile) = $self->{obsdata}->build_dest_filename( -
trunk/soft/ObsData/bin/obsdata
- Property cvs2svn:cvs-rev changed from 1.5 to 1.6
r71 r73 14 14 'logfile=s' => \my $log, 15 15 'i|init' => \my $init, 16 'debug' => \my $debug,16 'debug' => sub { $verbose = 0 }, 17 17 'v' => sub { $verbose-- }, 18 18 ); … … 21 21 $configfile, 22 22 logfile => $log, 23 verbose => $debug ? 0 : undef,23 verbose => 0, 24 24 logcallback => sub { 25 25 return if($_[0] < $verbose);
Note: See TracChangeset
for help on using the changeset viewer.