Changeset 18035


Ignore:
Timestamp:
07/27/21 17:27:45 (11 months ago)
Author:
swagner
Message:

#3026: Added solutions for headless HeuristicLab

Location:
branches/3026_IntegrationIntoSymSpace
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface

    • Property svn:ignore set to
      Plugin.cs
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.App

    • Property svn:ignore set to
      Plugin.cs
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration

    • Property svn:ignore set to
      Plugin.cs
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.PluginInfrastructure/3.3/Main.cs

    r17180 r18035  
    2121
    2222using System;
     23using System.IO;
     24using System.Linq;
    2325using System.Windows.Forms;
     26using HeuristicLab.PluginInfrastructure.Manager;
    2427using HeuristicLab.PluginInfrastructure.Starter;
    2528
     
    5053      }
    5154    }
     55
     56    public static void HeadlessRun(string[] args) {
     57      string pluginPath = Path.GetFullPath(Application.StartupPath);
     58      var pluginManager = new PluginManager(pluginPath);
     59      pluginManager.DiscoverAndCheckPlugins();
     60
     61      var arguments = CommandLineArgumentHandling.GetArguments(args);
     62      foreach (var argument in arguments) {
     63        if (argument is StartArgument) {
     64          var arg = (StartArgument)argument;
     65          var appDesc = (from desc in pluginManager.Applications
     66                         where desc.Name.Equals(arg.Value)
     67                         select desc).SingleOrDefault();
     68          if (appDesc != null) {
     69            try {
     70              pluginManager.Run(appDesc, arguments);
     71            } catch (Exception e) {
     72              Console.WriteLine(e.Message);
     73            }
     74          }
     75        }
     76      }
     77    }
    5278  }
    5379}
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab/3.3/Program.cs

    r17180 r18035  
    2626    [STAThread]
    2727    static void Main(string[] args) {
    28       HeuristicLab.PluginInfrastructure.Main.Run(args);
     28      if ((args.Length >= 1) && (args[0] == "/start:JsonInterface")) {
     29        HeuristicLab.PluginInfrastructure.Main.HeadlessRun(args);
     30      } else {
     31        HeuristicLab.PluginInfrastructure.Main.Run(args);
     32      }
    2933    }
    3034  }
Note: See TracChangeset for help on using the changeset viewer.