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.4 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using HEAL.Attic;
|
---|
3 | using HeuristicLab.Common;
|
---|
4 | using HeuristicLab.Core;
|
---|
5 | using HeuristicLab.Optimization;
|
---|
6 | using HeuristicLab.PluginInfrastructure;
|
---|
7 |
|
---|
8 | namespace HeuristicLab.DynamicAssemblyTestApp {
|
---|
9 | [StorableType("61621E70-8A67-43A2-8EB2-233FC01E493B")]
|
---|
10 | [Application("CLIInspect", "")]
|
---|
11 | public class InspectApplication : ApplicationBase {
|
---|
12 | [Storable]
|
---|
13 | public UniPath InputFilePath { get; set; }
|
---|
14 |
|
---|
15 | public InspectApplication() { }
|
---|
16 |
|
---|
17 | public InspectApplication(UniPath inputFilePath) {
|
---|
18 | InputFilePath = inputFilePath;
|
---|
19 | }
|
---|
20 |
|
---|
21 | public override void Run(ICommandLineArgument[] args) {
|
---|
22 | ContentManager.Initialize(new PersistenceContentManager());
|
---|
23 | IStorableContent content = ContentManager.Load(InputFilePath.ToString());
|
---|
24 | IOptimizer optimizer = content as IOptimizer;
|
---|
25 | if (content != null) {
|
---|
26 | Console.WriteLine($"Name: {optimizer.Name}");
|
---|
27 | Console.WriteLine($"Description: {optimizer.Description}");
|
---|
28 | Console.WriteLine($"Run count: {optimizer.Runs.Count}");
|
---|
29 | Console.WriteLine("\nRESULT(S):");
|
---|
30 | int i = 1;
|
---|
31 | foreach (var run in optimizer.Runs) {
|
---|
32 | Console.WriteLine($"{"-------------------------------- RUN",35} {$"{i++:D3}" + " --------------------------------",-35}");
|
---|
33 | foreach (var res in run.Results) {
|
---|
34 | Console.WriteLine($"{res.Key,35} : {res.Value,-35}");
|
---|
35 | }
|
---|
36 | }
|
---|
37 | }
|
---|
38 | }
|
---|
39 | }
|
---|
40 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.