Skip to content

Commit

Permalink
Merge pull request #28 from lukemartinlogan/master
Browse files Browse the repository at this point in the history
Don't except on load_class
  • Loading branch information
lukemartinlogan authored Oct 2, 2023
2 parents 0256d92 + 30b8a54 commit 4499ec3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
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)

0 comments on commit 4499ec3

Please sign in to comment.