Changeset 375 for trunk/sources/HeuristicLab.CEDMA.Operators
- Timestamp:
- 07/09/08 21:37:36 (16 years ago)
- 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 42 42 <RequiredTargetFramework>3.5</RequiredTargetFramework> 43 43 </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> 44 50 <Reference Include="System.Xml.Linq"> 45 51 <RequiredTargetFramework>3.5</RequiredTargetFramework> … … 53 59 <ItemGroup> 54 60 <Compile Include="HeuristicLabCedmaOperatorsPlugin.cs" /> 61 <Compile Include="OnGridProcessor.cs" /> 55 62 <Compile Include="Properties\AssemblyInfo.cs" /> 56 63 </ItemGroup> 57 64 <ItemGroup> 58 65 <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> 59 84 </ItemGroup> 60 85 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> -
trunk/sources/HeuristicLab.CEDMA.Operators/OnGridProcessor.cs
r373 r375 25 25 using HeuristicLab.Core; 26 26 using HeuristicLab.Data; 27 using HeuristicLab.Grid;28 27 using System.Threading; 28 using HeuristicLab.CEDMA.DB.Interfaces; 29 using System.ServiceModel; 30 using HeuristicLab.CEDMA.Console; 29 31 30 namespace HeuristicLab. DistributedEngine{32 namespace HeuristicLab.CEDMA.Operators { 31 33 public class OnGridProcessor : OperatorBase { 32 34 public override string Description { … … 36 38 public OnGridProcessor() 37 39 : base() { 40 AddVariableInfo(new VariableInfo("AgentId", "Id of the agent that the run should be associated to.", typeof(IntData), VariableKind.In)); 38 41 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 gridserver", typeof(StringData), VariableKind.In));42 AddVariableInfo(new VariableInfo("ServerUrl", "Url of the CEDMA server", typeof(StringData), VariableKind.In)); 40 43 } 41 44 42 45 public override IOperation Apply(IScope scope) { 43 46 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 } 55 60 return null; 56 61 }
Note: See TracChangeset
for help on using the changeset viewer.