Skip to content

Commit

Permalink
one command with multiple tasks works but still do not solve the max …
Browse files Browse the repository at this point in the history
…array size issue.
  • Loading branch information
jingpengw committed Oct 27, 2020
1 parent 83379d7 commit c6c9650
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions chunkflow/flow/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,19 +233,23 @@ def create_info(tasks,layer_path, channel_num, layer_type, data_type, encoding,
@click.option('--slurm-job-array/--no-slurm-job-array',
default=False, help='use the slurm job array '+
'environment variable to identify task index.')
@click.option('--granularity', '-g',
type=int, default=1, help='number of tasks to do in one run.')
@operator
def fetch_task_from_file(tasks, file_path, task_index, slurm_job_array):
def fetch_task_from_file(tasks, file_path, task_index, slurm_job_array, granularity):
if(slurm_job_array):
assert os.environ['SLURM_ARRAY_JOB_ID'] == 0
assert os.environ['SLURM_ARRAY_TASK_ID'] >= 0
task_index = os.environ['SLURM_ARRAY_TASK_ID']
assert task_index is not None

bbox_array = np.load(file_path)
bbox = Bbox.from_list(bbox_array[task_index, :])
task = get_initial_task()
task['bbox'] = bbox
yield task
task_stop = min(bbox_array.shape[0], task_index + granularity)
for idx in range(task_index, task_stop):
bbox = Bbox.from_list(bbox_array[idx, :])
task = get_initial_task()
task['bbox'] = bbox
yield task


@main.command('fetch-task-from-sqs')
Expand Down

0 comments on commit c6c9650

Please sign in to comment.