Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Maintenance - Mise à jour mensuelle Lundi 6 Février entre 7h00 et 9h00
Open sidebar
genotoul-bioinfo
jflow
Commits
c3240cc0
Commit
c3240cc0
authored
Nov 07, 2014
by
Jerome Mariette
Browse files
make some stuff looks better
parent
91b752da
Changes
9
Hide whitespace changes
Inline
Side-by-side
bin/jflow_cli.py
View file @
c3240cc0
...
...
@@ -142,9 +142,14 @@ if __name__ == '__main__':
else
:
workflows
=
wfmanager
.
get_workflows
()
if
len
(
workflows
)
>
0
:
workflows_by_id
,
wfids
=
{},
[]
# first sort workflow by ID
for
workflow
in
workflows
:
wfids
.
append
(
workflow
.
id
)
workflows_by_id
[
workflow
.
id
]
=
workflow
status
=
"ID
\t
NAME
\t
STATUS
\t
ELAPSED_TIME
\t
START_TIME
\t
END_TIME
\n
"
for
i
,
w
orkflow
in
enumerate
(
w
or
kflows
):
status
+=
workflow
.
get_status_under_text_format
()
for
i
,
w
fid
in
enumerate
(
s
or
ted
(
wfids
)
):
status
+=
workflow
s_by_id
[
wfid
]
.
get_status_under_text_format
()
if
i
<
len
(
workflows
)
-
1
:
status
+=
"
\n
"
else
:
status
=
"no workflow available"
print
status
bin/jflow_server.py
View file @
c3240cc0
...
...
@@ -23,7 +23,6 @@ import sys
import
datetime
from
functools
import
wraps
import
time
import
datetime
import
os
import
argparse
import
logging
...
...
src/jflow/component.py
View file @
c3240cc0
...
...
@@ -24,7 +24,7 @@ import types
from
jflow.workflows_manager
import
WorkflowsManager
from
jflow.config_reader
import
JFlowConfigReader
from
jflow.dataset
import
ArrayList
from
jflow.utils
import
which
from
jflow.utils
import
which
,
display_error_message
from
jflow.parameter
import
*
from
weaver.util
import
parse_string_list
...
...
@@ -308,13 +308,11 @@ class Component(object):
elif
exec_path
is
None
and
os
.
path
.
isfile
(
os
.
path
.
join
(
os
.
path
.
dirname
(
inspect
.
getfile
(
self
.
__class__
)),
"bin"
,
software
)):
exec_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
inspect
.
getfile
(
self
.
__class__
)),
"bin"
,
software
)
elif
exec_path
is
None
and
which
(
software
)
==
None
:
sys
.
stderr
.
write
(
"Error: '"
+
software
+
"' path connot be retrieved either in the PATH and in the application.properties file!
\n
"
)
sys
.
exit
(
1
)
display_error_message
(
"'"
+
software
+
"' path connot be retrieved either in the PATH and in the application.properties file!"
)
elif
exec_path
is
None
and
which
(
software
)
!=
None
:
exec_path
=
software
elif
exec_path
!=
None
and
not
os
.
path
.
isfile
(
exec_path
):
sys
.
stderr
.
write
(
"Error: '"
+
exec_path
+
"' set for '"
+
software
+
"' does not exists, please provide a valid path!
\n
"
)
sys
.
exit
(
1
)
display_error_message
(
"'"
+
exec_path
+
"' set for '"
+
software
+
"' does not exists, please provide a valid path!"
)
return
exec_path
def
get_nameid
(
self
):
...
...
src/jflow/config_reader.py
View file @
c3240cc0
...
...
@@ -21,7 +21,7 @@ import inspect
from
ConfigParser
import
ConfigParser
,
NoOptionError
from
jflow.utils
import
which
from
jflow.utils
import
which
,
display_error_message
class
JFlowConfigReader
(
object
):
...
...
@@ -70,8 +70,7 @@ class JFlowConfigReader(object):
exec_path
=
None
if
exec_path
is
None
:
exec_path
=
"makeflow"
if
which
(
exec_path
)
==
None
:
sys
.
stderr
.
write
(
"Error: 'makeflow' path connot be retrieved either in the PATH and in the application.properties file!
\n
"
)
sys
.
exit
(
1
)
display_error_message
(
"'makeflow' path connot be retrieved either in the PATH and in the application.properties file!"
)
return
exec_path
def
get_date_format
(
self
):
...
...
src/jflow/parameter.py
View file @
c3240cc0
...
...
@@ -30,7 +30,7 @@ import copy as _copy
from
urlparse
import
urlparse
from
jflow.config_reader
import
JFlowConfigReader
from
jflow.utils
import
get_octet_string_representation
,
get_nb_octet
from
jflow.utils
import
get_octet_string_representation
,
get_nb_octet
,
display_error_message
# import custom types and custom formats
from
workflows.types
import
*
...
...
@@ -745,11 +745,9 @@ class AbstractInputFile(AbstractIOFile):
try
:
eval
(
self
.
file_format
)(
ifile
)
except
jflow
.
InvalidFormatError
as
e
:
sys
.
stderr
.
write
(
str
(
e
)
+
"
\n
"
)
sys
.
exit
(
1
)
display_error_message
(
str
(
e
))
else
:
sys
.
stderr
.
write
(
"Error: Invalid file format '"
+
self
.
file_format
+
"'!
\n
"
)
sys
.
exit
(
1
)
display_error_message
(
"Invalid file format '"
+
self
.
file_format
+
"'!"
)
class
AbstractOutputFile
(
AbstractIOFile
):
"""
...
...
src/jflow/utils.py
View file @
c3240cc0
...
...
@@ -16,6 +16,7 @@
#
import
re
import
sys
import
smtplib
import
socket
import
math
...
...
@@ -27,6 +28,14 @@ except:
DNS
=
None
class
ServerError
(
Exception
):
pass
def
display_error_message
(
msg
):
sys
.
stderr
.
write
(
"
\033
[91mError: "
+
msg
+
"
\n\033
[0m"
)
sys
.
exit
(
1
)
def
display_info_message
(
msg
,
with_exit
=
False
):
sys
.
stderr
.
write
(
"
\033
[93mInfo: "
+
msg
+
"
\n\033
[0m"
)
if
with_exit
:
sys
.
exit
(
1
)
def
which
(
program
):
"""
Return if the asked program exist in the user path
...
...
src/jflow/workflow.py
View file @
c3240cc0
...
...
@@ -27,6 +27,7 @@ import time
import
threading
import
types
import
logging
import
datetime
from
logging
import
FileHandler
from
ConfigParser
import
ConfigParser
,
NoOptionError
...
...
@@ -323,6 +324,7 @@ class Workflow(threading.Thread):
if
self
.
start_time
and
self
.
end_time
:
elapsed_time
=
str
(
self
.
end_time
-
self
.
start_time
)
elif
self
.
start_time
:
elapsed_time
=
str
(
time
.
time
()
-
self
.
start_time
)
else
:
elapsed_time
=
"-"
elapsed_time
=
"-"
if
elapsed_time
==
"-"
else
str
(
datetime
.
timedelta
(
seconds
=
int
(
str
(
elapsed_time
).
split
(
"."
)[
0
])))
if
self
.
end_time
:
end_time
=
time
.
asctime
(
time
.
localtime
(
self
.
end_time
))
else
:
end_time
=
"-"
if
detailed
:
...
...
@@ -388,8 +390,20 @@ class Workflow(threading.Thread):
if
html
:
return
pretty_str
.
replace
(
"
\n
"
,
"<br />"
)
else
:
return
pretty_str
else
:
return
utils
.
get_nb_string
(
self
.
id
)
+
"
\t
"
+
self
.
name
+
"
\t
"
+
self
.
get_status
()
+
\
"
\t
"
+
elapsed_time
+
"
\t
"
+
start_time
+
"
\t
"
+
end_time
pretty_str
=
utils
.
get_nb_string
(
self
.
id
)
+
"
\t
"
+
self
.
name
+
"
\t
"
if
self
.
get_status
()
==
self
.
STATUS_STARTED
:
pretty_str
+=
"
\033
[94m"
elif
self
.
get_status
()
==
self
.
STATUS_COMPLETED
:
pretty_str
+=
"
\033
[92m"
elif
self
.
get_status
()
==
self
.
STATUS_FAILED
:
pretty_str
+=
"
\033
[91m"
elif
self
.
get_status
()
==
self
.
STATUS_ABORTED
:
pretty_str
+=
"
\033
[91m"
elif
self
.
get_status
()
==
self
.
STATUS_RESETED
:
pretty_str
+=
"
\033
[3m"
pretty_str
+=
self
.
get_status
()
+
"
\033
[0m"
pretty_str
+=
"
\t
"
+
elapsed_time
+
"
\t
"
+
start_time
+
"
\t
"
+
end_time
return
pretty_str
def
get_errors
(
self
):
error
=
{
...
...
@@ -523,13 +537,11 @@ class Workflow(threading.Thread):
elif
exec_path
is
None
and
os
.
path
.
isfile
(
os
.
path
.
join
(
os
.
path
.
dirname
(
inspect
.
getfile
(
self
.
__class__
)),
"bin"
,
software
)):
exec_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
inspect
.
getfile
(
self
.
__class__
)),
"bin"
,
software
)
elif
exec_path
is
None
and
utils
.
which
(
software
)
==
None
:
sys
.
stderr
.
write
(
"Error: '"
+
software
+
"' path connot be retrieved either in the PATH and in the application.properties file!
\n
"
)
sys
.
exit
(
1
)
utils
.
display_error_message
(
"'"
+
software
+
"' path connot be retrieved either in the PATH and in the application.properties file!"
)
elif
exec_path
is
None
and
utils
.
which
(
software
)
!=
None
:
exec_path
=
software
elif
exec_path
!=
None
and
not
os
.
path
.
isfile
(
exec_path
):
sys
.
stderr
.
write
(
"Error: '"
+
exec_path
+
"' set for '"
+
software
+
"' does not exists, please provide a valid path!
\n
"
)
sys
.
exit
(
1
)
utils
.
display_error_message
(
"'"
+
exec_path
+
"' set for '"
+
software
+
"' does not exists, please provide a valid path!"
)
return
exec_path
def
add_component
(
self
,
component_name
,
args
=
[],
kwargs
=
{},
component_prefix
=
"default"
):
...
...
@@ -765,8 +777,7 @@ class Workflow(threading.Thread):
cpt
.
reset
()
found
=
True
if
not
found
:
sys
.
stderr
.
write
(
"Impossible to reset component '"
+
component_name
+
"'! This one is not part of the workflow
\n
"
)
sys
.
exit
(
1
)
utils
.
display_error_message
(
"Impossible to reset component '"
+
component_name
+
"'! This one is not part of the workflow"
)
self
.
reseted_components
.
append
(
component_name
)
self
.
status
=
self
.
STATUS_RESETED
self
.
_serialize
()
...
...
src/jflow/workflows_manager.py
View file @
c3240cc0
...
...
@@ -154,8 +154,7 @@ class WorkflowsManager(object):
workflow
=
pickle
.
load
(
workflow_dump
)
workflow_dump
.
close
()
else
:
sys
.
stderr
.
write
(
"Error: Workflow with id "
+
str
(
rworkflow_id
)
+
" cannot be retrived!
\n
"
)
sys
.
exit
(
1
)
utils
.
display_error_message
(
"Workflow with id "
+
str
(
rworkflow_id
)
+
" cannot be retrived"
)
return
workflow
def
get_workflow_directory
(
self
,
wname
,
wid
):
...
...
src/js/jflow-wfform.js
View file @
c3240cc0
...
...
@@ -581,7 +581,11 @@ jQuery.validator.addMethod("mparam", function(value, element, params) {
'
{{else param.type.indexOf("inputfile") === 0}}
'
,
'
<div class="input-group">
'
,
'
<div class="input-group-btn">
'
,
'
{{if param.action == "append"}}
'
,
'
<button type="button" style="padding-top:23px; padding-bottom:22px;" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
'
,
'
{{else}}
'
,
'
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
'
,
'
{{/if}}
'
,
'
<span id="inputfile_${param.name}">server file</span>
'
,
'
<span class="caret"></span>
'
,
'
</button>
'
,
...
...
@@ -600,7 +604,11 @@ jQuery.validator.addMethod("mparam", function(value, element, params) {
'
<input id="${param.name}" name="${param.name}" class="form-control ${param.group}" type="text" value="${param.default}">
'
,
'
{{/if}}
'
,
'
<span class="input-group-btn">
'
,
'
{{if param.action == "append"}}
'
,
'
<button id="urlfile_btn_${param.name}" style="display: none; padding-top:23px; padding-bottom:22px;" class="btn btn-default" type="button"><span class="glyphicon glyphicon-folder-open"></span></button>
'
,
'
{{else}}
'
,
'
<button id="urlfile_btn_${param.name}" style="display: none;" class="btn btn-default" type="button"><span class="glyphicon glyphicon-folder-open"></span></button>
'
,
'
{{/if}}
'
,
'
</span>
'
,
'
</div>
'
,
// if param is a browsefile
...
...
Write
Preview
Supports
Markdown
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!
Cancel
Please
register
or
sign in
to comment