Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libworkflows
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Blaise LI
libworkflows
Commits
e7c9e8fd
Commit
e7c9e8fd
authored
10 months ago
by
Blaise Li
Browse files
Options
Downloads
Patches
Plain Diff
Changed module list generation.
parent
e215bb81
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
libworkflows/__init__.py
+2
-2
2 additions, 2 deletions
libworkflows/__init__.py
libworkflows/libworkflows.py
+14
-14
14 additions, 14 deletions
libworkflows/libworkflows.py
with
16 additions
and
16 deletions
libworkflows/__init__.py
+
2
−
2
View file @
e7c9e8fd
__copyright__
=
"
Copyright (C) 2020 Blaise Li
"
__licence__
=
"
GNU GPLv3
"
__version__
=
0.
5
__version__
=
0.
6
from
.libworkflows
import
(
SHELL_FUNCTIONS
,
cleanup_and_backup
,
column_converter
,
ensure_relative
,
envmod
,
ensure_relative
,
envmod
s
,
file_len
,
feature_orientation2stranded
,
filter_combinator
,
get_chrom_sizes
,
last_lines
,
make_id_list_getter
,
partial_format
,
...
...
This diff is collapsed.
Click to expand it.
libworkflows/libworkflows.py
+
14
−
14
View file @
e7c9e8fd
...
...
@@ -23,6 +23,7 @@ from shutil import rmtree
import
warnings
from
collections.abc
import
Mapping
from
contextlib
import
contextmanager
from
itertools
import
chain
from
subprocess
import
Popen
,
PIPE
from
re
import
compile
as
rcompile
,
sub
from
textwrap
import
indent
...
...
@@ -218,12 +219,12 @@ def run_with_modules(
return
(
real_cmd
,
generic_shell_commands
)
def
envmod
(
def
envmod
s
(
mod_name
,
module_versions
,
dependency
=
None
):
"""
Generate
the
string representing the module to be loaded.
Generate
a list of
string representing the module
s
to be loaded.
*mod_name* will be used as a key in the *module_versions*
dictionary in order to get the associated version number.
...
...
@@ -233,9 +234,13 @@ def envmod(
for module *mod_name* (including *mod_name* itself) where
*dependency* will be found as a key.
"""
if
isinstance
(
module_versions
[
mod_name
],
Mapping
):
return
list
(
chain
.
from_iterable
(
envmods
(
mod_name
,
module_versions
,
dependency
=
dependency
)
for
dependency
in
module_versions
[
mod_name
]))
if
dependency
is
None
:
return
f
"
{
mod_name
}
/
{
module_versions
[
mod_name
]
}
"
return
f
"
{
dependency
}
/
{
module_versions
[
mod_name
][
dependency
]
}
"
return
[
f
"
{
mod_name
}
/
{
module_versions
[
mod_name
]
}
"
]
return
[
f
"
{
dependency
}
/
{
module_versions
[
mod_name
][
dependency
]
}
"
]
def
run_and_write_methods
(
...
...
@@ -265,17 +270,12 @@ def run_and_write_methods(
try
:
# Only one module, whose dependencies
# are assumed to be defined as a sub-dictionary of module_versions
[
main_module
]
=
params
.
modules
if
isinstance
(
module_versions
[
main_module
],
Mapping
):
modules
=
[
envmod
(
main_module
,
module_versions
,
dependency
=
module
)
for
module
in
module_versions
[
main_module
]]
else
:
modules
=
[
envmod
(
main_module
,
module_versions
)]
[
mod_name
]
=
params
.
modules
modules
=
envmods
(
mod_name
,
module_versions
)
except
ValueError
:
modules
=
[
envmod
(
mod
ul
e
,
module_versions
)
for
mod
ul
e
in
params
.
modules
]
modules
=
list
(
chain
.
from_iterable
(
envmod
s
(
mod
_nam
e
,
module_versions
)
for
mod
_nam
e
in
params
.
modules
))
cmd
=
run_with_modules
(
cmd
,
generic_shell_commands
=
generic_cmd
,
...
...
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