sphuber / aiida-shell

AiiDA plugin that makes running shell commands easy.
MIT License
14 stars 7 forks source link

See if the `process_label` can be more specific #7

Closed sphuber closed 2 years ago

sphuber commented 2 years ago

Currently, the process_label of a ShellJob is set to ShellJob. The output of verdi process list then typically looks like:

(aiida_dev) sph@invader:~/code/aiida/env/dev/aiida-shell$ verdi process list -a -p1
  PK  Created    Process label        Process State    Process status
----  ---------  -------------------  ---------------  ----------------
  33  14s ago    ShellJob             ⏹ Finished [0]
  42  12s ago    ShellJob             ⏹ Finished [0]
  51  10s ago    ShellJob             ⏹ Finished [0]

This is the default behavior for all CalcJobs as defined by aiida-core. Normally this is good enough because each CalcJob implementation will have a name that is specific to the code that is normally run with it. For example, the plugin for pw.x of Quantum ESPRESSO is called PwCalculation.

For the ShellJob this is not that informative though as a huge variety of codes can be run with it and they will all be listed as ShellJob. It would be great if this could at least include the shell command that was run and ideally even the computer. So when running echo on localhost it would be echo@localhost for example and if running pp.x on the remote computer daint we'd get pp.x@daint.

This would most likely require a change in aiida-core to provide a hook for a CalcJob implementation to override the generation of the process_label attribute. It could then set it as code.full_label which would reproduce the behavior described above.

sphuber commented 2 years ago

The new required functionality will be provided by https://github.com/aiidateam/aiida-core/pull/5713 once merged and released.

sphuber commented 2 years ago

With the new functionality the output of verdi process list would instead look like:

(aiida_dev) sph@invader:~/code/aiida/env/dev/aiida-shell$ verdi process list -a -p1
  PK  Created    Process label                      Process State    Process status
----  ---------  ---------------------------------  ---------------  ----------------
 100  1h ago     ShellJob<pdb_fetch@localhost>      ⏹ Finished [0]
 108  1h ago     ShellJob<pdb_selchain@localhost>   ⏹ Finished [0]
 116  1h ago     ShellJob<pdb_delhetatm@localhost>  ⏹ Finished [0]
 124  1h ago     ShellJob<pdb_tidy@localhost>       ⏹ Finished [0]