Skip to content

Commit

Permalink
Fix batch execution
Browse files Browse the repository at this point in the history
  • Loading branch information
kostrykin committed Sep 13, 2024
1 parent 9474029 commit e28bda5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/regressiontests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ jobs:
- name: Run SuperDSM
run: |
python -m "superdsm.batch" examples --task-dir "${{ matrix.taskdir }}"
python -m "superdsm.batch" examples --task-dir "${{ matrix.taskdir }}" --run
python -m "superdsm" examples --task-dir "examples/${{ matrix.taskdir }}"
python -m "superdsm" examples --task-dir "examples/${{ matrix.taskdir }}" --run
env:
SUPERDSM_INTERMEDIATE_OUTPUT: false
SUPERDSM_NUM_CPUS: 20
Expand Down
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Run the script `load_data.py` to download the example image data from the web.

Run `python -m 'superdsm.batch' .` within this directory to process the examples.
Run `python -m 'superdsm' .` within this directory to process the examples.

You can add your own data to this directory, and then process it in the same way.
3 changes: 2 additions & 1 deletion superdsm/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def configure(self, base_config: repype.config.Config, input_id: InputID, *args,
scale = base_config.get('scale', None)
if scale is None:
if img is None:
img_filepath = self.resolve('input', input_id)
img_filepath = self.resolve('inputs', input_id)
assert img_filepath is not None, f'Scopes: {self.scopes}'
img = superdsm.io.imread(img_filepath)
scale = _estimate_scale(img, num_radii=10, thresholds=[0.01])[0]
base_config['scale'] = scale
Expand Down
13 changes: 9 additions & 4 deletions superdsm/task.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import csv
import os

import ray
import repype.config
import repype.stage
import repype.status
Expand All @@ -10,10 +12,10 @@
PipelineData,
)

import superdsm.globalenergymin
import superdsm.io
import superdsm.pipeline
import superdsm.render
import superdsm.io
import superdsm.globalenergymin


def _write_performance_report(task_path, performance_path, data, overall_performance):
Expand All @@ -36,10 +38,13 @@ def _write_performance_report(task_path, performance_path, data, overall_perform
class Task(repype.task.Task):

def create_pipeline(self, *args, **kwargs) -> Pipeline:
return superdsm.pipeline.Pipeline(*args, **kwargs)
scopes = self.full_spec.get('scopes', dict())
scopes = {key: self.resolve_path(value) for key, value in scopes.items()}
return superdsm.pipeline.Pipeline(*args, scopes=scopes, **kwargs)

def run(self, *args, **kwargs) -> repype.task.TaskData:
data = super().run()
ray.init(num_cpus=int(os.environ.get('SUPERDSM_NUM_CPUS', 2)), log_to_driver=False, logging_level='error')
data = super().run(*args, **kwargs)

# Aggregate performance report
performance = superdsm.globalenergymin.PerformanceReport()
Expand Down

0 comments on commit e28bda5

Please sign in to comment.