mirror of
https://github.com/vale981/jobmanager
synced 2025-03-04 17:31:39 -05:00
- reduce verbosity in function call example to not confuse the user
- correct bug for clients with different counter keyword arguments (validCountKwargs), closes #30
This commit is contained in:
parent
96260d04b3
commit
0d8df9bf77
2 changed files with 7 additions and 9 deletions
|
@ -25,7 +25,6 @@ def my_func(arg1, const_arg1, arg2, const_arg2, __c, __m, **kwargs):
|
|||
return arg1 + arg2
|
||||
|
||||
|
||||
|
||||
def start_server():
|
||||
const_arg = {'const_arg1' : 'ca1',
|
||||
'const_arg2' : 'ca2',
|
||||
|
@ -40,12 +39,12 @@ def start_server():
|
|||
{'arg1': 5, 'arg2': 50, 'other': -5},
|
||||
{'arg1': 6, 'arg2': 60, 'other': -6} ]
|
||||
|
||||
with jm.JobManager_Server(authkey=AUTHKEY, const_arg=const_arg, fname_dump=None) as server:
|
||||
with jm.JobManager_Server(authkey=AUTHKEY, const_arg=const_arg, fname_dump=None, verbose=1) as server:
|
||||
server.args_from_list(arg_list)
|
||||
server.start()
|
||||
|
||||
def start_client():
|
||||
client = jm.clients.FunctionCall_Client(authkey=AUTHKEY, server='localhost', show_statusbar_for_jobs=False, verbose=2)
|
||||
client = jm.clients.FunctionCall_Client(authkey=AUTHKEY, server='localhost', show_statusbar_for_jobs=False, verbose=0)
|
||||
client.start()
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -63,5 +62,3 @@ if __name__ == "__main__":
|
|||
|
||||
import IPython
|
||||
IPython.embed()
|
||||
|
||||
|
||||
|
|
|
@ -304,7 +304,7 @@ class JobManager_Client(object):
|
|||
@staticmethod
|
||||
def __worker_func(func, nice, verbose, server, port, authkey, i, manager_objects, c, m, reset_pbc, njobs):
|
||||
"""
|
||||
the wrapper spawned nproc trimes calling and handling self.func
|
||||
the wrapper spawned nproc times calling and handling self.func
|
||||
"""
|
||||
identifier = progress.get_identifier(name='worker{}'.format(i+1))
|
||||
Signal_to_sys_exit(signals=[signal.SIGTERM])
|
||||
|
@ -331,6 +331,7 @@ class JobManager_Client(object):
|
|||
#args_of_func = inspect.getfullargspec(func).args
|
||||
#if len(args_of_func) == 2:
|
||||
count_args = getCountKwargs(func)
|
||||
|
||||
if count_args is None:
|
||||
if verbose > 1:
|
||||
print("{}: found function without status information".format(identifier))
|
||||
|
@ -343,9 +344,9 @@ class JobManager_Client(object):
|
|||
# in `validCountKwargs`.
|
||||
# Here we translate to "c" and "m".
|
||||
def _func(arg, const_arg, c, m):
|
||||
arg[count_args[0]] = c
|
||||
arg[count_args[1]] = m
|
||||
return func(arg, const_arg)
|
||||
kwargs = {count_args[0]: c,
|
||||
count_args[1]: m}
|
||||
return func(arg, const_arg, **kwargs)
|
||||
else:
|
||||
if verbose > 1:
|
||||
print("{}: found standard keyword arguments: [c, m]".format(identifier))
|
||||
|
|
Loading…
Add table
Reference in a new issue