Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SVLT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
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
ALMF
SVLT
Commits
e155ed65
Commit
e155ed65
authored
1 year ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
Implemented batch export chunking
parent
22d6190c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
extensions/chaeo/batch_jobs/20231028_Porto_PA.py
+4
-3
4 additions, 3 deletions
extensions/chaeo/batch_jobs/20231028_Porto_PA.py
model_server/util.py
+18
-0
18 additions, 0 deletions
model_server/util.py
with
22 additions
and
3 deletions
extensions/chaeo/batch_jobs/20231028_Porto_PA.py
+
4
−
3
View file @
e155ed65
...
...
@@ -9,7 +9,7 @@ from extensions.ilastik.models import IlastikPixelClassifierModel
if
__name__
==
'
__main__
'
:
sample_id
=
'
20231028-porto-PA
'
root
=
Path
(
'
c:/Users/rhodes/projects/proj0012-trec-handoff/owncloud-sync/TREC-HD/Images/
'
)
where_czi
=
(
root
/
'
TREC_STOP_26_Porto/Selection
'
).
__str__
()
where_czi
=
(
root
/
'
TREC_STOP_26_Porto/
231028_automic/20231028-134649_successfulrun/
Selection
'
).
__str__
()
where_output
=
autonumber_new_directory
(
'
c:/Users/rhodes/projects/proj0011-plankton-seg/exp0023/output
'
,
'
batch-output
'
...
...
@@ -48,9 +48,10 @@ if __name__ == '__main__':
[
IlastikPixelClassifierModel
(
params
=
{
'
project_file
'
:
Path
(
px_ilp
)})],
params
,
catch_and_continue
=
False
,
chunk_size
=
25
,
)
csv_path
=
(
Path
(
where_output
)
/
'
workflow_data.csv
'
).
__str__
()
write_ecotaxa_tsv
(
csv_path
,
where_output
,
sample_id
=
sample_id
,
scope_id
=
'
EMBL-MS-Zeiss-LSM900
'
)
#
csv_path = (Path(where_output) / 'workflow_data.csv').__str__()
#
write_ecotaxa_tsv(csv_path, where_output, sample_id=sample_id, scope_id='EMBL-MS-Zeiss-LSM900')
print
(
'
Finished
'
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
model_server/util.py
+
18
−
0
View file @
e155ed65
from
math
import
ceil
from
pathlib
import
Path
import
re
from
time
import
localtime
,
strftime
...
...
@@ -82,6 +83,7 @@ def loop_workflow(
export_batch_csvs
:
bool
=
True
,
write_intermediate_products
:
bool
=
True
,
catch_and_continue
:
bool
=
True
,
chunk_size
:
int
=
None
,
):
"""
Iteratively call the specified workflow function on each of a list of input files
...
...
@@ -92,7 +94,23 @@ def loop_workflow(
:param export_batch_csvs: if True, write any tabular data returned by workflow_func to CSV files
:param write_intermediate_products: if True, write any intermediate image products to TIF files
:param catch_and_continue: if True, catch exceptions returned by workflow_func and keep iterating
:param chunk_size: create subdirectories with specified number of input files, or all in top-level directory if None
"""
if
chunk_size
and
chunk_size
<
len
(
files
):
for
ci
in
range
(
0
,
ceil
(
len
(
files
)
/
ceil
(
chunk_size
))):
loop_workflow
(
files
[
ci
*
chunk_size
:
(
ci
+
1
)
*
chunk_size
],
(
Path
(
output_folder_path
)
/
f
'
part-
{
ci
:
04
d
}
'
).
__str__
(),
workflow_func
,
models
,
params
,
export_batch_csvs
=
export_batch_csvs
,
write_intermediate_products
=
write_intermediate_products
,
catch_and_continue
=
catch_and_continue
,
chunk_size
=
None
)
return
True
failures
=
[]
for
ii
,
ff
in
enumerate
(
files
):
export_kwargs
=
{
...
...
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