Ejemplo n.º 1
0
def process(mod_name, oid_list, opts={}, force=False):
    proxy_list = []
    for server_ip in server_list:
        proxy_list.append((server_ip, server_port))
    oid_list = unpack(oid_list)
    mod_name = unpack(mod_name)
    opts = unpack(opts)
    return pack(mp.multi_map_distrib(proxy_list, mod_name, oid_list, opts, True, force))
Ejemplo n.º 2
0
 def wrapper(*args, **kwargs):
     try:
         # Pack the vars before transmitting
         new_args = []
         for arg in args: 
             new_args.append(sys_utils.pack(arg))
         new_args = tuple(new_args)
         
         # Pack the key word vars before transmitting
         new_kwargs = {}
         for k in kwargs:
             new_kwargs[k] = sys_utils.pack(kwargs[k])
         res = f(*new_args, **new_kwargs)
         result = sys_utils.unpack(res) # unpack the result
         return result
     
     except MemoryError:
         print "MemoryError while trying to decode"
         return None
Ejemplo n.º 3
0
 def wrapper(*args, **kwargs):
     # Unpack the key word vars after being transmitted
     new_args = []
     for arg in args: 
         new_args.append(sys_utils.unpack(arg))
     new_args = tuple(new_args)
     
     # Unpack the key word vars after being transmitted
     new_kwargs = {}
     for k in kwargs:
         new_kwargs[k] = sys_utils.unpack(kwargs[k])
     
     res = f(*new_args, **new_kwargs)
     result = sys_utils.pack(res) # Pack the result before transmitting
     return result
Ejemplo n.º 4
0
def retrieve(mod_name, oid_list, opts={}):
    proxy_list = []
    oid_list = unpack(oid_list)
    mod_name = unpack(mod_name)
    opts = unpack(opts)

    for server_ip in server_list:
        proxy_list.append((server_ip, server_port))
    if not isinstance(oid_list, list):
        oid_list = [oid_list]
    new_oid_list = []
    for oid in oid_list:
        if not oxide.exists(mod_name, oid, opts):
            new_oid_list.append(oid)
    if new_oid_list:
        mp.multi_map_distrib(proxy_list, mod_name, new_oid_list, opts)
    proxy = get_proxy(server_ip, server_port, wrapped=True)
    return pack(proxy.retrieve(mod_name, oid_list, opts))