public static async Task <bool> DeploySubscribeTask(CRAClientLibrary client, SubscribeTask task, OperatorsToplogy topology) { try { if (!_isSubscribeOperatorDefined) { await client.DefineVertexAsync(typeof(ShardedSubscribeOperator).Name.ToLower(), () => new ShardedSubscribeOperator()); _isSubscribeOperatorDefined = true; } var status = await client.InstantiateVertexAsync(CreateInstancesNames(task.DeployDescriptor.InstancesMap()), task.OutputId, typeof(ShardedSubscribeOperator).Name.ToLower(), task, 1); if (status == CRAErrorCode.Success) { foreach (string fromInputId in task.EndpointsDescriptor.FromInputs.Keys) { var fromToConnection = task.VerticesConnectionsMap[fromInputId + task.OutputId][0]; await client.ConnectAsync(fromToConnection.FromVertex, fromToConnection.FromEndpoint, fromToConnection.ToVertex, fromToConnection.ToEndpoint); } 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.DefineVertexAsync("connectionpairvertex", () => new ConnectionPairVertex()).Wait(); client.InstantiateVertexAsync("crainst01", "vertex1", "connectionpairvertex", new MyParam { field1 = 33, field2 = "foo" }).Wait(); client.InstantiateVertexAsync("crainst02", "vertex2", "connectionpairvertex", new MyParam { field1 = 34 }).Wait(); client.ConnectAsync("vertex1", "output", "vertex2", "input").Wait(); client.ConnectAsync("vertex2", "output", "vertex1", "input").Wait(); Console.ReadLine(); }
static void Main(string[] args) { var client = new CRAClientLibrary(); client.DefineVertexAsync("shardedconnectionpairvertex", (System.Linq.Expressions.Expression <Func <IVertex> >)(() => new ShardedConnectionPairVertex())).Wait(); client.InstantiateVertexAsync( new[] { "crainst01", "crainst02" }, "vertex1", "shardedconnectionpairvertex", null, 1, e => e % 2).Wait(); client.InstantiateVertexAsync( new[] { "crainst01", "crainst02" }, "vertex2", "shardedconnectionpairvertex", null, 1, e => e % 2).Wait(); client.ConnectAsync("vertex1", "output", "vertex2", "input").Wait(); client.ConnectAsync("vertex2", "output", "vertex1", "input").Wait(); Console.ReadLine(); }
static void Main(string[] args) { var client = new CRAClientLibrary(); client.ResetAsync().Wait(); client.DefineVertexAsync("fusableconnectionpairvertex", () => new FusableConnectionPairVertex()).Wait(); client.InstantiateVertexAsync("crainst01", "fvertex1", "fusableconnectionpairvertex", null).Wait(); client.InstantiateVertexAsync("crainst01", "fvertex2", "fusableconnectionpairvertex", null).Wait(); client.ConnectAsync("fvertex1", "output", "fvertex2", "input").Wait(); Console.ReadLine(); }
public static async Task <bool> DeployClientTerminal( CRAClientLibrary client, string workerName, ClientTerminalTask task, OperatorsToplogy topology) { try { bool result = true; client.DisableArtifactUploading(); if (!_isSubscribeClientOperatorDefined) { await client.DefineVertexAsync(typeof(ShardedSubscribeClientOperator).Name.ToLower(), () => new ShardedSubscribeClientOperator()); _isSubscribeClientOperatorDefined = true; } var status = await client.InstantiateVertexAsync(new string[] { workerName }, task.OutputId, typeof(ShardedSubscribeClientOperator).Name.ToLower(), task, 1); if (status == CRAErrorCode.Success) { foreach (string fromInputId in task.EndpointsDescriptor.FromInputs.Keys) { string outputEndpoint = OperatorUtils.PrepareOutputEndpointIdForOperator( task.OutputId, topology.OperatorsEndpointsDescriptors[fromInputId]); string inputEndpoint = OperatorUtils.PrepareInputEndpointIdForOperator(fromInputId, task.EndpointsDescriptor, false); await client.ConnectAsync(fromInputId, outputEndpoint, task.OutputId, inputEndpoint); } result = true; } else { result = false; } client.EnableArtifactUploading(); return(result); } catch (Exception e) { Console.WriteLine("Error in deploying a CRA client terminal vertex. Please, double check your task configurations: " + e.ToString()); return(false); } }
static void Main(string[] args) { var client = new CRAClientLibrary(new FileDataProvider()); int chunkSize = 10 * 1024 * 1024; Console.ReadLine(); client.DefineVertexAsync("bandwidthtestvertex", () => new BandwidthTestVertex()).Wait(); client.InstantiateVertexAsync("crainst01", "bwvertex1", "bandwidthtestvertex", chunkSize).Wait(); client.InstantiateVertexAsync("crainst02", "bwvertex2", "bandwidthtestvertex", chunkSize).Wait(); // client.InstantiateVertexAsync("crainst03", "bwvertex3", "bandwidthtestvertex", chunkSize).Wait(); client.ConnectAsync("bwvertex1", "output1", "bwvertex2", "input1").Wait(); client.ConnectAsync("bwvertex1", "output2", "bwvertex2", "input2").Wait(); client.ConnectAsync("bwvertex1", "output3", "bwvertex2", "input3").Wait(); client.ConnectAsync("bwvertex1", "output4", "bwvertex2", "input4").Wait(); client.ConnectAsync("bwvertex1", "output5", "bwvertex2", "input5").Wait(); client.ConnectAsync("bwvertex1", "output6", "bwvertex2", "input6").Wait(); client.ConnectAsync("bwvertex1", "output7", "bwvertex2", "input7").Wait(); client.ConnectAsync("bwvertex1", "output8", "bwvertex2", "input8").Wait(); client.ConnectAsync("bwvertex2", "output9", "bwvertex1", "input9").Wait(); client.ConnectAsync("bwvertex2", "output10", "bwvertex1", "input10").Wait(); client.ConnectAsync("bwvertex2", "output11", "bwvertex1", "input11").Wait(); client.ConnectAsync("bwvertex2", "output12", "bwvertex1", "input12").Wait(); client.ConnectAsync("bwvertex2", "output13", "bwvertex1", "input13").Wait(); client.ConnectAsync("bwvertex2", "output14", "bwvertex1", "input14").Wait(); client.ConnectAsync("bwvertex2", "output15", "bwvertex1", "input15").Wait(); client.ConnectAsync("bwvertex2", "output16", "bwvertex1", "input16").Wait(); Console.ReadLine(); client.ResetAsync().Wait(); }