Ejemplo n.º 1
0
        public static async Task <bool> DeployProduceTask(CRAClientLibrary client, ProduceTask task, OperatorsToplogy topology)
        {
            try
            {
                if (!_isProduceOperatorDefined)
                {
                    await client.DefineVertexAsync(typeof(ShardedProducerOperator).Name.ToLower(), () => new ShardedProducerOperator());

                    _isProduceOperatorDefined = true;
                }

                var status = await client.InstantiateVertexAsync(CreateInstancesNames(task.DeployDescriptor.InstancesMap()), task.OutputId, typeof(ShardedProducerOperator).Name.ToLower(), task, 1);

                if (status == CRAErrorCode.Success)
                {
                    foreach (string fromSecondaryInputId in task.EndpointsDescriptor.SecondaryFromInputs.Keys)
                    {
                        var fromToConnection = task.VerticesConnectionsMap[fromSecondaryInputId + 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 produce task. Please, double check your task configurations: " + e.ToString());
                return(false);
            }
        }
Ejemplo n.º 2
0
        private void GenerateProduceTask(ref OperatorsToplogy operatorsTopology)
        {
            _shardedDatasetId = typeof(ShardedProducerOperator).Name.ToLower() + Guid.NewGuid().ToString();

            TaskBase produceTask = new ProduceTask(SerializationHelper.Serialize(_producer));

            produceTask.OperationTypes = TransformUtils.FillBinaryTransformTypes(
                typeof(TKey), typeof(TPayload), typeof(TDataset),
                typeof(TKey), typeof(TPayload), typeof(TDataset),
                typeof(TKey), typeof(TPayload), typeof(TDataset));
            produceTask.IsRightOperandInput = false;
            produceTask.InputIds.SetInputId1(_shardedDatasetId);
            produceTask.InputIds.SetInputId2(_shardedDatasetId);
            produceTask.OutputId = _shardedDatasetId;
            produceTask.NextInputIds.SetInputId1(_shardedDatasetId);
            produceTask.NextInputIds.SetInputId2(_shardedDatasetId);
            produceTask.PrepareTaskTransformations(new OperatorTransforms());

            operatorsTopology.AddOperatorBase(produceTask.OutputId, produceTask);
        }
Ejemplo n.º 3
0
 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);
     }
 }