예제 #1
0
        /// <summary>
        /// Constructs a new instance of <see cref="ComprenoTasksBatch"/>.
        /// </summary>
        /// <param name="tasksApiProvider">An object for working with tasks.</param>
        /// <param name="connectionLimitValidator">An object that implements <see cref="IConnectionLimitValidator"/>.</param>
        /// <param name="sources">Source texts.</param>
        /// <param name="taskSettings">Task settings.</param>
        public ComprenoTasksBatch(IComprenoTasksApiProvider tasksApiProvider, IConnectionLimitValidator connectionLimitValidator, 
			IEnumerable<BatchFileContainer> sources, ComprenoTaskSettings taskSettings)
        {
            if (tasksApiProvider == null)
                throw new ArgumentNullException("tasksApiProvider");
            if (connectionLimitValidator == null)
                throw new ArgumentNullException("connectionLimitValidator");
            if (sources == null)
                throw new ArgumentNullException("sources");
            if (taskSettings == null)
                throw new ArgumentNullException("taskSettings");

            _tasksApiProvider = tasksApiProvider;
            _connectionLimitValidator = connectionLimitValidator;
            _sources = sources;
            _taskSettings = taskSettings;

            DegreeOfParallelism = Environment.ProcessorCount;
            Timeout = System.Threading.Timeout.Infinite;
            CancellationToken = CancellationToken.None;
            ExecutionMode = BatchExecutionMode.Auto;
            PollingInterval = 500;
        }
예제 #2
0
파일: ComprenoApi.cs 프로젝트: Ogonik/LWS
 private ComprenoTaskSettings _getComprenoSettings()
 {
     log.Debug("Creating Compreno Task Settings.");
     var result = new ComprenoTaskSettings();
     result.SourceLanguage = "ru-RU";
     result.Operations.LinguisticInfoExtraction = new LinguisticInfoExtractionOperation();
     return result;
 }
예제 #3
0
 /// <summary>
 /// Constructs a new instance of <see cref="SyncSourceProcessor"/>.
 /// </summary>
 /// <param name="tasksApiProvider">An object for working with tasks.</param>
 /// <param name="taskSettings">Task execution settings.</param>
 public SyncSourceProcessor(IComprenoTasksApiProvider tasksApiProvider, ComprenoTaskSettings taskSettings)
 {
     _tasksApiProvider = tasksApiProvider;
     _taskSettings = taskSettings;
 }
예제 #4
0
            /// <summary>
            /// Constructs a new instance of <see cref="SyncSourceProcessor"/>.
            /// </summary>
            /// <param name="tasksApiProvider">An object for working with tasks.</param>
            /// <param name="taskSettings">Task settings.</param>
            /// <param name="pollingInterval">How often the server should be polled for the task's state.</param>
            public AsyncSourceProcessor(IComprenoTasksApiProvider tasksApiProvider, ComprenoTaskSettings taskSettings,
				int pollingInterval)
            {
                _tasksApiProvider = tasksApiProvider;
                _taskSettings = taskSettings;
                _pollingInterval = pollingInterval;
            }