Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2924_DotNetCoreMigration/HeuristicLab.PluginInfrastructure/3.3/Interfaces/IRunnerHost.cs @ 17013

Last change on this file since 17013 was 17013, checked in by dpiringe, 5 years ago

#2924:

  • some changes in CLIApplication.cs to reduce unnecessary allocation of string objects
  • renamed AppTest to ConsoleOptimizer and fixed race condition
  • replaced enum RunnerJob with class RunnerMessage for more control of saved data
  • changed usage of BinaryFormatter with HEAL.Attic, following types are now Storable:
    • ConsoleOptimizer
    • InspectApplication
    • ApplicationBase
    • ApplicationRunner
    • AssemblyInfo
    • Runner
    • UniPath
    • RunnerMessage
  • switched QuietMode from ApplicationRunner to IRunner
  • DockerRunnerHost can now automatically build docker images for linux and windows containers (also identifies which container type is active) -> removes the condition to have the image preinstalled
    • to achieve this, there are two new folders DockerLinuxBuild and DockerWindowsBuild included in build output, which include Dockerfiles to build images for linux and windows container
  • added NuGet package System.CodeDom to project HeuristicLab.Scripting-3.3
  • added method Send(RunnerMessage) to IRunnerHost and transferred methods Pause and Resume to IRunner
  • added internal reference of RunnerHost in Runner
  • added abstract method SendMessage(RunnerMessage) in RunnerHost which gets called from method Send(RunnerMessage)
  • because of a Google.Protobuf "bug", RunnerMessages cannot get serialized/deserialized directly on stream -> workaround with a byte array, which gets written and read
    • additionally, the length of the array gets sent first (length as integer -> 4 bytes)
    • static method in RunnerMessage to read a message from a stream
    • the method SendMessage(RunnerMessage) in RunnerHost implements this functionality
File size: 1.3 KB
RevLine 
[16985]1using System.Threading;
2using System.Threading.Tasks;
3
4namespace HeuristicLab.PluginInfrastructure {
5
6  /// <summary>
7  /// Interface for all runner implementations.
8  /// </summary>
9  public interface IRunnerHost {
[16993]10    /// <summary>
11    /// The runner state.
12    /// </summary>
13    RunnerState State { get; }
[16985]14
15    /// <summary>
[17013]16    /// Set this to true, if console output should be disabled.
17    /// </summary>
18    bool QuietMode { get; set; }
19
20    /// <summary>
[16985]21    /// Method to run the runner. This method is blocking.
22    /// </summary>
23    /// <param name="runner">A instance of an IRunner.</param>
24    void Run(IRunner runner);
25
26    /// <summary>
27    /// Method to run the runner async. A CencellationToken can be specified.
28    /// </summary>
29    /// <param name="runner">A instance of an IRunner</param>
30    /// <param name="token">The CancellationToken obtained from an CancellationTokenSource.</param>
31    /// <returns>The task in which the process runs.</returns>
32    Task RunAsync(IRunner runner, CancellationToken? token = null);
33
34    /// <summary>
[17013]35    /// Method to send messages to the runner, which runs in child process.
[16985]36    /// </summary>
[17013]37    /// <param name="runnerMessage">A object from a derived class of RunnerMessage.</param>
38    void Send(RunnerMessage runnerMessage);
[16985]39  }
40}
Note: See TracBrowser for help on using the repository browser.