Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/29/10 00:52:06 (14 years ago)
Author:
cneumuel
Message:

#1260

  • migrated to .NET 4.0
  • moved state-information about heartbeat timestamps into DB to reduce IIS-recycling issues
  • optimized memory usage of ExperimentManager when lots of large jobs are downloaded
Location:
branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.ExperimentManager/3.3
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.ExperimentManager/3.3/HeuristicLab.Hive.ExperimentManager-3.3.csproj

    r5093 r5179  
    1111    <RootNamespace>HeuristicLab.Hive.ExperimentManager</RootNamespace>
    1212    <AssemblyName>HeuristicLab.Hive.ExperimentManager-3.3</AssemblyName>
    13     <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
     13    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    1414    <TargetFrameworkProfile>
    1515    </TargetFrameworkProfile>
     
    8181  <ItemGroup>
    8282    <Reference Include="HeuristicLab.Clients.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    83       <HintPath>..\..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Clients.Common-3.3.dll</HintPath>
     83      <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Clients.Common-3.3.dll</HintPath>
    8484    </Reference>
    8585    <Reference Include="HeuristicLab.Collections-3.3">
     
    121121      <SubType>Designer</SubType>
    122122    </None>
     123    <None Include="christoph - app.config">
     124      <SubType>Designer</SubType>
     125    </None>
    123126    <None Include="f005pc.hagenberg.fhooe.at - app.config">
    124127      <SubType>Designer</SubType>
     
    126129    <None Include="HeuristicLabHiveExperimentManagerPlugin.cs.frame" />
    127130    <Compile Include="Exceptions\AddJobToHiveException.cs" />
     131    <Compile Include="HiveJobDownloader.cs" />
    128132    <Compile Include="HiveExperiment.cs" />
    129133    <Compile Include="HiveJob.cs" />
  • branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.ExperimentManager/3.3/HiveExperiment.cs

    r5171 r5179  
    534534        IsProgressing = true;
    535535        int totalJobCount = 0;
    536         int jobCount = 0;
    537536        JobResultList allResults;
    538         IDictionary<Guid, SerializedJob> allSerializedJobs = new Dictionary<Guid, SerializedJob>();
     537
    539538        progress.Status = "Connecting to Server...";
    540         using (Disposable<IClientFacade> service = ServiceLocator.Instance.StreamedClientFacadePool.GetService()) {
    541           // fetch all JobDto objects to create the full tree of tree of HiveJob objects
     539        using (Disposable<IClientFacade> service = ServiceLocator.Instance.ClientFacadePool.GetService()) {
    542540          progress.Status = "Downloading list of jobs...";
    543541          allResults = service.Obj.GetChildJobResults(rootJobId.Value, true, true).Obj;
    544542          totalJobCount = allResults.Count;
    545 
    546           // download them first
    547           foreach (JobResult jobResult in allResults) {
    548             jobCount++;
    549             progress.Status = string.Format("Downloading {0} of {1} jobs...", jobCount, totalJobCount);
    550             allSerializedJobs.Add(jobResult.Id, service.Obj.GetLastSerializedResult(jobResult.Id).Obj);
    551             progress.ProgressValue = (double)jobCount / totalJobCount;
    552           }
    553         }
    554 
    555         jobCount = 1;
    556         progress.Status = string.Format("Deserializing {0} of {1} jobs... ({2} kb)", jobCount, totalJobCount, allSerializedJobs[this.rootJobId.Value].SerializedJobData.Count() / 1024);
    557         this.HiveJob = new HiveJob(allSerializedJobs[this.rootJobId.Value], false);
    558         allSerializedJobs.Remove(this.rootJobId.Value); // reduce memory footprint
    559         progress.ProgressValue = (double)jobCount / totalJobCount;
     543        }
     544
     545        HiveJobDownloader downloader = new HiveJobDownloader(allResults.Select(x => x.Id));
     546        downloader.StartAsync();
     547
     548        while (!downloader.IsFinished) {
     549          progress.ProgressValue = downloader.FinishedCount / (double)totalJobCount;
     550          progress.Status = string.Format("Downloading/deserializing jobs... ({0}/{1} finished)", downloader.FinishedCount, totalJobCount);
     551          Thread.Sleep(500);
     552        }
     553        IDictionary<Guid, HiveJob> allHiveJobs = downloader.Results;
     554
     555        this.HiveJob = allHiveJobs[this.rootJobId.Value];
    560556
    561557        if (this.HiveJob.JobDto.DateFinished.HasValue) {
     
    571567        }
    572568
    573         // build child-job tree
    574         LoadChildResults(this.HiveJob, allResults, allSerializedJobs, progress, totalJobCount, ref jobCount);
     569        BuildHiveJobTree(this.HiveJob, allResults, allHiveJobs);
    575570        StartResultPolling();
    576571      }
     
    583578    }
    584579
    585     private void LoadChildResults(HiveJob parentHiveJob, JobResultList allResults, IDictionary<Guid, SerializedJob> allSerializedJobs, IProgress progress, int totalJobCount, ref int jobCount) {
     580    private void BuildHiveJobTree(HiveJob parentHiveJob, JobResultList allResults, IDictionary<Guid, HiveJob> allHiveJobs) {
    586581      IEnumerable<JobResult> childResults = from result in allResults
    587582                                            where result.ParentJobId.HasValue && result.ParentJobId.Value == parentHiveJob.JobDto.Id
     
    589584                                            select result;
    590585      foreach (JobResult jobResult in childResults) {
    591         jobCount++;
    592         progress.Status = string.Format("Deserializing {0} of {1} jobs ({2} kb)...", jobCount, totalJobCount, allSerializedJobs[jobResult.Id].SerializedJobData.Count() / 1024);
    593         OptimizerJob optimizerJob = null;
    594         try {
    595           optimizerJob = SerializedJob.Deserialize<OptimizerJob>(allSerializedJobs[jobResult.Id].SerializedJobData);
    596         }
    597         catch {
    598           optimizerJob = null;
    599         }
    600         progress.ProgressValue = (double)jobCount / totalJobCount;
    601         HiveJob childHiveJob = new HiveJob(optimizerJob, false);
     586        HiveJob childHiveJob = allHiveJobs[jobResult.Id];
    602587        parentHiveJob.AddChildHiveJob(childHiveJob);
    603         childHiveJob.JobDto = allSerializedJobs[jobResult.Id].JobInfo;
    604         allSerializedJobs.Remove(jobResult.Id); // reduce memory footprint
    605         if (jobCount % 10 == 0) GC.Collect(); // this is needed or otherwise HL takes over the system when the number of jobs is high
    606         LoadChildResults(childHiveJob, allResults, allSerializedJobs, progress, totalJobCount, ref jobCount);
     588        BuildHiveJobTree(childHiveJob, allResults, allHiveJobs);
    607589      }
    608590    }
  • branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.ExperimentManager/3.3/Jobs/OptimizerJob.cs

    r5153 r5179  
    108108      return new OptimizerJob(this, cloner);
    109109    }
    110     public object Clone() {
    111       return Clone(new Cloner());
    112     }
    113110    [StorableHook(HookType.AfterDeserialization)]
    114111    protected virtual void AfterDeserialization() {
     
    256253
    257254    protected virtual void optimizer_Stopped(object sender, EventArgs e) {
     255      optimizer.Prepare(); // reduce memory consumption
    258256      OnJobStopped();
    259257    }
  • branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.ExperimentManager/3.3/Properties/AssemblyInfo.cs.frame

    r5054 r5179  
    3636[assembly: AssemblyTrademark("")]
    3737[assembly: AssemblyCulture("")]
    38 [assembly: AllowPartiallyTrustedCallers]
    3938
    4039// Setting ComVisible to false makes the types in this assembly not visible
  • branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.Hive.ExperimentManager/3.3/app.config

    r5171 r5179  
    2929    </bindings>
    3030    <client>
    31       <endpoint address="net.tcp://services.heuristiclab.com:8000/Hive-3.3/ClientService.svc" binding="netTcpBinding" bindingConfiguration="ClientTcpStreamedEndpoint" contract="HeuristicLab.Hive.Contracts.Interfaces.IClientFacade" name="ClientTcpStreamedEndpoint">
     31      <endpoint address="net.tcp://christoph:9001/Hive-3.3/ClientService.svc" binding="netTcpBinding" bindingConfiguration="ClientTcpStreamedEndpoint" contract="HeuristicLab.Hive.Contracts.Interfaces.IClientFacade" name="ClientTcpStreamedEndpoint">
    3232        <identity>
    33           <dns value="services.heuristiclab.com"/>
     33          <dns value="localhost"/>
    3434        </identity>
    3535      </endpoint>
    36       <endpoint address="http://services.heuristiclab.com/Hive-3.3/ClientService.svc" binding="wsHttpBinding" bindingConfiguration="ClientHttpEndpoint" contract="HeuristicLab.Hive.Contracts.Interfaces.IClientFacade" name="ClientHttpEndpoint">
     36      <endpoint address="http://christoph/Hive-3.3/ClientService.svc" binding="wsHttpBinding" bindingConfiguration="ClientHttpEndpoint" contract="HeuristicLab.Hive.Contracts.Interfaces.IClientFacade" name="ClientHttpEndpoint">
    3737        <identity>
    38           <certificate encodedValue="AwAAAAEAAAAUAAAAwK1+2oAmcy/mI2P2QjyiJRh0y60gAAAAAQAAACoCAAAwggImMIIBj6ADAgECAhAIkseQ2EEhgU720qJA61gqMA0GCSqGSIb3DQEBBAUAMCQxIjAgBgNVBAMTGXNlcnZpY2VzLmhldXJpc3RpY2xhYi5jb20wHhcNMTAwNTExMTExNDAyWhcNMzkxMjMxMjM1OTU5WjAkMSIwIAYDVQQDExlzZXJ2aWNlcy5oZXVyaXN0aWNsYWIuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq26Bwmwc7k+4W30qLQ2j+FInEL5BuH6opDY6CSlrtt3xQS/anrhvpbf3QghLDVINzcHkzbPmm/SguG4F85QLB6xO+tJaOvRo0iEK5g3c307vMIru7FJwk/OhplEQ5J1hbDgL3zOJlrWlgtqRVxCtVdF3XroI9BctOt1NkeKv9ewIDAQABo1kwVzBVBgNVHQEETjBMgBCjbgdYd4j5JgUuJ1Wo/GxroSYwJDEiMCAGA1UEAxMZc2VydmljZXMuaGV1cmlzdGljbGFiLmNvbYIQCJLHkNhBIYFO9tKiQOtYKjANBgkqhkiG9w0BAQQFAAOBgQAb/2xk2uQad68shSPl/uixWgvFI8WkxOTBopOLaLtDxwCeZ3mWVHdV9VnixHtThubnEBXAhYOCQSIXWtQuXFWO+gH3YyjTRJY5kTmXyuvBRTn3/so5SrQ7Rdlm9hf6E5YVX3tCjAy7ybUyaDUkQfmH5vmvgvpMzRfsJ1qhnUpJiQ=="/>
     38          <certificate encodedValue="AwAAAAEAAAAUAAAAozaKcSPdw1Cdd57hw9mr3eCjxTIgAAAAAQAAAPIBAAAwggHuMIIBW6ADAgECAhBhrVLVbjrtvUe4zWuGbVeuMAkGBSsOAwIdBQAwFDESMBAGA1UEAxMJbG9jYWxob3N0MB4XDTEwMTAxMjA2NTYyNloXDTM5MTIzMTIzNTk1OVowFDESMBAGA1UEAxMJbG9jYWxob3N0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDFM6bQUgvCnsnBO9TZnOrC6x1riE2pXUzU6H38GYot674WNfir82fMh9+ojWSY/CiMzExcNWFtC3i8BG7giLYVwSanuwQ8QyRFYq3g5UMqdlm4/aof/4QMmS+SuRDsa8F4lbvdS9zBVFiyyUNYzlzO/rY08DrkCgx4X2IQGOvixwIDAQABo0kwRzBFBgNVHQEEPjA8gBCjMn9uvzNhU2c//E3RSYmUoRYwFDESMBAGA1UEAxMJbG9jYWxob3N0ghBhrVLVbjrtvUe4zWuGbVeuMAkGBSsOAwIdBQADgYEADIf8as2VBfZEpwb/GuVifvPTR0Ud+dTCwTjBdMymqjNR5NTSi408DifssSTBVGIi7xkWbQDlQQHOZmVqVFoqfNbGrtm9w1MSK24HAEMXr0WFBltvldGKCvtYnZqf377qU5gq7IBXcJZi87bZ2l1M3icr6RJo4fIbnZOa5M430aw="/>
    3939        </identity>
    4040      </endpoint>
    4141    </client>
    42    
     42
    4343  </system.serviceModel>
    4444<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
Note: See TracChangeset for help on using the changeset viewer.