/// <summary>
        /// Creates service and data loading context configuration for given context id and partition descriptor
        /// </summary>
        /// <param name="partitionDescriptor"></param>
        /// <param name="contextId"></param>
        /// <returns>Configuration for context and service</returns>
        private ContextAndServiceConfiguration GetDataLoadingContextAndServiceConfiguration(
            IPartitionDescriptor partitionDescriptor, string contextId)
        {
            var dataLoadingContextConf =
                TangFactory.GetTang()
                .NewConfigurationBuilder()
                .BindSetEntry <ContextConfigurationOptions.StartHandlers, DataLoadingContext <TPartitionType>, IObserver <IContextStart> >(
                    GenericType <ContextConfigurationOptions.StartHandlers> .Class,
                    GenericType <DataLoadingContext <TPartitionType> > .Class)
                .Build();

            var serviceConf =
                TangFactory.GetTang()
                .NewConfigurationBuilder(
                    ServiceConfiguration.ConfigurationModule
                    .Set(ServiceConfiguration.Services, GenericType <TaskStateService> .Class)
                    .Build(),
                    dataLoadingContextConf,
                    partitionDescriptor.GetPartitionConfiguration(),
                    _configurationManager.MapTaskStateConfiguration)
                .Build();

            var contextConf = ContextConfiguration.ConfigurationModule
                              .Set(ContextConfiguration.Identifier, contextId)
                              .Build();

            return(new ContextAndServiceConfiguration(contextConf, serviceConf));
        }
Beispiel #2
0
        private ContextAndServiceConfiguration GetDataLoadingContextAndServiceConfiguration(
            IPartitionDescriptor partitionDescriptor,
            string evaluatorId)
        {
            var dataLoadingContextConf =
                TangFactory.GetTang()
                .NewConfigurationBuilder()
                .BindSetEntry <ContextConfigurationOptions.StartHandlers, DataLoadingContext <TPartitionType>, IObserver <IContextStart> >(
                    GenericType <ContextConfigurationOptions.StartHandlers> .Class,
                    GenericType <DataLoadingContext <TPartitionType> > .Class)
                .Build();

            var serviceConf =
                TangFactory.GetTang()
                .NewConfigurationBuilder(ServiceConfiguration.ConfigurationModule.Build(),
                                         dataLoadingContextConf,
                                         partitionDescriptor.GetPartitionConfiguration())
                .Build();

            var contextConf = ContextConfiguration.ConfigurationModule
                              .Set(ContextConfiguration.Identifier, string.Format("DataLoading-{0}", evaluatorId))
                              .Build();

            return(new ContextAndServiceConfiguration(contextConf, serviceConf));
        }
        private ContextAndServiceConfiguration GetMapTaskContextAndServiceConfiguration(IPartitionDescriptor partitionDescriptor)
        {
            var codecConfig =
                TangFactory.GetTang()
                .NewConfigurationBuilder(
                    StreamingCodecConfiguration <MapInputWithControlMessage <TMapInput> > .Conf.Set(
                        StreamingCodecConfiguration <MapInputWithControlMessage <TMapInput> > .Codec,
                        GenericType <MapInputWithControlMessageCodec <TMapInput> > .Class).Build(),
                    StreamingCodecConfigurationMinusMessage <TMapOutput> .Conf.Build(),
                    _configurationManager.MapInputCodecConfiguration)
                .Build();

            var contextConf = _groupCommDriver.GetContextConfiguration();
            var serviceConf = Configurations.Merge(_groupCommDriver.GetServiceConfiguration(), codecConfig, partitionDescriptor.GetPartitionConfiguration());

            return(new ContextAndServiceConfiguration(contextConf, serviceConf));
        }