Commit a97afa4c authored by Matthieu Muffato's avatar Matthieu Muffato
Browse files

Moved the creation of the log_dir to Worker

parent 35ec0b67
......@@ -159,18 +159,7 @@ sub create_new_worker {
$worker = $self->fetch_by_dbID( $worker_id ) # refresh the object to get the fields initialized at SQL level (timestamps in this case)
or die "Could not fetch worker with dbID=$worker_id";
if($hive_log_dir or $worker_log_dir) {
my $dir_revhash = dir_revhash($worker_id);
$worker_log_dir ||= $hive_log_dir .'/'. ($dir_revhash ? "$dir_revhash/" : '') .'worker_id_'.$worker_id;
eval {
make_path( $worker_log_dir );
1;
} or die "Could not create '$worker_log_dir' directory : $@";
$worker->log_dir( $worker_log_dir );
$self->update_log_dir( $worker ); # autoloaded
}
$worker->set_log_directory_name($hive_log_dir, $worker_log_dir);
$worker->init;
......
......@@ -864,4 +864,22 @@ sub check_analysis_for_exclusion {
}
}
sub set_log_directory_name {
my ($self, $hive_log_dir, $worker_log_dir);
return unless ($hive_log_dir or $worker_log_dir);
my $dir_revhash = dir_revhash($self->dbID);
$worker_log_dir ||= $hive_log_dir .'/'. ($dir_revhash ? "$dir_revhash/" : '') .'worker_id_'.$self->dbID;
eval {
make_path( $worker_log_dir );
1;
} or die "Could not create '$worker_log_dir' directory : $@";
$self->log_dir( $worker_log_dir );
$self->adaptor->update_log_dir( $self ); # autoloaded
}
1;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment