private void MapXmlElements(IUnityContainer unityContainer, IXmlStepContainer xmlStepContainer)
 {
     foreach (var xmlJobElement in xmlStepContainer.JobElements)
     {
         if (xmlJobElement is XmlStep)
         {
             var xmlStep = (XmlStep)xmlJobElement;
             var stepId  = xmlStep.Id;
             var step    = new StepLoader(xmlStep, unityContainer).LoadStep();
             _stepsMap[stepId] = step;
         }
         else if (xmlJobElement is XmlFlow)
         {
             var xmlFlow = (XmlFlow)xmlJobElement;
             _xmlFlowMap[xmlFlow.Id] = xmlFlow;
             MapXmlElements(unityContainer, xmlFlow);
         }
         else if (xmlJobElement is XmlSplit)
         {
             var xmlSplit = (XmlSplit)xmlJobElement;
             _xmlSplitMap[xmlSplit.Id] = xmlSplit;
             _executor = unityContainer.Resolve <ITaskExecutor>();
             foreach (var xmlFlow in xmlSplit.Flows)
             {
                 MapXmlElements(unityContainer, xmlFlow);
             }
         }
     }
 }
        public LoadBalancerModule(IAsimovConfig config, ITaskExecutor taskExecutor)
        {
            _config = config;
            _taskExecutor = taskExecutor;

            Get["/loadbalancer/listHosts"] = _ =>
            {
                if (_config.LoadBalancer.Password == null)
                    return Response.AsJson(new object[] { });

                using (var loadBalancer = new AlteonLoadBalancer(_config.LoadBalancer))
                {
                    loadBalancer.Login();
                    return Response.AsJson(loadBalancer.GetHostList());
                }
            };

            Post["/loadbalancer/change"] = _ =>
            {
                var command = this.Bind<ChangeLoadBalancerStateCommand>();
                _taskExecutor.AddTask(new ChangeLoadBalancerStates(command));
                return "OK";
            };

            Post["/loadbalancer/settings"] = _ =>
            {
                var command = this.Bind<UpdateLoadBalancerSettingsCommand>();
                _config.LoadBalancer.Password = command.password;

                if (!string.IsNullOrEmpty(command.host))
                    _config.LoadBalancer.Host = command.host;

                return "OK";
            };
        }
 public Factory(JoinableTaskContext taskContext,
                IDebugEngineHandlerFactory debugEngineHandlerFactory,
                ITaskExecutor taskExecutor, LldbEventManager.Factory eventManagerFactory,
                IDebugProgramFactory debugProgramFactory,
                DebugModuleCache.Factory debugModuleCacheFactory,
                DebugModule.Factory debugModuleFactory,
                CreateDebugThreadDelegate debugThreadCreatorDelegate,
                CreateDebugStackFrameDelegate debugStackFrameCreator,
                ILLDBShell lldbShell,
                LldbBreakpointManager.Factory breakpointManagerFactory,
                SymbolLoader.Factory symbolLoaderFactory,
                BinaryLoader.Factory binaryLoaderFactory,
                IModuleFileLoaderFactory moduleFileLoaderFactory)
 {
     _taskContext = taskContext;
     _debugEngineHandlerFactory = debugEngineHandlerFactory;
     _taskExecutor               = taskExecutor;
     _eventManagerFactory        = eventManagerFactory;
     _debugProgramFactory        = debugProgramFactory;
     _debugModuleCacheFactory    = debugModuleCacheFactory;
     _debugModuleFactory         = debugModuleFactory;
     _debugThreadCreatorDelegate = debugThreadCreatorDelegate;
     _debugStackFrameCreator     = debugStackFrameCreator;
     _breakpointManagerFactory   = breakpointManagerFactory;
     _lldbShell               = lldbShell;
     _symbolLoaderFactory     = symbolLoaderFactory;
     _binaryLoaderFactory     = binaryLoaderFactory;
     _moduleFileLoaderFactory = moduleFileLoaderFactory;
 }
