Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ensembl-gh-mirror
ensembl-hive
Commits
61069ad7
Commit
61069ad7
authored
Apr 11, 2014
by
Leo Gordon
Browse files
Pulling in the temp_dir cleanup fix
parents
0d1278bb
6dc0d105
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
5 deletions
+21
-5
modules/Bio/EnsEMBL/Hive/Process.pm
modules/Bio/EnsEMBL/Hive/Process.pm
+21
-5
No files found.
modules/Bio/EnsEMBL/Hive/Process.pm
View file @
61069ad7
...
...
@@ -535,21 +535,37 @@ sub worker_temp_directory {
my
$self
=
shift
@_
;
unless
(
defined
(
$self
->
{'
_tmp_dir
'})
and
(
-
e
$self
->
{'
_tmp_dir
'}))
{
my
$username
=
$ENV
{'
USER
'};
my
$worker_id
=
$self
->
worker
?
$self
->
worker
->
dbID
:
'
standalone
';
$self
->
{'
_tmp_dir
'}
=
"
/tmp/worker_
${username}
.
${worker_id}
/
";
$self
->
{'
_tmp_dir
'}
=
$self
->
worker_temp_directory_name
();
mkdir
(
$self
->
{'
_tmp_dir
'},
0777
);
throw
("
unable to create a writable directory
"
.
$self
->
{'
_tmp_dir
'})
unless
(
-
w
$self
->
{'
_tmp_dir
'});
}
return
$self
->
{'
_tmp_dir
'};
}
sub
worker_temp_directory_name
{
my
$self
=
shift
@_
;
my
$username
=
$ENV
{'
USER
'};
my
$worker_id
=
$self
->
worker
?
$self
->
worker
->
dbID
:
'
standalone
';
return
"
/tmp/worker_
${username}
.
${worker_id}
/
";
}
=head2 cleanup_worker_temp_directory
Title : cleanup_worker_temp_directory
Function: Cleans up the directory on the local /tmp disk that is used for the
worker. It can be used to remove files left there by previous jobs.
Usage : $self->cleanup_worker_temp_directory;
=cut
sub
cleanup_worker_temp_directory
{
my
$self
=
shift
@_
;
if
(
$self
->
{'
_tmp_dir
'}
and
(
-
e
$self
->
{'
_tmp_dir
'})
)
{
my
$cmd
=
"
rm -r
"
.
$self
->
{'
_tmp_dir
'};
my
$tmp_dir
=
$self
->
worker_temp_directory_name
();
if
(
-
e
$tmp_dir
)
{
my
$cmd
=
"
rm -r
$tmp_dir
";
system
(
$cmd
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment