Changeset 2050 for trunk/sources
- Timestamp:
- 06/16/09 11:15:34 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.CEDMA.Server/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.CEDMA.Server/3.3/Server.cs
r1529 r2050 33 33 namespace HeuristicLab.CEDMA.Server { 34 34 public class Server { 35 private static readonly string rdfFile = AppDomain.CurrentDomain.BaseDirectory + "rdf_store.db3"; 36 private static readonly string rdfConnectionString = "sqlite:rdf:Data Source=\"" + rdfFile + "\""; 37 35 38 private ServiceHost host; 36 private IStore store; 39 private Store store; 40 private IDispatcher dispatcher; 41 private IExecuter executer; 37 42 38 43 private string gridServiceUrl; 39 40 44 public string GridServiceUrl { 41 45 get { return gridServiceUrl; } … … 44 48 45 49 private string cedmaServiceUrl; 46 47 50 public string CedmaServiceUrl { 48 51 get { return cedmaServiceUrl; } … … 50 53 } 51 54 52 public Server(IStore store) { 55 private int maxActiveJobs; 56 public int MaxActiveJobs { 57 get { return maxActiveJobs; } 58 set { 59 if (value > 0 && value <= 64) { 60 maxActiveJobs = value; 61 } 62 } 63 } 64 65 public Server() { 53 66 IPAddress[] addresses = Dns.GetHostAddresses(Dns.GetHostName()); 54 67 // windows XP returns the external ip on index 0 while windows vista returns the external ip as one of the last entries … … 61 74 } 62 75 cedmaServiceUrl = "net.tcp://" + addresses[index] + ":8002/CEDMA"; 63 this.store = store; 76 store = new Store(rdfConnectionString); 77 maxActiveJobs = 10; 64 78 } 65 79 … … 83 97 } 84 98 } 99 100 internal string[] GetActiveJobDescriptions() { 101 if (executer != null) return executer.GetJobs(); 102 else return new string[] { }; 103 } 104 105 internal void Connect(string serverUrl) { 106 dispatcher = new SimpleDispatcher(store); 107 if (serverUrl.Contains("ExecutionEngine")) { 108 executer = new HiveExecuter(dispatcher, store, serverUrl); 109 } else { 110 // default is grid backend 111 executer = new GridExecuter(dispatcher, store, serverUrl); 112 } 113 executer.Start(); 114 } 85 115 } 86 116 } -
trunk/sources/HeuristicLab.CEDMA.Server/3.3/ServerForm.cs
r1898 r2050 43 43 public partial class ServerForm : Form { 44 44 private Server server; 45 private Store store;46 private IDispatcher dispatcher;47 private IExecuter executer;48 45 49 private static readonly string rdfFile = AppDomain.CurrentDomain.BaseDirectory + "rdf_store.db3";50 private static readonly string rdfConnectionString = "sqlite:rdf:Data Source=\"" + rdfFile + "\"";51 46 52 47 public ServerForm() { 53 48 InitializeComponent(); 54 store = new Store(rdfConnectionString); 55 server = new Server(store); 49 server = new Server(); 56 50 server.Start(); 57 51 addressTextBox.Text = server.CedmaServiceUrl; … … 59 53 60 54 private void refreshTimer_Tick(object sender, EventArgs e) { 61 listBox.DataSource = executer.GetJobs();55 listBox.DataSource = server.GetActiveJobDescriptions(); 62 56 } 63 57 64 58 private void connectButton_Click(object sender, EventArgs e) { 65 dispatcher = new SimpleDispatcher(store); 66 if (address.Text.Contains("ExecutionEngine")) { 67 executer = new HiveExecuter(dispatcher, store, address.Text); 68 } else { 69 // default is grid backend 70 executer = new GridExecuter(dispatcher, store, address.Text); 71 } 72 executer.Start(); 59 server.Connect(address.Text); 73 60 maxActiveJobsUpDown.Enabled = true; 74 maxActiveJobsUpDown.Value = executer.MaxActiveJobs;61 maxActiveJobsUpDown.Value = server.MaxActiveJobs; 75 62 connectButton.Enabled = false; 76 63 refreshTimer.Start(); … … 78 65 79 66 private void maxActiveJobsUpDown_ValueChanged(object sender, EventArgs e) { 80 executer.MaxActiveJobs = Convert.ToInt32(maxActiveJobsUpDown.Value);67 server.MaxActiveJobs = Convert.ToInt32(maxActiveJobsUpDown.Value); 81 68 } 82 69 }
Note: See TracChangeset
for help on using the changeset viewer.