Changeset 8958


Ignore:
Timestamp:
11/28/12 10:02:01 (10 years ago)
Author:
fschoepp
Message:

#1888:

  • Added a administrator web interface for job management
  • Fixed Hive Client (PluginValidator) to find the assemblies within the right directories
  • Reorganized controller classes (Folders HL, Interfaces, Azure)
  • You may now successfully schedule and run jobs with the web ui.
Location:
branches/OaaS
Files:
14 added
5 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • branches/OaaS/HeuristicLab.Clients.Hive.JobManager/3.3/HeuristicLab.Clients.Hive.JobManager-3.3.csproj

    r7910 r8958  
    8282  </PropertyGroup>
    8383  <ItemGroup>
     84    <Reference Include="HeuristicLab.Analysis-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     85    <Reference Include="HeuristicLab.Visualization.ChartControlsExtensions-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
    8486    <Reference Include="System" />
    8587    <Reference Include="System.Configuration" />
     
    149151  </ItemGroup>
    150152  <ItemGroup>
     153    <ProjectReference Include="..\..\HeuristicLab.Analysis.Views\3.3\HeuristicLab.Analysis.Views-3.3.csproj">
     154      <Project>{76945D76-CA61-4147-9DC2-0ACDCDDF87F9}</Project>
     155      <Name>HeuristicLab.Analysis.Views-3.3</Name>
     156    </ProjectReference>
    151157    <ProjectReference Include="..\..\HeuristicLab.Clients.Hive.Views\3.3\HeuristicLab.Clients.Hive.Views-3.3.csproj">
    152158      <Project>{E1D6C801-892A-406A-B606-F158E36DD3C3}</Project>
     
    224230      <Private>False</Private>
    225231    </ProjectReference>
     232  </ItemGroup>
     233  <ItemGroup>
     234    <EmbeddedResource Include="Views\RefreshableHiveJobView.resx">
     235      <DependentUpon>RefreshableHiveJobView.cs</DependentUpon>
     236    </EmbeddedResource>
    226237  </ItemGroup>
    227238  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • branches/OaaS/HeuristicLab.Clients.Hive.Slave/3.3/HeuristicLab.Clients.Hive.Slave-3.3.csproj

    r8242 r8958  
    167167    <Compile Include="TraceCom.cs" />
    168168    <Compile Include="WcfService.cs" />
    169     <None Include="app.config" />
     169    <None Include="app.config">
     170      <SubType>Designer</SubType>
     171    </None>
    170172    <None Include="Plugin.cs.frame" />
    171173    <Compile Include="Plugin.cs" />
  • branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/Manager/PluginValidator.cs

    r8200 r8958  
    488488    }
    489489
     490    private string AssemblyDirectory(Assembly assem) {
     491      string codeBase = assem.CodeBase;
     492      UriBuilder uri = new UriBuilder(codeBase);
     493      string path = Uri.UnescapeDataString(uri.Path);
     494      return Path.GetFullPath(path);     
     495    }
     496
    490497
    491498    private bool IsAnyDependencyDisabled(PluginDescription descr, List<PluginDescription> disabledPlugins) {
     
    512519            try {
    513520              string assemblyName = (from assembly in AppDomain.CurrentDomain.ReflectionOnlyGetAssemblies()
    514                                      where string.Equals(Path.GetFullPath(assembly.Location), Path.GetFullPath(assemblyLocation), StringComparison.CurrentCultureIgnoreCase)
     521                                     where string.Equals(Path.GetFullPath(assembly.Location), Path.GetFullPath(assemblyLocation), StringComparison.CurrentCultureIgnoreCase) ||
     522                                           string.Equals(AssemblyDirectory(assembly), Path.GetFullPath(assemblyLocation), StringComparison.CurrentCultureIgnoreCase)
    515523                                     select assembly.FullName).Single();
    516524              // now load the assemblies into the execution context 
  • branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/WebApplicationManager.cs

    r8506 r8958  
    8888    }
    8989
     90    static private string AssemblyDirectory {
     91      get {
     92        string codeBase = Assembly.GetExecutingAssembly().CodeBase;
     93        UriBuilder uri = new UriBuilder(codeBase);
     94        string path = Uri.UnescapeDataString(uri.Path);
     95        return Path.GetDirectoryName(path);
     96      }
     97    }
    9098    // find all types implementing IPlugin in the reflectionOnlyAssemblies and create a list of plugin descriptions
    9199    // the dependencies in the plugin descriptions are not yet set correctly because we need to create
     
    93101    private List<PluginDescription> GatherPluginDescriptions()
    94102    {
    95       List<PluginDescription> pluginDescriptions = new List<PluginDescription>();
    96       foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
     103      /*List<PluginDescription> pluginDescriptions = new List<PluginDescription>();
     104
     105      // load all assemblies that are available in the project folders
     106      var loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies().ToList();
     107      IList<string> loadedPaths = new List<string>();
     108      foreach (var asm in loadedAssemblies) {
     109        try {
     110          loadedPaths.Add(asm.Location);
     111        }
     112        catch (Exception ex) {
     113        }
     114      }*/
     115      /*var assembliePaths = from location in loadedAssemblies                           
     116                           select location.Location;
     117
     118      var loadedPaths = loadedAssemblies.Select(a => a.Location).ToArray();*/
     119      var pv = new PluginValidator() { PluginDir = AssemblyDirectory };
     120      pv.DiscoverAndCheckPlugins();
     121      return pv.Plugins.ToList();
     122      /*var pluginManager = new PluginManager(AssemblyDirectory);
     123      pluginManager.DiscoverAndCheckPlugins();
     124      return pluginManager.Plugins.ToList();*/
     125
     126      /*var referencedPaths = Directory.GetFiles(AssemblyDirectory, "*.dll");
     127      var toLoad = referencedPaths.Where(r => !loadedPaths.Contains(r, StringComparer.InvariantCultureIgnoreCase)).ToList();
     128      toLoad.ForEach(path => loadedAssemblies.Add(AppDomain.CurrentDomain.Load(AssemblyName.GetAssemblyName(path))));
     129     
     130      foreach (Assembly assembly in loadedAssemblies)
    97131      {
    98132        // GetExportedTypes throws FileNotFoundException when a referenced assembly
     
    106140                                           where !t.IsAbstract && t.GetInterfaces().Any(x => x.AssemblyQualifiedName == typeof(IPlugin).AssemblyQualifiedName)
    107141                                           select GetPluginDescription(t);
     142
     143          // TODO: Also load all plugin descriptors from assemblies liying in the app domain folder!!!!!
    108144          pluginDescriptions.AddRange(assemblyPluginDescriptions);
    109145        }
     
    122158        }
    123159      }
    124       return pluginDescriptions;
     160      return pluginDescriptions;*/
    125161    }
    126162
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/HeuristicLab.Services.Optimization.ControllerService.csproj

    r8817 r8958  
    130130      <HintPath>..\bin\HeuristicLab.Tracing-3.3.dll</HintPath>
    131131    </Reference>
     132    <Reference Include="Microsoft.WindowsAzure.CloudDrive, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
     133    <Reference Include="Microsoft.WindowsAzure.Configuration, Version=1.7.0.0, Culture=neutral, processorArchitecture=MSIL" />
     134    <Reference Include="Microsoft.WindowsAzure.Diagnostics, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
     135    <Reference Include="Microsoft.WindowsAzure.ServiceRuntime, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
     136    <Reference Include="Microsoft.WindowsAzure.StorageClient, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
    132137    <Reference Include="System" />
    133138    <Reference Include="System.configuration" />
    134139    <Reference Include="System.Core" />
     140    <Reference Include="System.Data.Services.Client" />
    135141    <Reference Include="System.Runtime.Serialization" />
    136142    <Reference Include="System.ServiceModel" />
     
    142148  </ItemGroup>
    143149  <ItemGroup>
    144     <Compile Include="HiveScenarioManagerOld.cs" />
    145     <Compile Include="HiveMapper.cs" />
    146     <Compile Include="HiveScenarioManager.cs" />
    147     <Compile Include="HLMapper.cs" />
     150    <Compile Include="Azure\DAL.cs" />
     151    <Compile Include="HL\HiveScenarioManagerOld.cs" />
     152    <Compile Include="HL\HiveMapper.cs" />
     153    <Compile Include="HL\HiveScenarioManager.cs" />
     154    <Compile Include="HL\HLMapper.cs" />
    148155    <Compile Include="Interfaces\IControllerService.cs" />
     156    <Compile Include="Interfaces\DAL.cs" />
    149157    <Compile Include="Interfaces\IScenarioManager.cs" />
    150158    <Compile Include="Model\ControllerModel.cs" />
    151159    <Compile Include="PlaceholderControllerService.cs" />
    152160    <Compile Include="Properties\AssemblyInfo.cs" />
    153     <Compile Include="ScenarioParser.cs" />
     161    <Compile Include="HL\ScenarioParser.cs" />
    154162    <Compile Include="Utility.cs" />
    155163  </ItemGroup>
     
    157165    <WCFMetadata Include="Service References\" />
    158166  </ItemGroup>
     167  <ItemGroup />
    159168  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    160169  <PropertyGroup>
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/IControllerService.cs

    r8545 r8958  
    1212    [OperationContract]
    1313    IEnumerable<OptimizationScenario> GetOptimizationScenarios();
     14
     15    [OperationContract]
     16    IEnumerable<string> GetOptimizationScenarioNames();
    1417
    1518    [OperationContract]
     
    3033    [OperationContract]
    3134    IList<Model.Run> GetJobResults(User user, string id);
     35
     36    [OperationContract]
     37    bool AddHiveScenario(User user, string scenarioXml, string scenarioMapper);
     38
     39    [OperationContract]
     40    bool DeleteHiveScenario(User user, string scenarioName);
    3241  }
    3342}
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/IScenarioManager.cs

    r8545 r8958  
    1212    void DeleteJob(User user, string id);
    1313    IList<Model.Run> GetJobResults(User user, string id);
     14    bool AddScenario(User user, string scenarioName, string scenarioXml, string scenarioMapper);
     15    bool DeleteScenario(User user, string scenarioName);
    1416  }
    1517}
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/PlaceholderControllerService.cs

    r8817 r8958  
    6262
    6363    public Model.OptimizationScenario GetOptimizationScenarioByName(string name) {
    64       if (scenarios[0].Name == name)
    65         return scenarios[0];
    66       return null;
     64      var scen = (from e in scenarios
     65                  where e.Name == name
     66                  select e).FirstOrDefault();     
     67      return scen;
    6768    }
    6869
     
    8990      return hiveManager.GetJobResults(user, id);
    9091    }
     92
     93
     94    public bool AddHiveScenario(User user, string scenarioXml, string scenarioMapper) {
     95      var scenario = parser.ParseScenarioFromXml(scenarioXml);
     96      if (scenario == null) {
     97        return false;
     98      }     
     99      var added = hiveManager.AddScenario(user, scenario.Name, scenarioXml, scenarioMapper);
     100      if (added)
     101        scenarios.Add(scenario);
     102      return added;
     103    }
     104
     105    public bool DeleteHiveScenario(User user, string scenarioName) {
     106      var scen = GetOptimizationScenarioByName(scenarioName);
     107      if (scen != null) {
     108        scenarios.Remove(scen);
     109        return hiveManager.DeleteScenario(user, scenarioName);
     110      }
     111      return false;
     112    }
     113
     114    public IEnumerable<string> GetOptimizationScenarioNames() {
     115      return (from e in scenarios
     116              select e.Name).AsEnumerable();     
     117    }
    91118  }
    92119}
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers/HomeController.cs

    r8384 r8958  
    77namespace HeuristicLab.Services.Optimization.Web.Controllers {
    88  public class HomeController : Controller {
    9     public ActionResult Index() {
    10       ViewBag.Message = "Welcome to ASP.NET MVC!";
    11 
    12       return View();
     9    public ActionResult Index() {     
     10      return RedirectToAction("Index", "Optimization");     
    1311    }
    1412
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/HeuristicLab.Services.Optimization.Web.csproj

    r8817 r8958  
    9797  <ItemGroup>
    9898    <Compile Include="Controllers\AccountController.cs" />
     99    <Compile Include="Controllers\AdminController.cs" />
    99100    <Compile Include="Controllers\HomeController.cs" />
    100101    <Compile Include="Controllers\OptimizationController.cs" />
     
    103104    </Compile>
    104105    <Compile Include="Models\AccountModels.cs" />
     106    <Compile Include="Models\AdminModels.cs" />
    105107    <Compile Include="Models\OptimizationModels.cs" />
    106108    <Compile Include="Properties\AssemblyInfo.cs" />
     
    257259      <SubType>Designer</SubType>
    258260    </None>
     261    <Content Include="Views\Admin\Index.cshtml" />
    259262  </ItemGroup>
    260263  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/Mappings/tsp.xml

    r8817 r8958  
    1111      <value v1="40"/>
    1212      <value v1="38"/>
     13      <value v1="60"/>
    1314    </param>
    1415    <param type="DecimalMatrix" name="Coordinates">
    1516      <value v1="334.5909" v2="161.7809"/>
    1617      <value v1="503.5909" v2="172.7809"/>
     18      <value v1="400.5909" v2="300.7809"/>
     19      <value v1="700.5909" v2="700.7809"/>
    1720    </param>
    1821    <param type="Type" name="EvaluatorParameter">
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/_Layout.cshtml

    r8384 r8958  
    1919            <nav>
    2020                <ul id="menu">
     21                    <li>@Html.ActionLink("Admin", "Index", "Admin")</li>
    2122                    <li>@Html.ActionLink("Home", "Index", "Home")</li>
    2223                    <li>@Html.ActionLink("About", "About", "Home")</li>
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/WebRole.cs

    r8384 r8958  
    77
    88namespace HeuristicLab.Services.Optimization.Web {
     9  public static class Constants {
     10    public const string DiagnosticsConnectionString = "Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString";
     11  }
     12
    913  public class WebRole : RoleEntryPoint {
    1014    public override bool OnStart() {
    1115      // For information on handling configuration changes
    12       // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.
     16      // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.     
     17      try {
     18        if (!String.IsNullOrEmpty(RoleEnvironment.GetConfigurationSettingValue(Constants.DiagnosticsConnectionString))) {
     19          DiagnosticMonitorConfiguration dmc = DiagnosticMonitor.GetDefaultInitialConfiguration();
     20          dmc.Logs.ScheduledTransferPeriod = TimeSpan.FromMinutes(1);
     21          dmc.Logs.ScheduledTransferLogLevelFilter = LogLevel.Verbose;
     22          DiagnosticMonitor.Start(Constants.DiagnosticsConnectionString, dmc);
     23        }
     24      }
     25      catch (RoleEnvironmentException ex) {
     26        // diagnostics connection string not in configuration
     27        // -> diagnostics disabled
     28        // nothing more to do
     29      }
    1330
    1431      return base.OnStart();
Note: See TracChangeset for help on using the changeset viewer.