Beispiel #4
0
        public void SetUp()
        {
            _completionHandler       = Substitute.For <IAsyncDebugGetPropertiesCompletionHandler>();
            _childrenProvider        = Substitute.For <IChildrenProvider>();
            _childrenProviderFactory = Substitute.For <IChildrenProviderFactory>();

            _childrenProviderFactory.Create(Arg.Any <IChildAdapter>(),
                                            Arg.Any <enum_DEBUGPROP_INFO_FLAGS>(), Arg.Any <uint>())
            .Returns(_childrenProvider);

            _taskExecutor           = Substitute.ForPartsOf <FakeTaskExecutor>();
            _frameVariablesProvider = Substitute.For <FrameVariablesProvider>(null, null, null);

            _getPropertiesOp = new AsyncGetRootPropertiesOperation(_frameVariablesProvider,
                                                                   _taskExecutor,
                                                                   _completionHandler,
                                                                   _childrenProviderFactory,
                                                                   enum_DEBUGPROP_INFO_FLAGS
                                                                   .DEBUGPROP_INFO_FULLNAME, 10,
                                                                   new Guid(
                                                                       "12345678-1234-1234-1234-123456789123"));

            var varibleStub = Substitute.For <IVariableInformation>();

            _frameVariablesProvider.Get(Arg.Any <Guid>())
            .Returns(new List <IVariableInformation>
            {
                varibleStub
            });
        }
Beispiel #5
0
 public virtual Task <bool> RoleNameExist(string roleName, ITaskExecutor svc)
 {
     return(svc.Execute(async() =>
     {
         return await mappingNameToUUID.ExistsAsync(roleName);
     }));
 }
Beispiel #6
0
        public static void Fill(this ITaskExecutor Executor)
        {
            // Data containers
            if (Executor is ITaskDataCompatible)
            {
                (Executor as ITaskDataCompatible).Data = Core.Instanse.Data;
            }

            // Text containers
            if (Executor is ITaskTextCompatible)
            {
                (Executor as ITaskTextCompatible).Text = Core.Instanse.Text;
            }

            // Token containers
            if (Executor is ITaskTokensCompatible)
            {
                (Executor as ITaskTokensCompatible).Tokens = Core.Instanse.Tokens;
            }

            // Image containers
            if (Executor is ITaskImageCompatible)
            {
                (Executor as ITaskImageCompatible).Images = Core.Instanse.Images;
            }
        }
Beispiel #7
0
        public BundleLoader(System.Uri uri, BundleInfo bundleInfo, BundleLoader[] dependencies, BundleManager manager)
        {
            if (bundleInfo == null)
            {
                throw new System.ArgumentNullException("bundleInfo");
            }

            this.uri        = uri;
            this.bundleInfo = bundleInfo;
            this.manager    = manager;
            this.manager.AddBundleLoader(this);
            this.requestCache = new Dictionary <string, AssetBundleRequest>();
            this.executor     = this.manager.Executor;

            this.dependencies = new List <BundleLoader>();
            if (dependencies == null || dependencies.Length == 0)
            {
                return;
            }

            for (int i = 0; i < dependencies.Length; i++)
            {
                var dependency = dependencies[i];
                if (!this.dependencies.Contains(dependency))
                {
                    dependency.Retain();
                    this.dependencies.Add(dependency);
                }
            }
        }
        public async Task Invoke(HttpContext context, ITaskStore taskStore, ITaskExecutor executor)
        {
            var action = context.GetRouteValueAs <string>("action");

            if (action == PollAction || action == RunAction)
            {
                if (!HttpMethods.IsPost(context.Request.Method))
                {
                    context.Response.StatusCode = StatusCodes.Status405MethodNotAllowed;
                    return;
                }

                if (!await _scheduler.VerifyAuthTokenAsync(context.Request.Headers[DefaultTaskScheduler.AuthTokenName]))
                {
                    context.Response.StatusCode = StatusCodes.Status401Unauthorized;
                    return;
                }

                var taskParameters = context.Request.Query.ToDictionary(x => x.Key, x => x.Value.ToString(), StringComparer.OrdinalIgnoreCase);

                if (action == RunAction)
                {
                    var taskId = context.GetRouteValueAs <int>("id", 0);
                    await Run(taskId, context, taskStore, executor, taskParameters);
                }
                else
                {
                    await Poll(context, taskStore, executor, taskParameters);
                }
            }
            else
            {
                await Noop(context);
            }
        }
 /// <summary>
 /// 初始化 <see cref="DefaultTaskRunner{T}"/> 类的新实例。
 /// </summary>
 /// <param name="serviceProvider"></param>
 /// <param name="delay">延迟时间。</param>
 /// <param name="period">执行触发间隔时间。</param>
 /// <param name="context">执行上下文对象。</param>
 public DefaultTaskRunner(TimeSpan delay, TimeSpan period, ITaskExecutor executor, TaskExecuteContext context)
 {
     _delay    = delay;
     _period   = period;
     _executor = executor;
     _context  = context;
 }
