static void Main(string[] args) { var client = new CRAClientLibrary(); int chunkSize = 10 * 1024 * 1024; client.Reset(); client.DefineVertex("bandwidthtestvertex", () => new BandwidthTestVertex()); client.InstantiateVertex("crainst01", "bwvertex1", "bandwidthtestvertex", chunkSize); client.InstantiateVertex("crainst02", "bwvertex2", "bandwidthtestvertex", chunkSize); //client.InstantiateVertex("crainst03", "bwvertex3", "bandwidthtestvertex", chunkSize); client.Connect("bwvertex1", "output1", "bwvertex2", "input1"); /* * client.Connect("bwvertex1", "output2", "bwvertex2", "input2"); * client.Connect("bwvertex1", "output3", "bwvertex2", "input3"); * client.Connect("bwvertex1", "output4", "bwvertex2", "input4"); * client.Connect("bwvertex1", "output5", "bwvertex2", "input5"); * client.Connect("bwvertex1", "output6", "bwvertex2", "input6"); * client.Connect("bwvertex1", "output7", "bwvertex2", "input7"); * client.Connect("bwvertex1", "output8", "bwvertex2", "input8"); * client.Connect("bwvertex1", "output9", "bwvertex2", "input9"); * client.Connect("bwvertex1", "output10", "bwvertex2", "input10"); * client.Connect("bwvertex1", "output11", "bwvertex2", "input11"); * client.Connect("bwvertex1", "output12", "bwvertex2", "input12"); * * client.Connect("bwvertex1", "output13", "bwvertex2", "input13"); * client.Connect("bwvertex1", "output14", "bwvertex2", "input14"); * client.Connect("bwvertex1", "output15", "bwvertex2", "input15"); * client.Connect("bwvertex1", "output16", "bwvertex2", "input16");*/ Console.ReadLine(); }
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); } }
static void Main(string[] args) { var client = new CRAClientLibrary(); client.Reset(); client.DefineVertex("fusableconnectionpairvertex", () => new FusableConnectionPairVertex()); client.InstantiateVertex("crainst01", "fvertex1", "fusableconnectionpairvertex", null); client.InstantiateVertex("crainst01", "fvertex2", "fusableconnectionpairvertex", null); client.Connect("fvertex1", "output", "fvertex2", "input"); Console.ReadLine(); }
static void Main(string[] args) { var client = new CRAClientLibrary(); client.DefineVertex("connectionpairvertex", () => new ConnectionPairVertex()); client.InstantiateVertex("crainst01", "vertex1", "connectionpairvertex", new MyParam { field1 = 33, field2 = "foo" }); client.InstantiateVertex("crainst02", "vertex2", "connectionpairvertex", new MyParam { field1 = 34 }); client.Connect("vertex1", "output", "vertex2", "input"); client.Connect("vertex2", "output", "vertex1", "input"); Console.ReadLine(); }
public static bool DeployProduceTask(CRAClientLibrary client, ProduceTask task) { try { client.DefineVertex(typeof(ProducerOperator).Name.ToLower(), () => new ProducerOperator()); CRAErrorCode status = client.InstantiateShardedVertex(task.OutputId, typeof(ProducerOperator).Name.ToLower(), task, task.DeployDescriptor.InstancesMap()); if (status == CRAErrorCode.Success) { return(true); } else { return(false); } } catch (Exception e) { Console.WriteLine("Error in deploying a sharded CRA produce task. Please, double check your task configurations: " + e.ToString()); return(false); } }
static void Main(string[] args) { var client = new CRAClientLibrary(); client.DefineVertex("shardedconnectionpairvertex", () => new ShardedConnectionPairVertex()); client.InstantiateVertex( new[] { "crainst01", "crainst02" }, "vertex1", "shardedconnectionpairvertex", null, 1, e => e % 2); client.InstantiateVertex( new[] { "crainst01", "crainst02" }, "vertex2", "shardedconnectionpairvertex", null, 1, e => e % 2); client.Connect("vertex1", "output", "vertex2", "input"); client.Connect("vertex2", "output", "vertex1", "input"); Console.ReadLine(); }