@@ -471,15 +471,14 @@ def set_aws(self, aws: 'AWSBoto'):
471
471
472
472
# Ask user to enter the path to a aws credentials directory
473
473
474
- if os .path .exists (os .path .join (self .home_dir , '.aws' )):
475
- default_aws_dir = os .path .join (self .home_dir , '.aws' )
476
- else :
477
- default_aws_dir = None
474
+ default_aws_dir = os .path .join (self .home_dir , '.aws' )
475
+ if not os .path .exists (os .path .join (self .home_dir , '.aws' )):
476
+ os .makedirs (self .aws_dir , exist_ok = True , mode = 0o775 )
478
477
479
478
aws_dir_question = [
480
479
inquirer .Path (
481
480
'aws_dir' ,
482
- message = f'Enter the path to aws credentials directory (default: { default_aws_dir } )' ,
481
+ message = f'Enter the path to aws credentials directory (default: ~/.aws )' ,
483
482
default = default_aws_dir ,
484
483
validate = self .__inquirer_check_path_exists )
485
484
]
@@ -660,9 +659,6 @@ def __set_aws_config(self, aws_profile_name, region):
660
659
if not region :
661
660
raise ValueError ('No region provided' )
662
661
663
- # If it does not exist, create aws directory
664
- os .makedirs (self .aws_dir , exist_ok = True , mode = 0o775 )
665
-
666
662
# Create a aws config ConfigParser object
667
663
aws_config = configparser .ConfigParser ()
668
664
@@ -706,9 +702,6 @@ def __set_aws_credentials(self,
706
702
if not aws_secret_access_key :
707
703
raise ValueError ('No AWS secret access key provided' )
708
704
709
- # If it does not exist, create aws directory
710
- os .makedirs (self .aws_dir , exist_ok = True , mode = 0o775 )
711
-
712
705
# Create a aws credentials ConfigParser object
713
706
aws_credentials = configparser .ConfigParser ()
714
707
@@ -1118,19 +1111,22 @@ def set_slurm(self, args):
1118
1111
'''Set the Slurm configuration'''
1119
1112
1120
1113
try :
1121
- # Run the sacctmgr command
1122
- result = subprocess .run (
1123
- ['sacctmgr' , 'show' , 'config' ], capture_output = False )
1124
-
1125
- if result .returncode != 0 :
1126
- print (
1127
- "sacctmgr command failed. Please ensure it's installed and in your PATH and you are in a head node." )
1128
- return False
1129
1114
1130
1115
if shutil .which ('scontrol' ):
1131
1116
1132
1117
print (f'\n *** SLURM CONFIGURATION ***\n ' )
1133
1118
1119
+ # Run the sacctmgr command
1120
+ result = subprocess .run (
1121
+ ['sacctmgr' , 'show' , 'config' ], capture_output = True )
1122
+
1123
+ if result .returncode != 0 :
1124
+ print (
1125
+ "\n Error: sacctmgr command failed. Please ensure it's installed and in your PATH and you are in a head node." )
1126
+ print (f'\n stdout: { result .stdout .decode ("utf-8" )} \n ' )
1127
+ print (f'\n stderr: { result .stderr .decode ("utf-8" )} \n ' )
1128
+ return False
1129
+
1134
1130
slurm_walltime_days = inquirer .text (
1135
1131
message = "Set the Slurm --time (days) for froster jobs (default = 7)" ,
1136
1132
default = 7 ,
@@ -1141,12 +1137,11 @@ def set_slurm(self, args):
1141
1137
default = 0 ,
1142
1138
validate = self .__inquirer_check_is_number )
1143
1139
1144
- # TODO: This class __init__ should not be here, it should be in the main
1145
1140
se = Slurm (args , self )
1146
1141
1147
1142
# Get the allowed partitions and QOS
1148
1143
parts = se .get_allowed_partitions_and_qos ()
1149
-
1144
+ print ( parts )
1150
1145
if parts is not None :
1151
1146
# Ask the user to select the Slurm partition and QOS
1152
1147
slurm_partition = inquirer .list_input (
@@ -6057,10 +6052,10 @@ def subcmd_config(self, cfg: ConfigManager, aws: AWSBoto):
6057
6052
if self .args .print :
6058
6053
return cfg .print_config ()
6059
6054
6060
- if self .args .monitor :
6061
- froster_binary = os .path .join (cfg .bin_dir , 'froster' )
6062
- return cfg .add_systemd_cron_job (
6063
- f'{ froster_binary } restore --monitor' , '30' )
6055
+ # if self.args.monitor:
6056
+ # froster_binary = os.path.join(cfg.bin_dir, 'froster')
6057
+ # return cfg.add_systemd_cron_job(
6058
+ # f'{froster_binary} restore --monitor', '30')
6064
6059
6065
6060
print (f'\n *****************************' )
6066
6061
print (f'*** FROSTER CONFIGURATION ***' )
@@ -6086,7 +6081,7 @@ def subcmd_config(self, cfg: ConfigManager, aws: AWSBoto):
6086
6081
6087
6082
if not cfg .set_shared ():
6088
6083
return False
6089
-
6084
+
6090
6085
# If shared configuration and shared_config.ini file exists, then use it
6091
6086
if cfg .is_shared :
6092
6087
if hasattr (cfg , 'shared_config_file' ) and os .path .exists (cfg .shared_config_file ):
@@ -6215,10 +6210,10 @@ def subcmd_restore(self, arch: Archiver, aws: AWSBoto):
6215
6210
'Invalid credentials. Set new AWS credentials by running "froster config --aws"' )
6216
6211
sys .exit (1 )
6217
6212
6218
- if self .args .monitor :
6219
- # aws inactivity and cost monitoring
6220
- aws .monitor_ec2 ()
6221
- return
6213
+ # if self.args.monitor:
6214
+ # # aws inactivity and cost monitoring
6215
+ # aws.monitor_ec2()
6216
+ # return
6222
6217
6223
6218
if not self .args .folders :
6224
6219
0 commit comments