private static bool DeployShuffleReduceTask(CRAClientLibrary client, ShuffleTask task, OperatorsToplogy topology) { try { client.DefineVertex(typeof(ShuffleOperator).Name.ToLower(), () => new ShuffleOperator()); CRAErrorCode status = client.InstantiateShardedVertex(task.ReducerVertexName, typeof(ShuffleOperator).Name.ToLower(), task, task.DeployDescriptor.InstancesMap()); if (status == CRAErrorCode.Success) { foreach (string fromInputId in task.SecondaryEndpointsDescriptor.FromInputs.Keys) { client.ConnectShardedVertices(task.VerticesConnectionsMap[fromInputId + task.OutputId]); } var fromInput = task.EndpointsDescriptor.FromInputs.First().Key; var newFromInputId = fromInput.Substring(0, fromInput.Length - 1); client.ConnectShardedVertices(task.VerticesConnectionsMap[newFromInputId + task.ReducerVertexName]); return(true); } else { return(false); } } catch (Exception) { Console.WriteLine("Error in deploying a sharded CRA shuffle mapper task. Please, double check your task configurations"); return(false); } }
public static bool DeploySubscribeTask(CRAClientLibrary client, SubscribeTask task, OperatorsToplogy topology) { try { client.DefineVertex(typeof(SubscribeOperator).Name.ToLower(), () => new SubscribeOperator()); CRAErrorCode status = client.InstantiateShardedVertex(task.OutputId, typeof(SubscribeOperator).Name.ToLower(), task, task.DeployDescriptor.InstancesMap()); if (status == CRAErrorCode.Success) { foreach (string fromInputId in task.EndpointsDescriptor.FromInputs.Keys) { client.ConnectShardedVertices(task.VerticesConnectionsMap[fromInputId + task.OutputId]); } return(true); } else { return(false); } } catch (Exception e) { Console.WriteLine("Error in deploying a sharded CRA Subscribe task. Please, double check your task configurations: " + e.ToString()); return(false); } }