def module_signature(obj, constant_hasher_map={}): hasher = sha_hash() u = hasher.update u(obj.module_descriptor.name) u(obj.module_descriptor.package) u(obj.module_descriptor.namespace or '') u(obj.module_descriptor.package_version or '') u(obj.module_descriptor.version or '') u(hash_list(obj.functions, Hasher.function_signature, constant_hasher_map)) u(hash_list(obj.control_parameters, Hasher.control_param_signature, constant_hasher_map)) return hasher.digest()
def group_signature(pipeline, module, chm): if module._port_specs is None: module.make_port_specs() input_conns = {} input_functions = {} for from_module, c_id in pipeline.graph.edges_to(module.id): conn = pipeline.connections[c_id] if conn.destination.name not in input_conns: input_conns[conn.destination.name] = [] input_conns[conn.destination.name].append((from_module, conn)) for function in module.functions: if function.name not in input_functions: input_functions[function.name] = [] input_functions[function.name].append(function) covered_modules = dict((k, False) for k in module._input_remap) for input_port_name, conn_list in input_conns.iteritems(): covered_modules[input_port_name] = True input_module = module._input_remap[input_port_name] upstream_sigs = [(pipeline.subpipeline_signature(m) + Hasher.connection_signature(c)) for (m, c) in conn_list] module_sig = Hasher.module_signature(input_module, chm) sig = Hasher.subpipeline_signature(module_sig, upstream_sigs) if input_port_name in input_functions: function_sig = hash_list(input_functions[input_port_name], Hasher.function_signature, chm) sig = Hasher.compound_signature([sig, function_sig]) input_module._input_port_signature = sig for input_port_name, done in covered_modules.iteritems(): if done: continue covered_modules[input_port_name] = True input_module = module._input_remap[input_port_name] if input_port_name in input_functions: module_sig = Hasher.module_signature(input_module, chm) function_sig = hash_list(input_functions[input_port_name], Hasher.function_signature, chm) sig = Hasher.compound_signature([module_sig, function_sig]) else: sig = Hasher.module_signature(input_module, chm) input_module._input_port_signature = sig module.pipeline.refresh_signatures() sig_list = [] sig_list.append(Hasher.module_signature(module, chm)) for m_id in module.pipeline.graph.sinks(): sig_list.append(module.pipeline.subpipeline_signature(m_id)) return Hasher.compound_signature(sig_list)
def module_signature(obj, constant_hasher_map={}): hasher = sha_hash() u = hasher.update u(obj.module_descriptor.name) u(obj.module_descriptor.package) u(obj.module_descriptor.namespace or '') u(obj.module_descriptor.package_version or '') u(obj.module_descriptor.version or '') u( hash_list(obj.functions, Hasher.function_signature, constant_hasher_map)) u( hash_list(obj.control_parameters, Hasher.control_param_signature, constant_hasher_map)) return hasher.digest()
def function_signature(function, constant_hasher_map={}): hasher = sha_hash() u = hasher.update u(function.name) u(function.returnType) u( hash_list(function.params, Hasher.parameter_signature, constant_hasher_map)) return hasher.digest()
def function_signature(function, constant_hasher_map={}): hasher = sha_hash() u = hasher.update u(function.name) u(function.returnType) u(hash_list(function.params, Hasher.parameter_signature, constant_hasher_map)) return hasher.digest()