Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/09/08 21:37:36 (16 years ago)
Author:
gkronber
Message:

worked on #188

Location:
trunk/sources/HeuristicLab.CEDMA.Operators
Files:
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CEDMA.Operators/HeuristicLab.CEDMA.Operators.csproj

    r352 r375  
    4242      <RequiredTargetFramework>3.5</RequiredTargetFramework>
    4343    </Reference>
     44    <Reference Include="System.Runtime.Serialization">
     45      <RequiredTargetFramework>3.0</RequiredTargetFramework>
     46    </Reference>
     47    <Reference Include="System.ServiceModel">
     48      <RequiredTargetFramework>3.0</RequiredTargetFramework>
     49    </Reference>
    4450    <Reference Include="System.Xml.Linq">
    4551      <RequiredTargetFramework>3.5</RequiredTargetFramework>
     
    5359  <ItemGroup>
    5460    <Compile Include="HeuristicLabCedmaOperatorsPlugin.cs" />
     61    <Compile Include="OnGridProcessor.cs" />
    5562    <Compile Include="Properties\AssemblyInfo.cs" />
    5663  </ItemGroup>
    5764  <ItemGroup>
    5865    <None Include="HeuristicLab.snk" />
     66  </ItemGroup>
     67  <ItemGroup>
     68    <ProjectReference Include="..\HeuristicLab.CEDMA.Console\HeuristicLab.CEDMA.Console.csproj">
     69      <Project>{F8880599-F224-4EC7-9288-5C4A6853E7BE}</Project>
     70      <Name>HeuristicLab.CEDMA.Console</Name>
     71    </ProjectReference>
     72    <ProjectReference Include="..\HeuristicLab.CEDMA.DB.Interfaces\HeuristicLab.CEDMA.DB.Interfaces.csproj">
     73      <Project>{4F9BB789-D561-436B-B226-2BF44B7D0804}</Project>
     74      <Name>HeuristicLab.CEDMA.DB.Interfaces</Name>
     75    </ProjectReference>
     76    <ProjectReference Include="..\HeuristicLab.Core\HeuristicLab.Core.csproj">
     77      <Project>{F43B59AB-2B8C-4570-BC1E-15592086517C}</Project>
     78      <Name>HeuristicLab.Core</Name>
     79    </ProjectReference>
     80    <ProjectReference Include="..\HeuristicLab.Data\HeuristicLab.Data.csproj">
     81      <Project>{F473D9AF-3F09-4296-9F28-3C65118DAFFA}</Project>
     82      <Name>HeuristicLab.Data</Name>
     83    </ProjectReference>
    5984  </ItemGroup>
    6085  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • trunk/sources/HeuristicLab.CEDMA.Operators/OnGridProcessor.cs

    r373 r375  
    2525using HeuristicLab.Core;
    2626using HeuristicLab.Data;
    27 using HeuristicLab.Grid;
    2827using System.Threading;
     28using HeuristicLab.CEDMA.DB.Interfaces;
     29using System.ServiceModel;
     30using HeuristicLab.CEDMA.Console;
    2931
    30 namespace HeuristicLab.DistributedEngine {
     32namespace HeuristicLab.CEDMA.Operators {
    3133  public class OnGridProcessor : OperatorBase {
    3234    public override string Description {
     
    3638    public OnGridProcessor()
    3739      : base() {
     40      AddVariableInfo(new VariableInfo("AgentId", "Id of the agent that the run should be associated to.", typeof(IntData), VariableKind.In));
    3841      AddVariableInfo(new VariableInfo("OperatorGraph", "The operator graph that should be executed on the grid", typeof(IOperatorGraph), VariableKind.In));
    39       AddVariableInfo(new VariableInfo("GridServerUrl", "Url of the grid server", typeof(StringData), VariableKind.In));
     42      AddVariableInfo(new VariableInfo("ServerUrl", "Url of the CEDMA server", typeof(StringData), VariableKind.In));
    4043    }
    4144
    4245    public override IOperation Apply(IScope scope) {
    4346      IOperatorGraph operatorGraph = scope.GetVariableValue<IOperatorGraph>("OperatorGraph", false);
    44       string gridServerUrl = scope.GetVariableValue<StringData>("GridServerUrl", true).Data;
    45       JobManager jobManager = new JobManager(gridServerUrl);
    46       jobManager.Reset();
    47       Scope globalScope = new Scope();
    48       AtomicOperation operation = new AtomicOperation(operatorGraph.InitialOperator, globalScope);
    49       WaitHandle w = jobManager.BeginExecuteOperation(globalScope, operation);
    50      
    51       ThreadPool.QueueUserWorkItem(delegate(object status) {
    52         w.WaitOne();
    53         jobManager.EndExecuteOperation(operation);
    54       });
     47      string serverUrl = scope.GetVariableValue<StringData>("ServerUrl", true).Data;
     48      long agentId = scope.GetVariableValue<IntData>("AgentId", true).Data;
     49
     50      NetTcpBinding binding = new NetTcpBinding();
     51      binding.MaxReceivedMessageSize = 10000000; // 10Mbytes
     52      binding.ReaderQuotas.MaxStringContentLength = 10000000; // also 10M chars
     53      binding.ReaderQuotas.MaxArrayLength = 10000000; // also 10M elements;
     54      binding.Security.Mode = SecurityMode.None;
     55      using(ChannelFactory<IDatabase> factory = new ChannelFactory<IDatabase>(binding)) {
     56        IDatabase database = factory.CreateChannel(new EndpointAddress(serverUrl));
     57        long id = database.InsertRun(agentId, DbPersistenceManager.Save(operatorGraph));
     58        database.UpdateRunStatus(id, ProcessStatus.Waiting);
     59      }
    5560      return null;
    5661    }
Note: See TracChangeset for help on using the changeset viewer.