hpcflow.sdk.submission.shells.powershell.WindowsPowerShell#
- class hpcflow.sdk.submission.shells.powershell.WindowsPowerShell(*args, **kwargs)#
Bases:
Shell
Class to represent using PowerShell on Windows to generate and submit a jobscript.
Methods
Get powershell version information.
Format commands to run within a child scope.
Attributes
- DEFAULT_EXE = 'powershell.exe'#
- JS_DIRECT_HEADER = '{shebang}\n\n{header}\n'#
- JS_ELEMENT_LOOP = 'for ($JS_elem_idx = 0; $JS_elem_idx -lt {num_elements}; $JS_elem_idx += 1) {{\n{main}\n}}\nSet-Location $WK_PATH\n'#
- JS_ENV_SETUP_INDENT = ' '#
- JS_EXT = '.ps1'#
- JS_HEADER = 'function {workflow_app_alias} {{\n & {{\n{env_setup}{app_invoc} `\n --config-dir "{config_dir}" `\n --config-invocation-key "{config_invoc_key}" `\n $args\n }} @args\n}}\n\nfunction get_nth_line($file, $line) {{\n Get-Content $file | Select-Object -Skip $line -First 1\n}}\n\nfunction JoinMultiPath {{\n $numArgs = $args.Length\n $path = $args[0]\n for ($i = 1; $i -lt $numArgs; $i++) {{\n $path = Join-Path $path $args[$i]\n }}\n return $path\n}}\n\n$WK_PATH = $(Get-Location)\n$SUB_IDX = {sub_idx}\n$JS_IDX = {js_idx}\n$EAR_ID_FILE = JoinMultiPath $WK_PATH artifacts submissions $SUB_IDX {EAR_file_name}\n$ELEM_RUN_DIR_FILE = JoinMultiPath $WK_PATH artifacts submissions $SUB_IDX {element_run_dirs_file_path}\n'#
- JS_INDENT = ' '#
- JS_MAIN = '$elem_need_EARs = get_nth_line $EAR_ID_FILE $JS_elem_idx\n$elem_run_dirs = get_nth_line $ELEM_RUN_DIR_FILE $JS_elem_idx\n\nfor ($JS_act_idx = 0; $JS_act_idx -lt {num_actions}; $JS_act_idx += 1) {{\n\n $need_EAR = ($elem_need_EARs -split "{EAR_files_delimiter}")[$JS_act_idx]\n if ($need_EAR -eq 0) {{\n continue\n }}\n\n $run_dir = ($elem_run_dirs -split "{EAR_files_delimiter}")[$JS_act_idx]\n $run_dir_abs = "$WK_PATH\\$run_dir"\n Set-Location $run_dir_abs\n\n {workflow_app_alias} internal workflow $WK_PATH write-commands $SUB_IDX $JS_IDX $JS_elem_idx $JS_act_idx\n {workflow_app_alias} internal workflow $WK_PATH set-ear-start $SUB_IDX $JS_IDX $JS_elem_idx $JS_act_idx\n\n . (Join-Path $run_dir_abs "{commands_file_name}")\n {workflow_app_alias} internal workflow $WK_PATH set-ear-end $SUB_IDX $JS_IDX $JS_elem_idx $JS_act_idx\n\n}}\n'#
- JS_SHEBANG = ''#
- format_save_parameter(workflow_app_alias, param_name, shell_var_name)#
- format_stream_assignment(shell_var_name, command)#
- get_version_info(exclude_os=False)#
Get powershell version information.
- prepare_element_run_dirs(run_dirs)#