Beispiel #10
0
 public BundleManager(BundleManifest manifest, ILoaderBuilder builder, ITaskExecutor executor)
 {
     this.bundleManifest = manifest;
     this.loaderBuilder  = builder;
     this.executor       = executor != null ? executor : new PriorityTaskExecutor();
     this.loaders        = new Dictionary <string, BundleLoader>();
 }
Beispiel #11
0
        public TaskManager(Runner.SubtaskRunner runner, ITask[] tasks, Utils.Logger logger = null, Profiler.Timeline profiler = null)
        {
            this.runner = runner;

            //Create executors for all the tasks
            ITaskExecutor[] executors = new ITaskExecutor[tasks.Length];
            for (int i = 0; i < tasks.Length; i++)
            {
                executors[i] = tasks[i].CreateExecutor(runner, logger, profiler);
            }

            //Create a querier for querying all the executors for work
            querier = new TaskQuerier(runner, executors, logger, profiler);

            //Setup a chain between the executors, starting from the querier
            for (int i = 0; i < executors.Length; i++)
            {
                switch (i)
                {
                case 0: querier.Completed += executors[i].RunSubtasks;  break;

                default: executors[i - 1].Completed += executors[i].RunSubtasks; break;
                }
            }
            if (executors.Length > 0)
            {
                executors[executors.Length - 1].Completed += LastTaskCompleted;
            }
            else
            {
                querier.Completed += LastTaskCompleted;
            }
        }
Beispiel #12
0
 public TaskRunner(ITaskResetter taskResetter, ITaskQueuer taskQueuer, ITaskBuilder taskBuilder, ITaskExecutor taskExecutor)
 {
     _taskResetter = taskResetter;
     _taskQueuer = taskQueuer;
     _taskBuilder = taskBuilder;
     _taskExecutor = taskExecutor;
 }
 public PostService(IPostDataService postDataService, ILog logger, IUserContext userContext, ITaskExecutor taskExecutor)
 {
     this.postDataService = postDataService;
     this.logger          = logger;
     this.userContext     = userContext;
     this.taskExecutor    = taskExecutor;
 }
Beispiel #14
0
        public virtual async Task DeleteRoleDataAsync(string c2s_role_uuid, ITaskExecutor svc)
        {
            var snapMapping = new MappingReference <RoleSnap>(TYPE_ROLE_SNAP_DATA, c2s_role_uuid, svc);
            var roleSnap    = await snapMapping.LoadDataAsync();

            // TODO
        }
Beispiel #15
0
        public DeployModule(ITaskExecutor taskExecutor, IAsimovConfig config)
        {
            _taskExecutor = taskExecutor;

            Post["/deploy/deploy"] = _ =>
            {
                var command = this.Bind<DeployCommand>();
                var deployUnit = config.GetUnitByName(command.unitName);

                var packageSource = config.GetPackageSourceFor(deployUnit);
                var version = packageSource.GetVersion(command.versionId, deployUnit.PackageInfo);
                var deployTask = deployUnit.GetDeployTask(version, new ParameterValues(command.parameters));

                _taskExecutor.AddTask(deployTask);

                return "OK";
            };

            Post["/deploy/verify"] = _ =>
            {
                var command =  this.Bind<VerifyCommand>();
                var deployUnit = config.GetUnitByName(command.unitName);
                var verifyTask = deployUnit.GetVerifyTask();

                _taskExecutor.AddTask(verifyTask);

                return "OK";
            };
        }
Beispiel #16
0
		private ITaskExecutor ResolveTaskExecutor ( IQueuedTask queuedTask )
		{
			Type payloadType;
			ITaskExecutor taskExecutor = null;

			if ( ( payloadType = DetectTaskPayloadType( queuedTask ) ) != null )
			{
				mLogger.DebugFormat( "Runtime payload type {0} found for task type {1}.",
					payloadType,
					queuedTask.Type );

				taskExecutor = mExecutorRegistry
					.ResolveExecutor( payloadType );

				if ( taskExecutor != null )
					mLogger.DebugFormat( "Executor {0} found for task type {1}.",
						taskExecutor.GetType().FullName,
						queuedTask.Type );
				else
					mLogger.WarnFormat( "Executor not found for task type {0}.",
						queuedTask.Type );

			}
			else
				mLogger.WarnFormat( "Runtime payload type not found for task type {0}.",
					queuedTask.Type );

			return taskExecutor;
		}
        public void SetUp()
        {
            _lldbShell         = Substitute.For <ILLDBShell>();
            _breakpointManager = Substitute.For <IBreakpointManager>();
            _moduleFileLoader  = Substitute.For <IModuleFileLoader>();

            _debugger           = Substitute.For <SbDebugger>();
            _target             = Substitute.For <RemoteTarget>();
            _listenerSubscriber = Substitute.For <ILldbListenerSubscriber>();
            _process            = Substitute.For <SbProcess>();

            _debugEngineHandler = Substitute.For <IDebugEngineHandler>();
            _taskExecutor       = Substitute.For <ITaskExecutor>();
            _eventManager       = Substitute.For <IEventManager>();

            var exceptionManagerFactory =
                new LldbExceptionManager.Factory(new Dictionary <int, YetiCommon.Signal>());
            var exceptionManager = exceptionManagerFactory.Create(_process);

            _debugModuleCache = Substitute.For <IDebugModuleCache>();
            _debugProgram     = Substitute.For <IGgpDebugProgram>();

            _attachedProgram = new LldbAttachedProgram(
                _breakpointManager, _eventManager, _lldbShell, _moduleFileLoader,
                _debugEngineHandler, _taskExecutor, _debugProgram, _debugger, _target, _process,
                exceptionManager, _debugModuleCache, _listenerSubscriber, _remotePid);
        }
Beispiel #18
0
        public void Test_CanResolveExecutor_PayloadWithExecutor_WithDependencies()
        {
            ITaskExecutorRegistry taskExecutorRegistry =
                CreateTaskExecutorRegistry();

            taskExecutorRegistry.ScanAssemblies(GetType()
                                                .Assembly);

            ITaskExecutor nonGenericTaskExecutor = taskExecutorRegistry
                                                   .ResolveExecutor(typeof(AnotherSampleTaskPayload));

            ITaskExecutor <AnotherSampleTaskPayload> genericTaskExecutor = taskExecutorRegistry
                                                                           .ResolveExecutor <AnotherSampleTaskPayload>();

            Assert.NotNull(nonGenericTaskExecutor);
            Assert.AreEqual(typeof(AnotherSampleTaskPayloadExecutor),
                            nonGenericTaskExecutor.GetType());

            Assert.NotNull(genericTaskExecutor);
            Assert.AreEqual(typeof(AnotherSampleTaskPayloadExecutor),
                            genericTaskExecutor.GetType());

            AnotherSampleTaskPayloadExecutor asConcreteExecutor =
                genericTaskExecutor as AnotherSampleTaskPayloadExecutor;

            Assert.NotNull(asConcreteExecutor.SampleExecutorDependency);
        }
Beispiel #19
0
        public UnitActionModule(ITaskExecutor taskExecutor, IAsimovConfig config)
        {
            Post["/action"] = _ =>
            {
                var command    = this.Bind <UnitActionCommand>();
                var deployUnit = config.GetUnitByName(command.unitName);
                var action     = deployUnit.Actions[command.actionName];
                if (action == null)
                {
                    return(Response.AsJson(new
                    {
                        OK = false,
                        Message = $"No action found with name {command.actionName}.",
                        AvailableActions = deployUnit.Actions.Select(x => x.Name)
                    }, HttpStatusCode.BadRequest));
                }
                var asimovUser = new AsimovUser()
                {
                    UserId = command.userId, UserName = command.userName
                };

                var task = action.GetTask(deployUnit, asimovUser, command.correlationId);

                if (task != null)
                {
                    taskExecutor.AddTask(task);
                }

                return(Response.AsJson(new { OK = true }));
            };
        }
