File size: 327 Bytes
b458825
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
# task_interceptor.py
from processor_manager import should_offload
from remote_executor import execute_remotely

def offload_if_needed(func):
    def wrapper(*args, **kwargs):
        if should_offload():
            return execute_remotely(func.__name__, args, kwargs)
        return func(*args, **kwargs)
    return wrapper