aiidateam / aiida-core

The official repository for the AiiDA code
https://aiida-core.readthedocs.io
Other
431 stars 187 forks source link

CLI: `verdi computer relabel` can be relabelled to label that is parsed away in other commands #6415

Open agoscinski opened 4 months ago

agoscinski commented 4 months ago

I actually wanted to cause an error and thought that the label ! would return an error, but then it worked and I could not reverse it. Maybe this label can be escaped properly. But I am not sure how and it is inconsistent that I can use it in relabel in one direction only

$ verdi computer relabel localhost !
Success: Computer 'localhost' relabeled to '!'
$ verdi computer list
Report: List of configured computers
Report: Use 'verdi computer show COMPUTERLABEL' to display more detailed information
* !
$ verdi computer relabel ! localhost
Usage: verdi computer relabel [OPTIONS] COMPUTER LABEL
Try 'verdi computer relabel --help' for help.

Error: Invalid value for 'COMPUTER': no Computer found with LABEL<>: No result was found
$ verdi computer show !
Usage: verdi computer show [OPTIONS] COMPUTER
Try 'verdi computer show --help' for help.

Error: Invalid value for 'COMPUTER': no Computer found with LABEL<>: No result was found
$ verdi computer show 1                                  │490         computer.store()
---------------------------  ---------------------------------------------------- 
Label                        !                                                    
PK                           1                                                    
UUID                         ea18df8c-dac8-4c6e-88c9-3f9ef5369438                 
Description                  Localhost automatically created by `verdi presto`    
Hostname                     localhost                                            
Transport type               core.local                                           
Scheduler type               core.direct                                          
Work directory               /home/alexgo/code/aiida-core/.aiida/scratch/presto-1 
Shebang                      #!/bin/bash                                          
Mpirun command               mpirun -np {tot_num_mpiprocs}                        
Default #procs/machine       1                                                    
Default memory (kB)/machine                                                       
Prepend text                                                                      
Append text                                                                       
---------------------------  ---------------------------------------------------- 

Your environment

Python 3.11, Ubuntu 22.04

$ verdi status                                            
 ✔ version:     AiiDA v2.5.1.post0                                                                                      
 ✔ config:      /home/alexgo/code/aiida-core/.aiida                                                                     
 ✔ profile:     presto-1                                                                                                
 ✔ storage:     SqliteDosStorage[/home/alexgo/code/aiida-core/.aiida/repository/sqlite_dos_8665b32a7f4d45d3b1448d7931fd5
03d]: open,                                                                                                             
 ✔ broker:      RabbitMQ v3.8.14 @ amqp://guest:guest@127.0.0.1:5672?heartbeat=600                                      
 ⏺ daemon:      The daemon is not running.