Beispiel #20
0
 public TaskRunner(ITaskResetter taskResetter, ITaskQueuer taskQueuer, ITaskBuilder taskBuilder, ITaskExecutor taskExecutor)
 {
     _taskResetter = taskResetter;
     _taskQueuer   = taskQueuer;
     _taskBuilder  = taskBuilder;
     _taskExecutor = taskExecutor;
 }
        /// <summary>
        /// Method <c>ProcessArgs</c> is used for processing arguments and executing corresponding functions specified in task1 of altex soft lab course.
        /// </summary>
        private void ProcessArgs(string[] args)
        {
            string path        = args.Length > 1 ? args[1] : "";
            string secondParam = args.Length > 2 ? args[2] : "";

            switch (args[0])
            {
            case "func1":
                taskExecutor = new FirstTaskFileExecutor(txtHolder);
                break;

            case "func2":
                taskExecutor = new SecondTaskFileExecutor(txtHolder);
                break;

            case "func3":
                taskExecutor = new ThirdTaskFileExecutor(txtHolder);
                break;

            case "func4":
                taskExecutor = new FourthTaskDirectoryExecutor();
                break;

            default:
                Console.WriteLine("There is no such function!");
                return;
            }
            taskExecutor.Execute(path, secondParam); // execute desired function
        }
        protected BaseDebugStackFrame(DebugDocumentContext.Factory debugDocumentContextFactory,
                                      IChildrenProviderFactory childrenProviderFactory,
                                      DebugCodeContext.Factory debugCodeContextFactory,
                                      CreateDebugExpressionDelegate createExpressionDelegate,
                                      IVariableInformationFactory varInfoFactory,
                                      IVariableInformationEnumFactory varInfoEnumFactory,
                                      AD7FrameInfoCreator ad7FrameInfoCreator,
                                      IRegisterSetsBuilder registerSetsBuilder,
                                      IDebugEngineHandler debugEngineHandler, RemoteFrame frame,
                                      IDebugThread2 thread, IGgpDebugProgram debugProgram,
                                      ITaskExecutor taskExecutor)
        {
            this.debugDocumentContextFactory = debugDocumentContextFactory;
            this._childrenProviderFactory    = childrenProviderFactory;
            this.debugCodeContextFactory     = debugCodeContextFactory;
            this.createExpressionDelegate    = createExpressionDelegate;
            this.varInfoFactory      = varInfoFactory;
            this.varInfoEnumFactory  = varInfoEnumFactory;
            this.ad7FrameInfoCreator = ad7FrameInfoCreator;
            this.registerSetsBuilder = registerSetsBuilder;
            this.debugEngineHandler  = debugEngineHandler;
            this.debugProgram        = debugProgram;
            lldbFrame          = frame;
            this.thread        = thread;
            this._taskExecutor = taskExecutor;

            documentContext = new Lazy <IDebugDocumentContext2>(() => CreateDocumentContext());
            codeContext     = new Lazy <IDebugCodeContext2>(() => CreateCodeContext());
        }
        /// <summary>
        /// Init constructor.
        /// </summary>
        public TaskAddedEventArgs(ITaskExecutor executor, ITask task)
            : base(executor, false)
        {
            if (task == null)
                throw new ArgumentNullException("task");

            Task = task;
        }
        VariableInformationEnum(ITaskExecutor taskExecutor,
                                IChildrenProvider childrenProvider)
        {
            _taskExecutor     = taskExecutor;
            _childrenProvider = childrenProvider;

            _childOffset = 0;
        }
Beispiel #25
0
        public void setup___pipeline_processing___Dataflow___batched___parallel___no_Interlock()
        {
            _executor = new TaskExecutorBuilder()
                        .RegisterDataflowExecution()
                        .Build();

            _task = GetPipelineTask_Batched_Parallel_NoInterlock();
        }
        /// <summary>
        /// Init constructor.
        /// </summary>
        public TaskExecutorEventArgs(ITaskExecutor executor, bool closing)
        {
            if (executor == null)
                throw new ArgumentNullException("executor");

            Executor = executor;
            Closing = closing;
        }
