Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't except on load_class #28

Merged
merged 4 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jarvis_util/shell/exec_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def __init__(self, exec_type=ExecType.LOCAL, nprocs=None, ppn=None,
self.exec_async = exec_async
self.stdin = stdin
self.keys = ['exec_type', 'nprocs', 'ppn', 'user', 'pkey', 'port',
'hostfile', 'env', 'sleep_ms', 'sudo',
'hostfile', 'env', 'sleep_ms', 'sudo', 'sudoenv',
'cwd', 'hosts', 'collect_output',
'pipe_stdout', 'pipe_stderr', 'hide_output',
'exec_async', 'stdin']
Expand Down
5 changes: 3 additions & 2 deletions jarvis_util/shell/ssh_exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ def __init__(self, cmd, exec_info):
cmd = self.smash_cmd(cmd, self.sudo, self.basic_env, exec_info.sudoenv)
if not exec_info.hostfile.is_local():
super().__init__(self.ssh_cmd(cmd),
exec_info.mod(env=exec_info.basic_env))
exec_info.mod(env=exec_info.basic_env,
sudo=False))
else:
super().__init__(cmd, exec_info)
super().__init__(cmd, exec_info.mod(sudo=False))

def ssh_cmd(self, cmd):
lines = ['ssh']
Expand Down
5 changes: 4 additions & 1 deletion jarvis_util/util/import_mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ def load_class(import_str, path, class_name):
"""
if len(path):
sys.path.insert(0, path)
module = __import__(import_str, fromlist=[class_name])
try:
module = __import__(import_str, fromlist=[class_name])
except:
return None
if len(path):
sys.path.pop(0)
return getattr(module, class_name)
Loading