Skip to content

Commit

Permalink
Update analyze's error message to provide better clarity
Browse files Browse the repository at this point in the history
Example session:

```sh
$ ramble workspace analyze --where '{experiment_index} == 1'
==> Streaming details to log:
==>   /usr/local/google/home/linsword/hpc-dev/ramble/var/ramble/workspaces/hostname-test/logs/analyze.2024-09-11_13.12.38.out
==>   Analyzing 1 out of 12 experiments:
==> Error: No analyzeable experiment detected. All selected ones are either templates or the base of repeated experiments.

$ ramble workspace analyze --where '{experiment_index} == 13'
==> Streaming details to log:
==>   /usr/local/google/home/linsword/hpc-dev/ramble/var/ramble/workspaces/hostname-test/logs/analyze.2024-09-11_13.12.44.out
==>   Analyzing 0 out of 12 experiments:
==> Error: No experiment left for analysis after filtering.
```
  • Loading branch information
linsword13 committed Sep 12, 2024
1 parent 6a46cd7 commit ad437d5
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions lib/ramble/ramble/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,26 @@ def _prepare(self):
# - At least one expeirment is set up
# - `--dry-run` is enabled
found_valid_experiment = False
for exp, app_inst, _ in self._experiment_set.filtered_experiments(self.filters):
# Record how many non-analyzable experiments are encountered
no_analyze_cnt = 0
for _, app_inst, _ in self._experiment_set.filtered_experiments(self.filters):
if not (app_inst.is_template or app_inst.repeats.is_repeat_base):
if app_inst.get_status() != ramble.application.experiment_status.UNKNOWN.name:
found_valid_experiment = True

if not found_valid_experiment and self._experiment_set.num_experiments():
else:
no_analyze_cnt += 1

num_total_exps = self._experiment_set.num_experiments()
num_filtered_exps = self._experiment_set.num_filtered_experiments(self.filters)
if not found_valid_experiment and num_total_exps:
if not num_filtered_exps:
logger.die("No experiment left for analysis after filtering.")
if num_filtered_exps == no_analyze_cnt:
logger.die(
"No analyzeable experiment detected."
" All selected ones are either templates or the base of"
" repeated experiments."
)
logger.die(
"No analyzeable experiment detected."
" Make sure your workspace is setup with\n"
Expand Down

0 comments on commit ad437d5

Please sign in to comment.