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

Drop unused args from unpack functions #3703

Merged
merged 1 commit into from
Nov 20, 2024
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 parsl/executors/execute_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def execute_task(bufs: bytes):
"""Deserialize the buffer and execute the task.
Returns the result or throws exception.
"""
f, args, kwargs, resource_spec = unpack_res_spec_apply_message(bufs, copy=False)
f, args, kwargs, resource_spec = unpack_res_spec_apply_message(bufs)

for varname in resource_spec:
envname = "PARSL_" + str(varname).upper()
Expand Down
4 changes: 1 addition & 3 deletions parsl/executors/high_throughput/mpi_resource_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,7 @@ def put_task(self, task_package: dict):
"""Schedule task if resources are available otherwise backlog the task"""
user_ns = locals()
user_ns.update({"__builtins__": __builtins__})
_f, _args, _kwargs, resource_spec = unpack_res_spec_apply_message(
task_package["buffer"], user_ns, copy=False
)
_f, _args, _kwargs, resource_spec = unpack_res_spec_apply_message(task_package["buffer"])

nodes_needed = resource_spec.get("num_nodes")
if nodes_needed:
Expand Down
2 changes: 1 addition & 1 deletion parsl/executors/radical/rpex_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def _dispatch_proc(self, task):

try:
buffer = rp.utils.deserialize_bson(task['description']['executable'])
func, args, kwargs, _resource_spec = unpack_res_spec_apply_message(buffer, {}, copy=False)
func, args, kwargs, _resource_spec = unpack_res_spec_apply_message(buffer)
ret = remote_side_bash_executor(func, *args, **kwargs)
exc = (None, None)
val = None
Expand Down
2 changes: 1 addition & 1 deletion parsl/executors/workqueue/exec_parsl_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def unpack_source_code_function(function_info, user_namespace):

def unpack_byte_code_function(function_info, user_namespace):
from parsl.serialize import unpack_apply_message
func, args, kwargs = unpack_apply_message(function_info["byte code"], user_namespace, copy=False)
func, args, kwargs = unpack_apply_message(function_info["byte code"])
return (func, 'parsl_function_name', args, kwargs)


Expand Down
6 changes: 3 additions & 3 deletions parsl/serialize/facade.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,16 @@ def pack_res_spec_apply_message(func: Any, args: Any, kwargs: Any, resource_spec
return pack_apply_message(func, args, (kwargs, resource_specification), buffer_threshold=buffer_threshold)


def unpack_apply_message(packed_buffer: bytes, user_ns: Any = None, copy: Any = False) -> List[Any]:
def unpack_apply_message(packed_buffer: bytes) -> List[Any]:
""" Unpack and deserialize function and parameters
"""
return [deserialize(buf) for buf in unpack_buffers(packed_buffer)]


def unpack_res_spec_apply_message(packed_buffer: bytes, user_ns: Any = None, copy: Any = False) -> List[Any]:
def unpack_res_spec_apply_message(packed_buffer: bytes) -> List[Any]:
""" Unpack and deserialize function, parameters, and resource_specification
"""
func, args, (kwargs, resource_spec) = unpack_apply_message(packed_buffer, user_ns=user_ns, copy=copy)
func, args, (kwargs, resource_spec) = unpack_apply_message(packed_buffer)
return [func, args, kwargs, resource_spec]


Expand Down
Loading