Quantum-Accelerators/quacc

The function signature when supplying `parsl_resource_specification` is hacky

Andrew-S-Rosen opened this issue · 0 comments

What would you like to report?

walltime = decorator_kwargs.pop("walltime", None)
parsl_resource_specification = decorator_kwargs.pop(
"parsl_resource_specification", {}
)
def wrapper(
*f_args,
walltime=walltime, # noqa: ARG001
parsl_resource_specification=parsl_resource_specification, # noqa: ARG001
**f_kwargs,
):
return func(*f_args, **f_kwargs)
wrapper.__name__ = func.__name__
return wrapper

Here, we don't want to change the underlying function name so have patched .__name__ of the wrapped function. This is hacky though and doesn't retain things like the original function signature or docstrings. In reality, we should be using something like @functools.wraps but supposedly that does not result in the parsl_resource_specification being retained.