ai2cm / fv3config

Manipulate FV3GFS run directories
Apache License 2.0
1 stars 0 forks source link

Pass arbitrary kwargs from run_docker/run_k8s to run_native #68

Closed nbren12 closed 4 years ago

nbren12 commented 4 years ago

Changing the signature of run_native (e.g. to add an option changing the logging behavior), requires editing 3 other files: run_kubernetes, run_docker, and the __main__.py. This PR allows run_kubernetes and run_docker to pass arbitrary arguments to run_native provided that they are serializable with json. A side effect is that run_kubernetes can now take an actual configuration dictionary rather than a url pointing to one.

It also tidies up the implementation of run_kubernetes especially. run_docker still has some unavoidable logic to do with creating the bind-mounts, but is slightly cleaner now too.

nbren12 commented 4 years ago

@mcgibbon FYI, functools wraps doesn't enforce that the signatures match:

>>> from functools import wraps
>>> def f(a,b):
...     pass
...
>>> @wraps(f)
... def g(a):
...     pass
...
>>> g(10)