Skip to content

Add ability to push local (to the server) files - #91

Open
Yannicked wants to merge 14 commits into
iterorganization:developfrom
Yannicked:feature/v1.3-local-push-clean
Open

Yannicked wants to merge 14 commits into
iterorganization:developfrom
Yannicked:feature/v1.3-local-push-clean

Conversation

@Yannicked

@Yannicked Yannicked commented Jun 18, 2026 •

Copy link
Copy Markdown
Collaborator

Depends on #83, #88 and #90

@olivhoenen olivhoenen linked an issue Jul 1, 2026 that may be closed by this pull request
@Yannicked
Yannicked force-pushed the feature/v1.3-local-push-clean branch from 9318115 to 30d7ec1 Compare July 15, 2026 07:43
@olivhoenen olivhoenen mentioned this pull request Jul 31, 2026
@Yannicked
Yannicked force-pushed the feature/v1.3-local-push-clean branch 3 times, most recently from 591cd39 to 551b750 Compare August 3, 2026 12:44
@Yannicked
Yannicked marked this pull request as ready for review August 4, 2026 08:10
@Yannicked
Yannicked force-pushed the feature/v1.3-local-push-clean branch from af759ca to cd097d5 Compare August 4, 2026 12:12
@Yannicked

Copy link
Copy Markdown
Collaborator Author

Add tests

@olivhoenen olivhoenen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Need better test coverage of the new functionality.

  2. The CLI does not happily accept default remote:

(venv) [hoeneno@98dci4-srv-1005 SimDB]$ (feature/v1.3-local-push-clean) simdb sim push_local --add-watcher --timeout 300.0 131062/4
Usage: simdb sim push_local [OPTIONS] [REMOTE] SIM_ID
Try 'simdb sim push_local --help' for help.

Error: Missing argument 'SIM_ID'.

while specifying the remote name (iterprod is my default) works as expected with correct API negotiation message

(venv) [hoeneno@98dci4-srv-1005 SimDB]$ (feature/v1.3-local-push-clean) simdb sim push_local --add-watcher --timeout 300.0 iterprod 131062/4
Error: 'push_local_simulation' is not supported by the negotiated API version 'v1.2'. It requires one of: v1.3.

Comment thread src/simdb/cli/commands/simulation.py Outdated
@Yannicked

Copy link
Copy Markdown
Collaborator Author
  1. Need better test coverage of the new functionality.

    1. The CLI does not happily accept default remote:
(venv) [hoeneno@98dci4-srv-1005 SimDB]$ (feature/v1.3-local-push-clean) simdb sim push_local --add-watcher --timeout 300.0 131062/4
Usage: simdb sim push_local [OPTIONS] [REMOTE] SIM_ID
Try 'simdb sim push_local --help' for help.

Error: Missing argument 'SIM_ID'.

while specifying the remote name (iterprod is my default) works as expected with correct API negotiation message

(venv) [hoeneno@98dci4-srv-1005 SimDB]$ (feature/v1.3-local-push-clean) simdb sim push_local --add-watcher --timeout 300.0 iterprod 131062/4
Error: 'push_local_simulation' is not supported by the negotiated API version 'v1.2'. It requires one of: v1.3.

This seems to be an issue that already existed before this PR. (also for other commands that accept an optional remote like push). I've added a fix (and test) for it to this PR

…on tests

Adds the `simdb simulation push_local` command for servers that share a
file system with the client: only metadata and partition-relative storage
paths are sent, and the server copies the files in a background task.

Squashed from the pre-rebase history of this branch, which was authored on
a stale base.
File types are already assigned at manifest time and preserved by
_file_data_for_partition, so this pass was a no-op for correctly
ingested simulations. Worse, the directory heuristic could promote a
plain FILE entry living next to IMAS data to IMAS, after which the
server rewrites its URI. It also opened every .nc file and scanned
every parent directory on a shared filesystem.
Hand-rolled requests.post/requests.get bypassed the auth gating on
self._server_auth, the gzip compression for large simulations
payloads, and the negotiated self._api_url.
@Yannicked
Yannicked force-pushed the feature/v1.3-local-push-clean branch from e308328 to 9d2fa2f Compare September 3, 2026 12:44
@prasad-sawantdesai

Copy link
Copy Markdown
Contributor

@Yannicked Could you please resolve merge conflicts. Thank you

Comment thread docs/how-to/push-pull.md

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure whether this error exists from start but renaming the test module will be useful..

(myenv) [sawantp1@98dci4-srv-1005 SimDB]$ pytest -v
=============================================== ERRORS
_________________________ ERROR collecting tests/remote/api/test_metadata.py __________________________
import file mismatch:
imported module 'test_metadata' has this file attribute:
/home/ITER/sawantp1/github/SimDB/tests/imas/test_metadata.py
which is not the same as the test file we want to collect:
/home/ITER/sawantp1/github/SimDB/tests/remote/api/test_metadata.py
HINT: remove pycache / .pyc files and/or use a unique basename for your test file modules
========================================== warnings summary

schemas = api.get_validation_schemas()
try:
for schema in schemas:
Validator(schema).validate(simulation)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found below error when trying to execute push_local command

$ simdb -d simulation push_local --add-watcher 9fbaf738-bdab-11f1-976d-001dd8b7211a
Error: Validator.__init__() missing 1 required positional argument: 'config'
Traceback (most recent call last):
  File "/home/ITER/sawantp1-adm/SimDB/myenv/bin/simdb", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/ITER/sawantp1-adm/SimDB/src/simdb/cli/simdb.py", line 90, in main
    rv = cli(standalone_mode=False)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ITER/sawantp1-adm/SimDB/myenv/lib64/python3.11/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ITER/sawantp1-adm/SimDB/myenv/lib64/python3.11/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/ITER/sawantp1-adm/SimDB/myenv/lib64/python3.11/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ITER/sawantp1-adm/SimDB/myenv/lib64/python3.11/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ITER/sawantp1-adm/SimDB/myenv/lib64/python3.11/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ITER/sawantp1-adm/SimDB/myenv/lib64/python3.11/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ITER/sawantp1-adm/SimDB/myenv/lib64/python3.11/site-packages/click/decorators.py", line 92, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ITER/sawantp1-adm/SimDB/myenv/lib64/python3.11/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ITER/sawantp1-adm/SimDB/src/simdb/cli/commands/simulation.py", line 359, in simulation_push_local
    simulation = _prepare_simulation(config, api, sim_id, replaces)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ITER/sawantp1-adm/SimDB/src/simdb/cli/commands/simulation.py", line 237, in _prepare_simulation
    Validator(schema).validate(simulation)
    ^^^^^^^^^^^^^^^^^
TypeError: Validator.__init__() missing 1 required positional argument: 'config'

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update CLI To Support New Upload Workflow

3 participants