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

Improve error messages regarding track syntax errors #1908

Merged
merged 3 commits into from
Jan 29, 2025
Merged
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
7 changes: 7 additions & 0 deletions esrally/track/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,11 @@ def read(self, track_name, track_spec_file, mapping_dir):
f.write(rendered)
self.logger.info("Final rendered track for '%s' has been written to '%s'.", track_spec_file, tmp.name)
track_spec = json.loads(rendered)
except jinja2.exceptions.TemplateSyntaxError as te:
self.logger.exception("Could not load [%s] due to Jinja Syntax Exception.", track_spec_file)
msg = f"Could not load '{track_spec_file}' due to Jinja Syntax Exception."
gareth-ellis marked this conversation as resolved.
Show resolved Hide resolved
msg += f"The track file ({tmp.name}) likely hasn't been writen"
raise TrackSyntaxError(msg, te)
except jinja2.exceptions.TemplateNotFound:
self.logger.exception("Could not load [%s]", track_spec_file)
raise exceptions.SystemSetupError(f"Track {track_name} does not exist")
Expand Down Expand Up @@ -1697,6 +1702,8 @@ def parse_task(
default_ramp_up_time_period=None,
completed_by_name=None,
):
if "operation" not in task_spec:
raise TrackSyntaxError("Operation missing from task spec %s in challenge '%s'." % (task_spec, challenge_name))
op_spec = task_spec["operation"]
if isinstance(op_spec, str) and op_spec in ops:
op = ops[op_spec]
Expand Down