Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
13 changes: 7 additions & 6 deletions src/simdb/cli/commands/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,13 @@ def simulation_push(
if replaces:
simulation.set_meta("replaces", replaces)

schemas = api.get_validation_schemas()
try:
for schema in schemas:
Validator(schema, config).validate(simulation)
except ValidationError as err:
raise click.ClickException(f"Simulation does not validate: {err}") from err
if api.get_upload_options().get("auto_validate", True):
schemas = api.get_validation_schemas()
try:
for schema in schemas:
Validator(schema, config).validate(simulation)
except ValidationError as err:
raise click.ClickException(f"Simulation does not validate: {err}") from err

api.push_simulation(simulation, out_stream=sys.stdout, add_watcher=add_watcher)

Expand Down
6 changes: 5 additions & 1 deletion src/simdb/remote/apis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,16 @@ def get(self, user: User):

Returns the server-side upload behaviour flags clients should honour
when pushing simulations, such as whether files and IMAS data are
copied onto the server.
copied onto the server, and whether the server automatically
validates simulations on push.
"""
config = current_app.simdb_config
options = {
"copy_files": config.get_option("server.copy_files", default=True),
"copy_ids": config.get_option("server.copy_ids", default=True),
"auto_validate": config.get_option(
"validation.auto_validate", default=False
),
}

return jsonify(options)
Expand Down
Loading