Beispiel #27
0
        public void setup___pipeline_processing___Dataflow___batched___parallel()
        {
            _executor = new TaskExecutorBuilder()
                        .UseDataflowPipelineExecution()
                        .Build();

            _task = GetPipelineTask_Batched(true);
        }
Beispiel #28
0
        public void setup___pipeline_processing___Dataflow___not_batched___not_parallel()
        {
            _executor = new TaskExecutorBuilder()
                        .RegisterDataflowExecution()
                        .Build();

            _task = GetPipelineTask_NotBatched(false);
        }
Beispiel #29
0
 private DebugAsyncExpression(IDebugEngineHandler debugEngineHandler,
                              IAsyncExpressionEvaluator asyncEvaluator, ITaskExecutor taskExecutor,
                              IGgpDebugProgram program, IDebugThread2 thread) :
     base(debugEngineHandler, asyncEvaluator, taskExecutor, program, thread)
 {
     this.asyncEvaluator = asyncEvaluator;
     this.taskExecutor   = taskExecutor;
 }
Beispiel #30
0
 DebugProperty(ITaskExecutor taskExecutor, IChildrenProviderFactory childrenProviderFactory,
               IVariableInformationEnumFactory varInfoEnumFactory,
               IVariableInformation varInfo, DebugCodeContext.Factory codeContextFactory,
               VsExpressionCreator vsExpressionCreator) : base(
         taskExecutor, childrenProviderFactory, varInfoEnumFactory, varInfo, codeContextFactory,
         vsExpressionCreator)
 {
 }
Beispiel #31
0
 public AsyncEvaluateExpressionOperation(
     IAsyncDebugEvaluateCompletionHandler completionHandler,
     IAsyncExpressionEvaluator asyncEvaluator, ITaskExecutor taskExecutor)
 {
     _completionHandler = completionHandler;
     _asyncEvaluator    = asyncEvaluator;
     _taskExecutor      = taskExecutor;
 }
Beispiel #32
0
        public void SetUp()
        {
            _completionHandler = Substitute.For <IAsyncDebugEvaluateCompletionHandler>();
            _asyncEvaluator    = Substitute.For <IAsyncExpressionEvaluator>();
            _taskExecutor      = Substitute.For <ITaskExecutor>();

            _evaluateOp = new AsyncEvaluateExpressionOperation(_completionHandler,
                                                               _asyncEvaluator, _taskExecutor);
        }
Beispiel #33
0
        public RateLimitedExecutor(ITaskExecutor executor, IClock clock, IEnumerable <Action> toQuery = null)
        {
            this.executor = executor ?? throw new ArgumentNullException(nameof(executor));
            this.clock    = clock ?? throw new ArgumentNullException(nameof(clock));

            toExecutes    = new Queue <Action>(toQuery ?? ArraySegment <Action> .Empty);
            clock.OnTick += ClockOnTick;
            clock.Start();
        }
Beispiel #34
0
 public QueuedTaskRunner(ITaskQueuer taskQueuer, ITaskBuilder taskBuilder, ITaskExecutor taskExecutor,
                         ISession session, ITriggerUrls triggerUrls)
 {
     _taskQueuer   = taskQueuer;
     _taskBuilder  = taskBuilder;
     _taskExecutor = taskExecutor;
     _session      = session;
     _triggerUrls  = triggerUrls;
 }
Beispiel #35
0
 public void SetUp()
 {
     _completionHandler = Substitute.For <IAsyncDebugGetPropertiesCompletionHandler>();
     _childrenProvider  = Substitute.For <IChildrenProvider>();
     _taskExecutor      = Substitute.ForPartsOf <FakeTaskExecutor>();
     _getPropertiesOp   = new AsyncGetPropertiesOperation(_taskExecutor, _completionHandler,
                                                          _childrenProvider, _fromIndex,
                                                          _count);
 }
 public LoadBalancerModule(ITaskExecutor taskExecutor, ILoadBalancerService loadBalancerService)
 {
     Post["/loadbalancer/change"] = _ =>
     {
         var command = this.Bind<ChangeLoadBalancerStateCommand>();
         taskExecutor.AddTask(new ChangeLoadBalancerStateTask(command, loadBalancerService, new NodeFront()));
         return "OK";
     };
 }
        public TaskSchedulerController(
			ITaskScheduler taskScheduler,
            IScheduleTaskService scheduledTaskService,
            ITaskExecutor taskExecutor,
            ICommonServices services)
        {
            this._taskScheduler = taskScheduler;
            this._scheduledTaskService = scheduledTaskService;
            this._taskExecutor = taskExecutor;
            this._services = services;
        }
        /// <summary>
        /// Init constructor.
        /// </summary>
        public TaskExceptionedEventArgs(ITaskExecutor executor, ITask task, Exception ex)
            : base(executor, false)
        {
            if (task == null)
                throw new ArgumentNullException("task");
            if (ex == null)
                throw new ArgumentNullException("ex");

            Task = task;
            Exception = ex;
        }
        public DeployModule(ITaskExecutor taskExecutor, IAsimovConfig config)
        {
            Post["/deploy/deploy"] = _ =>
            {
                var command = this.Bind<DeployCommand>();
                var deployUnit = config.GetUnitByName(command.unitName);
                var user = new AsimovUser() { UserId = command.userId, UserName = command.userName };

                var packageSource = config.GetPackageSourceFor(deployUnit);
                var version = packageSource.GetVersion(command.versionId, deployUnit.PackageInfo);
                var deployTask = deployUnit.GetDeployTask(version, new ParameterValues(command.parameters), user);

                taskExecutor.AddTask(deployTask);

                return Response.AsJson(new { OK = true });
            };
        }
        public UnitActionModule(ITaskExecutor taskExecutor, IAsimovConfig config)
        {
            Post["/action"] = _ =>
            {
                var command = this.Bind<UnitActionCommand>();
                var deployUnit = config.GetUnitByName(command.unitName);
                var action = deployUnit.Actions[command.actionName];
                var asimovUser = new AsimovUser() {UserId = command.userId, UserName = command.userName};

                var task = action.GetTask(deployUnit,asimovUser, command.correlationId);

                if(task != null)
                    taskExecutor.AddTask(task);

                return Response.AsJson(new { OK = true });
            };
        }
 /// <summary>
 /// Sets the task executor.
 /// </summary>
 /// <param name="taskExecutor">the task executor</param>
 /// <returns>the current step builder</returns>
 public PartitionStepBuilder TaskExecutor(ITaskExecutor taskExecutor)
 {
     _taskExecutor = taskExecutor;
     return this;
 }
Beispiel #42
0
 public UiActions(IKernel kernel, ITaskManager taskManager, ITaskExecutor taskExecutor, IScheduledTaskManager scheduledTaskManager)
     : base(kernel, taskManager, taskExecutor, scheduledTaskManager)
 {
 }
Beispiel #43
0
 /// <summary>
 /// Execute specified action.
 /// </summary>
 public override void Execute(ITaskExecutor executionQueue)
 {
     _action(executionQueue);
 }
        /// <summary>
        /// Invoked by an <see cref="Spring.Objects.Factory.IObjectFactory"/>
        /// after it has injected all of an object's dependencies.
        /// </summary>
        /// <remarks>
        /// 	<p>
        /// This method allows the object instance to perform the kind of
        /// initialization only possible when all of it's dependencies have
        /// been injected (set), and to throw an appropriate exception in the
        /// event of misconfiguration.
        /// </p>
        /// 	<p>
        /// Please do consult the class level documentation for the
        /// <see cref="Spring.Objects.Factory.IObjectFactory"/> interface for a
        /// description of exactly <i>when</i> this method is invoked. In
        /// particular, it is worth noting that the
        /// <see cref="Spring.Objects.Factory.IObjectFactoryAware"/>
        /// and <see cref="Spring.Context.IApplicationContextAware"/>
        /// callbacks will have been invoked <i>prior</i> to this method being
        /// called.
        /// </p>
        /// </remarks>
        /// <exception cref="System.Exception">
        /// In the event of misconfiguration (such as the failure to set a
        /// required property) or if initialization fails.
        /// </exception>
        public virtual void AfterPropertiesSet()
        {
            // Create SchedulerFactory instance.
            #if QUARTZ_2_0
            ISchedulerFactory schedulerFactory = ObjectUtils.InstantiateType<ISchedulerFactory>(schedulerFactoryType);
            #else
            ISchedulerFactory schedulerFactory = (ISchedulerFactory) ObjectUtils.InstantiateType(schedulerFactoryType);
            #endif

            InitSchedulerFactory(schedulerFactory);

            if (taskExecutor != null)
            {
                // Make given TaskExecutor available for SchedulerFactory configuration.
                configTimeTaskExecutor = taskExecutor;
            }
            if (dbProvider != null)
            {
                // Make given db provider available for SchedulerFactory configuration.
                configTimeDbProvider = dbProvider;
            }

            try
            {
                // Get Scheduler instance from SchedulerFactory.
                scheduler = CreateScheduler(schedulerFactory, schedulerName);
                PopulateSchedulerContext();

                if (!jobFactorySet && !(scheduler is RemoteScheduler))
                {
             	 	            // Use AdaptableJobFactory as default for a local Scheduler, unless when
             	 	            // explicitly given a null value through the "jobFactory" object property.
             	 	            jobFactory = new AdaptableJobFactory();
             	 	        }

                if (jobFactory != null)
                {
                    if (jobFactory is ISchedulerContextAware)
                    {
                        ((ISchedulerContextAware) jobFactory).SchedulerContext = scheduler.Context;
                    }
                    scheduler.JobFactory = jobFactory;
                }
            }
            finally
            {
                if (taskExecutor != null)
                {
                    configTimeTaskExecutor = null;
                }
                if (dbProvider != null)
                {
                    configTimeDbProvider = null;
                }
            }

            RegisterListeners();
            RegisterJobsAndTriggers();
        }
 public override void ExtraSetup()
 {
     _taskManager = MasterResolve<ITaskManager>();
     _target = MasterResolve<ITaskExecutor>();
 }
 /// <summary>
 /// Sets the task executor.
 /// </summary>
 /// <param name="taskExecutor">the task executor</param>
 /// <returns>the current step builder</returns>
 public AbstractTaskletStepBuilder TaskExecutor(ITaskExecutor taskExecutor)
 {
     _taskExecutor = taskExecutor;
     return this;
 }
	    /// <summary>
        /// Called by the QuartzScheduler before the <see cref="T:System.Threading.ThreadPool"/> is
        /// used, in order to give the it a chance to Initialize.
        /// </summary>
		public virtual void Initialize()
		{
			// Absolutely needs thread-bound TaskExecutor to Initialize.
			taskExecutor = SchedulerFactoryObject.ConfigTimeTaskExecutor;
			if (taskExecutor == null)
			{
				throw new SchedulerConfigException("No local TaskExecutor found for configuration - " +
				                                   "'taskExecutor' property must be set on SchedulerFactoryObject");
			}
		}
Beispiel #48
0
 public StartTaskExecutionJob(ITaskExecutor taskExecutor)
 {
     _taskExecutor = taskExecutor;
 }
 /// <summary>
 /// Method called when given task should perform it's task.
 /// </summary>
 public abstract void Execute(ITaskExecutor executionQueue);
 public TaskRunner(ITaskExecutor taskExecutor)
 {
     _taskExecutor = taskExecutor;
 }
Beispiel #51
0
 /// <summary>
 /// Splits, using the given task executor.
 /// </summary>
 /// <param name="executor"></param>
 /// <returns></returns>
 public JobFlowBuilder.SplitBuilder Split(ITaskExecutor executor)
 {
     foreach (IStep step in _steps)
     {
         if (_builder == null)
         {
             _builder = new JobFlowBuilder(new FlowJobBuilder(this), step);
         }
         else
         {
             _builder.Next(step);
         }
     }
     if (_builder == null)
     {
         _builder = new JobFlowBuilder(new FlowJobBuilder(this));
     }
     return _builder.Split(executor);
 }