Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix/skewed-sample-hierarchy #450

Merged
merged 3 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed
- A bug where the filenames in iterative workflows kept appending `.out`, `.partial`, or `.expanded` to the filenames stored in the `merlin_info/` subdirectory
- A bug where a skewed sample hierarchy was created when a restart was necessary in the `add_merlin_expanded_chain_to_chord` task

## [1.10.3]
### Added
Expand Down
48 changes: 27 additions & 21 deletions merlin/common/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,27 +298,33 @@ def add_merlin_expanded_chain_to_chord( # pylint: disable=R0913,R0914
LOG.debug("chain added to chord")
else:
# recurse down the sample_index hierarchy
LOG.debug("recursing down sample_index hierarchy")
for next_index in sample_index.children.values():
next_index.name = os.path.join(sample_index.name, next_index.name)
LOG.debug("generating next step")
next_step = add_merlin_expanded_chain_to_chord.s(
task_type,
chain_,
samples[next_index.min - min_sample_id : next_index.max - min_sample_id],
labels,
next_index,
adapter_config,
next_index.min,
)
next_step.set(queue=chain_[0].get_task_queue())
LOG.debug(f"recursing with range {next_index.min}:{next_index.max}, {next_index.name} {signature(next_step)}")
LOG.debug(f"queuing samples[{next_index.min}:{next_index.max}] in for {chain_} in {next_index.name}...")
if self.request.is_eager:
next_step.delay()
else:
self.add_to_chord(next_step, lazy=False)
LOG.debug(f"queued for samples[{next_index.min}:{next_index.max}] in for {chain_} in {next_index.name}")
try:
LOG.debug("recursing down sample_index hierarchy")
for next_index in sample_index.children.values():
next_index_name_before = next_index.name
next_index.name = os.path.join(sample_index.name, next_index.name)
LOG.debug("generating next step")
next_step = add_merlin_expanded_chain_to_chord.s(
task_type,
chain_,
samples[next_index.min - min_sample_id : next_index.max - min_sample_id],
labels,
next_index,
adapter_config,
next_index.min,
)
next_step.set(queue=chain_[0].get_task_queue())
LOG.debug(f"recursing with range {next_index.min}:{next_index.max}, {next_index.name} {signature(next_step)}")
LOG.debug(f"queuing samples[{next_index.min}:{next_index.max}] in for {chain_} in {next_index.name}...")
if self.request.is_eager:
next_step.delay()
else:
self.add_to_chord(next_step, lazy=False)
LOG.debug(f"queued for samples[{next_index.min}:{next_index.max}] in for {chain_} in {next_index.name}")
except Exception as e:
bgunnar5 marked this conversation as resolved.
Show resolved Hide resolved
# Reset the index to what it was before so we don't accidentally create a bunch of extra samples upon restart
next_index.name = next_index_name_before
raise e

return ReturnCode.OK

Expand Down
Loading