bioperl / bioperl-live-redmine

Legacy tickets migrated from the OBF Redmine issue tracker: http://redmine.open-bio.org
0 stars 0 forks source link

Bio::DB::Taxonomy::flatfile.pm - temporary files at /var/tmp/DBD* #153

Open cjfields opened 9 years ago

cjfields commented 9 years ago

Author Name: Steffen Schmidt (Steffen Schmidt) Original Redmine Issue: 3459, https://redmine.open-bio.org/issues/3459 Original Date: 2014-02-20


Hey,

we realized that Bio::DB::Taxonomy creates temporary files at /var/tmp/DBD*

Any suggestions how to fix this?

Problems

What I came up with is the following.

use File::Temp qw/tempfile/; my $c = new DB_FILE:RECNOINFO; my ($tmpfh, $tmpfile) = tempfile(“DBDXXXXX”, UNLINK=>1); $c->{’bfname’} = $tmpfile; my $nh = tie (@nodes, ‘DB_FILE’, ‘filename’, O_RDWR|O_CREAT, 0644, $c) || die;

Still, a sigtrap would be needed…

cjfields commented 9 years ago

Original Redmine Comment Author Name: Jason Stajich Original Date: 2014-02-23T05:44:02Z


There are several ways to override this at the object level and also the defaults above this.

The index directory is defined by the default variable: $Bio::Root::IO::TEMPDIR which is typically /tmp so I am not sure why you are having it set to /var/tmp

The default is set in the code: $DEFAULT_INDEX_DIR = $Bio::Root::IO::TEMPDIR; # /tmp

You also can override it on creation with the

-directory 
option.

 my $obj = Bio::DB::Taxonomy::flatfile->new( -directory => '/tmp/);

can also override it once the object is created too $self->index_directory(‘/tmp’);

cjfields commented 9 years ago

Original Redmine Comment Author Name: Steffen Schmidt Original Date: 2014-02-23T06:45:36Z


Sure, but I am not talking about the index directory.

Have a look while you create a tied hash as in the code of flatfile.pm:

And this becomes a big problem if

cjfields commented 9 years ago

Original Redmine Comment Author Name: Steffen Schmidt Original Date: 2014-05-02T09:32:04Z


… another possibility would be to get rid of ties to arrays and replace them with ties to hashes…