Features
- `ShellParser`: Add support to parse output directory as `FolderData` [[269fd391]](https://github.com/sphuber/aiida-shell/commit/269fd391736d3567c20146c763b4882f44456f6b)
It is now possible to add a directory to the `outputs` and it will be attached as a `FolderData` output node:
python
from aiida.orm import SinglefileData
from aiida_shell import launch_shell_job
results, node = launch_shell_job(
'tar',
arguments=['-zxvf', '{archive}'],
nodes={
'archive': SinglefileData('/some/path/archive.tar.gz'),
},
outputs=['sub_folder']
)
- `ShellJob`: Add `filename_stdin` input to redirect file through stdin [[87bc8360]](https://github.com/sphuber/aiida-shell/commit/87bc8360c28b08a27baffe4ccad445b7332241b1)
Certain shell commands require input to be passed through the stdin file descriptor.
To reproduce this behaviour, the file that should be redirected through stdin can be defined using the `metadata.option.filename_stdin` input:
python
from aiida.orm import SinglefileData
from aiida_shell import launch_shell_job
results, node = launch_shell_job(
'cat',
nodes={
'input': SinglefileData.from_string('string a')
},
metadata={'options': {'filename_stdin': 'input'}}
)
print(results['stdout'].get_content())
- `ShellJob`: Add support for custom parsing [[32db3847]](https://github.com/sphuber/aiida-shell/commit/32db3847975f14e5955e46f0abb28645c0939b4d)
This makes it possible to define a custom parser on-the-fly to parse output data and attach it any existing `Data` class.
For example, the content of the file can be stored as a `Str` instead of a `SinglefileData`:
python
from aiida_shell import launch_shell_job
def parser(self, dirpath):
from aiida.orm import Str
return {'string': Str((dirpath / 'stdout').read_text().strip())}
results, node = launch_shell_job(
'echo',
arguments=['some output'],
parser=parser
)
print(results['string'].value)
- `ShellJob`: Add the `additional_retrieve` option [[05def137]](https://github.com/sphuber/aiida-shell/commit/05def1371f53853a98417b9ee9d00a0903f36337)
- Add the `PickledData` data plugin [[3a40eefc]](https://github.com/sphuber/aiida-shell/commit/3a40eefc9c3bded1d69fbbb68c0960f0052222ea)
Fixes
- `ShellJob`: Use `SinglefileData.filename` before falling back on key [[fe34d973]](https://github.com/sphuber/aiida-shell/commit/fe34d9731b7057b2d03f92483ade68f57b534a3f)
- `ShellJob`: Automatically create parent directories in `filenames` [[9b380200]](https://github.com/sphuber/aiida-shell/commit/9b380200efe0621d3bf50940d993e4ff88d7e9e8)
- `ShellJob`: Raise when `<` or `>` are specified in `arguments` [[5f42f0aa]](https://github.com/sphuber/aiida-shell/commit/5f42f0aa18911196352d2e7c780c29ee9b596e74)
Dependencies
- Update pre-commit requirement `isort==5.12.0` [[69ac1ffe]](https://github.com/sphuber/aiida-shell/commit/69ac1ffe780305d5d111c848e82fb191b68c4891)