Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
biopet.biopet
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirrors
biopet.biopet
Commits
e74cdf5b
Commit
e74cdf5b
authored
9 years ago
by
Peter van 't Hof
Browse files
Options
Downloads
Patches
Plain Diff
Improved error handeling on executable check
parent
894af898
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
public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/BiopetCommandLineFunction.scala
+27
-26
27 additions, 26 deletions
.../nl/lumc/sasc/biopet/core/BiopetCommandLineFunction.scala
with
27 additions
and
26 deletions
public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/BiopetCommandLineFunction.scala
+
27
−
26
View file @
e74cdf5b
...
...
@@ -99,37 +99,38 @@ trait BiopetCommandLineFunction extends CommandLineResources { biopetFunction =>
*/
protected
[
core
]
def
preProcessExecutable
()
{
if
(!
BiopetCommandLineFunction
.
executableMd5Cache
.
contains
(
executable
))
{
try
if
(
executable
!=
null
)
{
if
(
executable
!=
null
)
{
if
(!
BiopetCommandLineFunction
.
executableCache
.
contains
(
executable
))
{
val
oldExecutable
=
executable
val
buffer
=
new
StringBuffer
()
val
cmd
=
Seq
(
"which"
,
executable
)
val
process
=
Process
(
cmd
).
run
(
ProcessLogger
(
buffer
.
append
(
_
)))
if
(
process
.
exitValue
==
0
)
{
executable
=
buffer
.
toString
val
file
=
new
File
(
executable
)
if
(
executableToCanonicalPath
)
executable
=
file
.
getCanonicalPath
else
executable
=
file
.
getAbsolutePath
}
else
{
Logging
.
addError
(
"executable: '"
+
executable
+
"' not found, please check config"
)
try
{
val
oldExecutable
=
executable
val
buffer
=
new
StringBuffer
()
val
cmd
=
Seq
(
"which"
,
executable
)
val
process
=
Process
(
cmd
).
run
(
ProcessLogger
(
buffer
.
append
(
_
)))
if
(
process
.
exitValue
==
0
)
{
executable
=
buffer
.
toString
val
file
=
new
File
(
executable
)
if
(
executableToCanonicalPath
)
executable
=
file
.
getCanonicalPath
else
executable
=
file
.
getAbsolutePath
}
else
Logging
.
addError
(
"executable: '"
+
executable
+
"' not found, please check config"
)
BiopetCommandLineFunction
.
executableCache
+=
oldExecutable
->
executable
BiopetCommandLineFunction
.
executableCache
+=
executable
->
executable
}
catch
{
case
ioe
:
java.io.IOException
=>
logger
.
warn
(
s
"Could not use 'which' on '$executable', check on executable skipped: "
+
ioe
)
}
BiopetCommandLineFunction
.
executableCache
+=
oldExecutable
->
executable
BiopetCommandLineFunction
.
executableCache
+=
executable
->
executable
}
else
{
executable
=
BiopetCommandLineFunction
.
executableCache
(
executable
)
}
}
else
executable
=
BiopetCommandLineFunction
.
executableCache
(
executable
)
if
(!
BiopetCommandLineFunction
.
executableMd5Cache
.
contains
(
executable
))
{
val
is
=
new
FileInputStream
(
executable
)
val
cnt
=
is
.
available
val
bytes
=
Array
.
ofDim
[
Byte
](
cnt
)
is
.
read
(
bytes
)
is
.
close
()
val
temp
=
MessageDigest
.
getInstance
(
"MD5"
).
digest
(
bytes
).
map
(
"%02X"
.
format
(
_
)).
mkString
.
toLowerCase
BiopetCommandLineFunction
.
executableMd5Cache
+=
executable
->
temp
if
(
new
File
(
executable
).
exists
())
{
val
is
=
new
FileInputStream
(
executable
)
val
cnt
=
is
.
available
val
bytes
=
Array
.
ofDim
[
Byte
](
cnt
)
is
.
read
(
bytes
)
is
.
close
()
val
temp
=
MessageDigest
.
getInstance
(
"MD5"
).
digest
(
bytes
).
map
(
"%02X"
.
format
(
_
)).
mkString
.
toLowerCase
BiopetCommandLineFunction
.
executableMd5Cache
+=
executable
->
temp
}
else
BiopetCommandLineFunction
.
executableMd5Cache
+=
executable
->
"file_does_not_exist"
}
}
catch
{
case
ioe
:
java.io.IOException
=>
logger
.
warn
(
"Could not use 'which', check on executable skipped: "
+
ioe
)
}
}
val
md5
=
BiopetCommandLineFunction
.
executableMd5Cache
.
get
(
executable
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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