Skip to content

Conversation

@GeigerJ2
Copy link
Collaborator

@GeigerJ2 GeigerJ2 commented Mar 27, 2025

The issue we were encountering (see here) is resolved by specifying the filenames argument of the ShellTask.

Notes:

  • Removed code for sourcing files to set env variables, as it is broken anyway for remote submission
  • small test case currently fails as restart output not retrieved -> Root of problem might lie elsewhere, though
  • Enforce absolute path for available data inputs?!

@GeigerJ2
Copy link
Collaborator Author

GeigerJ2 commented Apr 10, 2025

Ping to the team, @leclairm, @agoscinski, @DropD, that this should be ready for review.

@GeigerJ2 GeigerJ2 changed the title WIP: Remote submission Fix symlinking RemoteData nodes for remote-submission Apr 10, 2025
filenames = {}
input_sockets = workgraph_task.inputs.nodes

for input_socket in input_sockets:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Check that this doesn't mess with SinglefileData.

pyproject.toml Outdated
"lxml",
"f90nml"
"f90nml",
"aiida-shell @ git+https://github.com/sphuber/aiida-shell.git@fix/105/handle-remote-data-argument-placeholders",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Need to pin here before the PR is merged and released.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need this change in aiida-shell or would this just make our life easier?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, this is required. Without it, the instructions will always be appended by /*, so will always fail for our RemoteData files, see here:
https://github.com/sphuber/aiida-shell/blob/189df631759eb07e574bfb5a5be2843ea532ec9d/src/aiida_shell/calculations/shell.py#L341
We could still hack our way around it by using the parent of the src path, but then, still, all files in the directory will be linked. I think it's better if we keep it pinned for now, and expect the PR to aiida-shell to be merged and released.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't we monkeypatch ShellJob and pin the exact version? When we start to include git hashes in our dependencies I am afraid we run into problems later on. Dependency resolvement becomes a bit intransparent and unpredictable, e.g. we pin a hash while wrokgraph pins a version.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, that was more meant as a temporary fix. Maybe @sphuber can include the change in a patch release of aiida-shell, and we can set that?

Copy link

Choose a reason for hiding this comment

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

I finally released this fix in v0.8.1 just now. Had forgotten about it, sorry for the delay

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Cheers, thanks a lot @sphuber! Just in time that this PR actually works and can be reviewed 🚀

pyproject.toml Outdated
## Hatch configurations

[tool.hatch.metadata]
allow-direct-references = true
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Needed for being able to pin aiida-shell.


filenames = {}

for input_list in task.inputs.values():
Copy link
Collaborator

Choose a reason for hiding this comment

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

inputs can be a list of inputs because for shell task we can assign multiple inputs for one port and the list returns you all the inputs for this one port. I don't think we stress test this much so most of the time the input_list has just one element.

Suggested change
for input_list in task.inputs.values():
for input_list in task.input_data_nodes:

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you need to handle all inputs separate as these can be potentially different files. Note that currently our code is also buggy in this regard. If we pass the outputs of a parametrized shell task to another task aiida will copy the file to the working directory. Since the output filename is the same for each parameter they will be overwritten. So only one file exists in the working directory of the next tasks that gets this as input. The solution is to give the outputs unique names.

@GeigerJ2 GeigerJ2 force-pushed the remote-submission branch from c4b98d0 to a2ca536 Compare May 6, 2025 12:14
@agoscinski
Copy link
Collaborator

Can you rebase so we can run the tests?

agoscinski added a commit that referenced this pull request May 31, 2025
I decided to remove the check since we will need to move it to to the
aiida part after PR #136 is merged. With #136 we need to consider remote
data which we cannot check neigher in core nor parsing. So moving this
now to the yaml parsing would require the adoption of many test which
will be anyway not be needed.
msg = f"Could not find computer {data.computer!r} for input {data}."
raise ValueError(msg) from err
self._aiida_data_nodes[label] = aiida.orm.RemoteData(remote_path=data.src, label=label, computer=computer)
# `remote_path` must be str not PosixPath to be JSON-serializable
Copy link
Collaborator Author

@GeigerJ2 GeigerJ2 Jun 3, 2025

Choose a reason for hiding this comment

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

This was a bug in the code before this PR that surfaced when actually submitting.

[tool.pytest.ini_options]
# Configuration for [pytest](https://docs.pytest.org)
addopts = "--pdbcls=IPython.terminal.debugger:TerminalPdb"
addopts = "-s --pdbcls=IPython.terminal.debugger:TerminalPdb"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

-s disables output capturing, and allows for setting breakpoints in test code

@GeigerJ2
Copy link
Collaborator Author

GeigerJ2 commented Jun 3, 2025

Superseeded by PR #157 from branch on upstream.

@GeigerJ2 GeigerJ2 closed this Jun 4, 2025
agoscinski added a commit that referenced this pull request Jun 4, 2025
- Add dispatching for `IconTask` in multiple functions in responsible
  for creating the WorkGraph.
- Pass `computer` argument to `core.Task` since it is required for the
  creation of a `IconCaclculation`. In the `small-shell` config the
  usage of `computer` has been removed temporarly until PR #136 fixes
  the usage.
- Changes in `core.AvailableData`:
  - Use `config_rootdir` to resolve location of data if relative.
  - The `src` member is now compulsory and validated. This change
    required to implement the `from_config` constructor for
    `AvailableData` and `GeneratedData` as the validation does not
    happen for `GeneratedData`.
- Fixing how `is_restart` is determined: It was not considering the data
  structure correctly data items. It was only checking the existance of
  the restart key in the input items, it was, however, not considering
  that the data structure still lists the input item with an empty list
  when the `when` keyword is used. Now it validates correctly to
  `False`.
- In tests we use now `pytest.fixture.usefixtures` when a fixture is not
  directly used but is required to be executed
agoscinski added a commit that referenced this pull request Jun 4, 2025
I decided to remove the check since we will need to move it to to the
aiida part after PR #136 is merged. With #136 we need to consider remote
data which we cannot check neigher in core nor parsing. So moving this
now to the yaml parsing would require the adoption of many test which
will be anyway not be needed.
agoscinski added a commit that referenced this pull request Jun 4, 2025
- Add dispatching for `IconTask` in multiple functions in responsible
  for creating the WorkGraph.
- Pass `computer` argument to `core.Task` since it is required for the
  creation of a `IconCaclculation`. In the `small-shell` config the
  usage of `computer` has been removed temporarly until PR #136 fixes
  the usage.
- Changes in `core.AvailableData`:
  - Use `config_rootdir` to resolve location of data if relative.
  - The `src` member is now compulsory and validated. This change
    required to implement the `from_config` constructor for
    `AvailableData` and `GeneratedData` as the validation does not
    happen for `GeneratedData`.
- Fixing how `is_restart` is determined: It was not considering the data
  structure correctly data items. It was only checking the existance of
  the restart key in the input items, it was, however, not considering
  that the data structure still lists the input item with an empty list
  when the `when` keyword is used. Now it validates correctly to
  `False`.
- In tests we use now `pytest.fixture.usefixtures` when a fixture is not
  directly used but is required to be executed
agoscinski added a commit that referenced this pull request Jun 4, 2025
I decided to remove the check since we will need to move it to to the
aiida part after PR #136 is merged. With #136 we need to consider remote
data which we cannot check neither in core nor in parsing. So moving this
now to the yaml parsing would require the adoption of many test which
will be anyway not be needed.
agoscinski added a commit that referenced this pull request Jun 6, 2025
Adds a new test case `small-icon` and renamed test case `small` to
`small-shell`. The `small-icon` test case is a copy of `small` replacing the
usage of the dummy icon scripts with real icon. Because the `small` test case
increases coverage of  `ShellTask` it is kept.

- Add dispatching for `IconTask` in multiple functions in responsible for
  creating the WorkGraph.
- Pass `computer` argument to `core.Task` since it is required for the creation
  of a `IconCaclculation`. In the `small-shell` config the usage of `computer`
  has been removed temporarly until PR #136 fixes the usage.
- Changes in `core.AvailableData`:
  - Use `config_rootdir` to resolve location of data if relative.
  - The `src` member is now compulsory and validated. This change required to
    implement the `from_config` constructor for `AvailableData` and
    `GeneratedData` as the validation does not happen for `GeneratedData`.
- Fixing how `is_restart` is determined: It was not considering the data
  structure correctly data items. It was only checking the existance of the
  restart key in the input items, it was, however, not considering that the data
  structure still lists the input item with an empty list when the `when`
  keyword is used. Now it validates correctly to `False`.
- In tests we use now `pytest.fixture.usefixtures` when a fixture is not
  directly used but is required to be executed
- Exclude `test/cases/*` in type check as it contains dummy python scripts
- Update the default options of `hatch test` to run without icon
- Rename pytest fixture `icon_grid_simple_path` to `icon_grid_path`
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.

4 participants