Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
alibylite
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Swain Lab
aliby
alibylite
Commits
676bc7c8
Commit
676bc7c8
authored
1 year ago
by
pswain
Browse files
Options
Downloads
Patches
Plain Diff
refactor(pipeline): cleaned multiprocessing in run
parent
0801f4a2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/aliby/pipeline.py
+5
-10
5 additions, 10 deletions
src/aliby/pipeline.py
with
5 additions
and
10 deletions
src/aliby/pipeline.py
+
5
−
10
View file @
676bc7c8
...
@@ -293,17 +293,14 @@ class Pipeline(ProcessABC):
...
@@ -293,17 +293,14 @@ class Pipeline(ProcessABC):
# multiple cores
# multiple cores
with
Pool
(
distributed
)
as
p
:
with
Pool
(
distributed
)
as
p
:
results
=
p
.
map
(
results
=
p
.
map
(
lambda
x
:
self
.
run_one_position
(
*
x
),
self
.
run_one_position
,
[
[
position_id
for
position_id
in
position_ids
.
items
()],
(
position_id
,
i
)
for
i
,
position_id
in
enumerate
(
position_ids
.
items
())
],
)
)
else
:
else
:
# single core
# single core
results
=
[
results
=
[
self
.
run_one_position
(
(
position_id
,
position_id_path
),
1
)
self
.
run_one_position
(
position_id
)
for
position_id
,
position_id_path
in
tqdm
(
position_ids
.
items
())
for
position_id
in
tqdm
(
position_ids
.
items
())
]
]
# results is binary giving the success for each position
# results is binary giving the success for each position
return
results
return
results
...
@@ -323,9 +320,7 @@ class Pipeline(ProcessABC):
...
@@ -323,9 +320,7 @@ class Pipeline(ProcessABC):
return
out_file
return
out_file
def
run_one_position
(
def
run_one_position
(
self
,
self
,
name_image_id
:
t
.
Tuple
[
str
,
str
or
Path
or
int
]
name_image_id
:
t
.
Tuple
[
str
,
str
or
Path
or
int
],
index
:
t
.
Optional
[
int
]
=
None
,
):
):
"""
Run a pipeline for one position.
"""
"""
Run a pipeline for one position.
"""
name
,
image_id
=
name_image_id
name
,
image_id
=
name_image_id
...
...
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