Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
genotoul-bioinfo
jflow
Commits
572902da
Commit
572902da
authored
May 02, 2017
by
Floreal Cabanettes
Browse files
Fix rules
parent
bda39443
Changes
2
Show whitespace changes
Inline
Side-by-side
src/jflow/rules.py
View file @
572902da
...
...
@@ -93,6 +93,7 @@ class SimpleRule (ABC):
class
LinkRule
(
SimpleRule
):
def
__init__
(
self
,
user_args
,
wf_instance
,
src_arg
,
targets_args
,
nb_rows
):
SimpleRule
.
__init__
(
self
,
user_args
,
wf_instance
,
src_arg
,
nb_rows
)
self
.
require_src
=
True
self
.
targets_args
=
targets_args
@
abstractmethod
...
...
@@ -251,8 +252,12 @@ class AtLeastOneAmong(LinkRule):
At least one parameter among the list must be set
"""
def
__init__
(
self
,
user_args
,
wf_instance
,
src_arg
,
targets_args
,
nb_rows
):
LinkRule
.
__init__
(
self
,
user_args
,
wf_instance
,
src_arg
,
targets_args
,
nb_rows
)
self
.
require_src
=
False
def
check
(
self
):
if
self
.
parameter_value
is
None
:
if
self
.
parameter_value
is
None
or
not
self
.
parameter_value
:
has_one
=
False
for
grp_param
in
self
.
targets_args
:
if
not
getattr
(
self
.
wf_instance
,
grp_param
).
is_None
:
...
...
src/jflow/workflow.py
View file @
572902da
...
...
@@ -1360,8 +1360,7 @@ class Workflow(threading.Thread):
validator
.
check
()
else
:
raise
Exception
(
"Rule is not a conditional link rule: "
+
name
)
elif
(
src_arg
in
user_args
and
user_args
[
src_arg
]
is
not
None
and
user_args
[
src_arg
])
or
\
(
isinstance
(
getattr
(
self
,
src_arg
),
MultiParameterList
)):
else
:
is_link_rule
=
re
.
match
(
link_rule
,
rule
)
# Check the second special rule
if
is_link_rule
:
# Check this special rule:
...
...
@@ -1380,12 +1379,15 @@ class Workflow(threading.Thread):
if
issubclass
(
validator_class
,
j_rules
.
LinkRule
):
# Check the rule is the same special rule
validator
=
validator_class
(
user_args
,
self
,
src_arg
,
targets
,
nb_rows
)
validator
.
check
()
elif
issubclass
(
validator_class
,
j_rules
.
ValueRule
):
validator
=
validator_class
(
user_args
,
self
,
src_arg
,
is_link_rule
.
group
(
2
),
nb_rows
)
validator
.
check
()
else
:
raise
Exception
(
"Rule is not a link rule: "
+
name
)
if
(
src_arg
in
user_args
and
user_args
[
src_arg
]
is
not
None
and
user_args
[
src_arg
])
or
\
(
isinstance
(
getattr
(
self
,
src_arg
),
MultiParameterList
))
or
(
not
validator
.
require_src
):
validator
.
check
()
else
:
# It's a simple rule
name
=
rule
...
...
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