//The callback called after the function completes. public static void callback(PrestoResult result) { FunctionOutput output = (FunctionOutput)result; Console.WriteLine("Execution number: " + output.value + " from node id: " + output.ExecutionNode.HostName); System.Threading.Interlocked.Increment(ref numjobs); }
/// <summary> /// Return an execution back into the domain. /// </summary> /// <param name="contextID">The context ID of the execution.</param> /// <param name="nodeID">The node ID where the execution was run.</param> /// <param name="result">The serialized result of the excution.</param> public void ReturnExecution(string contextID, ClusterNode node, byte[] result) { SerializationEngine serializer = new SerializationEngine(); PrestoResult resultObj = (PrestoResult)serializer.Deserialize(result); resultObj.ExecutionNode = node; Cluster.ReturnExecution(contextID, resultObj); }
/// <summary> /// Execute an incoming job. /// </summary> /// <param name="methodName">The name of the procedure to be executed.</param> /// <param name="typeName">The name of the type held within the assembly for with the procedure to be executed resides.</param> /// <param name="assemblyName">The name of the assembly the procedure resides in.</param> /// <param name="parameter">The parameter passed to the executed procedure.</param> /// <returns>The result of the execution serialized for transport.</returns> public byte[] ExecuteIncoming(string methodName, string typeName, string assemblyName, byte[] parameter) { SerializationEngine serializer = new SerializationEngine(); PrestoParameter param = (PrestoParameter)serializer.Deserialize(parameter); Assembly assembly = assemblies[assemblyName]; Type type = assembly.GetType(typeName, false, true); MethodInfo method = type.GetMethod(methodName); PrestoResult res = (PrestoResult)method.Invoke(null, new object[] { param }); return(serializer.Serialize(res)); }