Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ensembl
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
ensembl
Commits
0af8360e
Commit
0af8360e
authored
12 years ago
by
Dan Sheppard
Browse files
Options
Downloads
Patches
Plain Diff
Flock-style locking for log files. Needed to automate parts of the Vega
pipeline and run them on the LSF.
parent
f2c4ce31
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/Bio/EnsEMBL/Utils/ConversionSupport.pm
+25
-0
25 additions, 0 deletions
modules/Bio/EnsEMBL/Utils/ConversionSupport.pm
with
25 additions
and
0 deletions
modules/Bio/EnsEMBL/Utils/ConversionSupport.pm
+
25
−
0
View file @
0af8360e
...
...
@@ -64,6 +64,7 @@ use POSIX qw(strftime);
use
Cwd
qw(abs_path)
;
use
DBI
;
use
Data::
Dumper
;
use
Fcntl
qw(:flock SEEK_END)
;
my
$species_c
=
1
;
#counter to be used for each database connection made
...
...
@@ -1191,6 +1192,30 @@ sub log {
return
(
1
);
}
=head2 lock_log
Description : Use flock-style locks to lock log and fastforward to end.
Useful if log is being written to by multiple processes.
=cut
sub
lock_log
{
my
(
$self
)
=
@_
;
flock
(
$self
->
{'
_log_filehandle
'},
LOCK_EX
)
||
die
"
Cannot lock log
";
seek
(
$self
->
{'
_log_filehandle
'},
0
,
SEEK_END
)
||
die
"
Cannot seek log
";
}
=head2 unlock_log
Description : Unlock log previously locked by lock_log.
=cut
sub
unlock_log
{
my
(
$self
)
=
@_
;
# flush is implicit in flock
flock
(
$self
->
{'
_log_filehandle
'},
LOCK_UN
)
||
die
"
Cannot unlock log
";
}
=head2 log_warning
Arg[1] : String $txt - the warning text to log
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment