コード例 #1
0
ファイル: AssemblyLoader.cs プロジェクト: kapitanov/diploma
        public AssemblyLoader(IRepository repository, Task task)
        {
            if (repository == null)
                throw new ArgumentNullException("repository");
            if (task == null)
                throw new ArgumentNullException("task");

            this.repository = repository;
            this.task = task;

            LoadCodebase();
        }
コード例 #2
0
 /// <summary>
 /// Initializes new instance of <see cref="TaskRejectedException"/> class.
 /// </summary>
 /// <param name="message">
 /// Error message.
 /// </param>
 /// <param name="task">
 /// An instance of <see cref="Shared.Classes.Task"/> that caused this exception.
 /// </param>
 /// <param name="inner">
 /// Exception that causes this exception.
 /// </param>
 public TaskRejectedException(string message, Task task, Exception inner)
     : base(message, inner)
 {
     Task = task;
 }
コード例 #3
0
 /// <summary>
 /// Initializes new instance of <see cref="TaskRejectedException"/> class.
 /// </summary>
 /// <param name="message">
 /// Error message.
 /// </param>
 /// <param name="task">
 /// An instance of <see cref="Shared.Classes.Task"/> that caused this exception. 
 /// </param>
 public TaskRejectedException(string message, Task task)
     : base(message)
 {
     Task = task;
 }
コード例 #4
0
        /// <summary>
        /// Converts an instance of <see cref="DataModel.Task"/> 
        /// into an instance of <see cref="Task"/>
        /// </summary>
        /// <param name="task">
        /// An instance of <see cref="DataModel.Task"/>.
        /// </param>
        /// <returns>
        /// An instance of <see cref="Task"/> equalent to <paramref name="task"/> 
        /// </returns>
        public static Task ToContract(this DataModel.Task task)
        {
            Contract.Requires(task != null);
            Contract.Requires(task.InputFiles != null);
            Contract.Requires(task.OutputFiles != null);
            Contract.Requires(task.EntryPoint != null);
            Contract.Requires(task.EntryPoint.DependentAssemblyIds != null);
            Contract.Requires(!string.IsNullOrEmpty(task.EntryPoint.QualifiedClassName));
            Contract.Requires(task.Inputs != null);
            Contract.Requires(task.Outputs != null);
            Contract.Requires(task.Parameters != null);
            Contract.Ensures(Contract.Result<Task>() != null);

            var r = new Task
                       {
                           Id = task.Id,
                           Name = task.Name,
                           EntryPoint = task.EntryPoint.ToContract(),
                           InputFiles = task.InputFiles.Select(file => file.ToContract()).ToList(),
                           OutputFiles = task.OutputFiles.Select(file => file.ToContract()).ToList(),
                           Inputs = task.Inputs.Select(t => t.ToFlatContract()).ToList(),
                           Outputs = task.Outputs.Select(t => t.ToFlatContract()).ToList(),
                           Parameters = new Dictionary<string, string>(task.Parameters)
                       };

            return r;
        }
コード例 #5
0
 /// <summary>
 /// Initializes new instance of <see cref="TaskFailedException"/> class.
 /// </summary>
 /// <param name="message">
 /// Error message.
 /// </param>
 /// <param name="task">
 /// An instance of <see cref="Shared.Classes.Task"/> that caused this exception. 
 /// </param>
 public TaskFailedException(string message, Task task)
     : base(message)
 {
     Task = task;
 }
コード例 #6
0
 /// <summary>
 /// Builds view that accords to "processing task" state.
 /// </summary>
 /// <param name="status">
 /// A <see cref="string"/> that contains status message.
 /// </param>
 /// <param name="task">
 /// An instance of <see cref="Task"/> that is being currently processing.
 /// </param>
 /// <returns>
 /// A <see cref="Stream"/> that contains the builded view.
 /// </returns>
 public Stream BuildTaskView(string status, Task task)
 {
     throw new NotImplementedException();
 }
コード例 #7
0
ファイル: SandboxEngine.cs プロジェクト: kapitanov/diploma
        /// <summary>
        /// Executes the task.
        /// </summary>
        /// <param name="task">
        /// An instance of <see cref="AISTek.DataFlow.Shared.Classes.Task"/> that must be executed.
        /// </param>
        /// <exception cref="TaskRejectedException">
        /// Occurs if there's not enough system resources to execute specified task efficiently.
        /// </exception> 
        /// <exception cref="TaskFailedException">
        /// Occurs when execution engine fails to execute the specified task.
        /// </exception> 
        public void ExecuteTask(Task task)
        {
            // Make sure that any instance of engine will execute only one task at one time.
            lock (synchRoot)
            {
                currentTask = task;

                try
                {
                    using (Perfomance.Trace("SandboxEngine::ExecuteTask()").BindToTrace())
                    {
                        CreateSandbox();
                        RunTask();
                        FreeSandbox();
                    }
                }
                catch (UnableToLoadTaskException e)
                {
                    throw new TaskExecutionFailureException(
                        string.Format("Unable to execute the task {0}: unable to load task's code.", currentTask),
                        e);
                }
                catch (TaskFailedException)
                {
                    throw;
                }
                catch (TaskRejectedException)
                {
                    throw;
                }
            }
        }
コード例 #8
0
ファイル: SandboxEngine.cs プロジェクト: kapitanov/diploma
        private void FreeSandbox()
        {
            Contract.Requires(sandbox != null);
            Contract.Requires(currentTask != null);
            using (Perfomance.Trace("SandboxEngine::FreeSandbox()").BindToTrace())
            {

                var disposable = sandbox as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }

                AppDomain.Unload(sandboxDomain);
                currentTask = null;
            }
        }
コード例 #9
0
ファイル: GeneralEngine.cs プロジェクト: kapitanov/diploma
 private void Free()
 {
     using (Perfomance.Trace("GeneralEngine::Free()").BindToTrace())
     {
         taskInstance.Teardown();
         taskInstance = null;
         currentTask = null;
     }
 }
コード例 #10
0
ファイル: ErrorReport.cs プロジェクト: kapitanov/diploma
 /// <summary>
 /// Initializes new instance of <see cref="ErrorReport"/> class.
 /// </summary>
 /// <param name="task">
 /// An instance of <see cref="Task"/> that caused current exception.
 /// </param>
 /// <param name="exception">
 /// An instance of <see cref="Exception"/> class that caused current error.
 /// </param>
 /// <param name="source">
 /// An <see cref="ErrorSource"/> that caused current error.
 /// </param>
 public ErrorReport(Task task, Exception exception, ErrorSource source)
 {
     Task = task;
     Error = new Error(exception);
     Source = source;
 }
コード例 #11
0
ファイル: ErrorReport.cs プロジェクト: kapitanov/diploma
 /// <summary>
 /// Initializes new instance of <see cref="ErrorReport"/> class.
 /// </summary>
 public ErrorReport()
 {
     Task = new Task();
     Source = ErrorSource.Unknown;
     Error = new Error();
 }
コード例 #12
0
        /// <summary>
        /// Executes the task.
        /// </summary>
        /// <param name="task">
        /// An instance of <see cref="Task"/> that must be executed.
        /// </param>
        /// <exception cref="TaskRejectedException">
        /// Occurs if there's not enogh system resources to execute specified task efficiently.
        /// </exception> 
        /// <exception cref="TaskFailedException">
        /// Occurs when execution engine fails to execute the specified task.
        /// </exception> 
        public void ExecuteTask(Task task)
        {
            Contract.Requires(task != null);

            throw new NotImplementedException();
        }