Free cookie consent management tool by TermsFeed Policy Generator

Changeset 830 for trunk/sources


Ignore:
Timestamp:
11/26/08 16:49:55 (16 years ago)
Author:
kgrading
Message:

continued work from #390, removed a fake CreateJob method and replaced all fake Jobs with real ones.

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Client.Core/Core.cs

    r816 r830  
    7676      clientCommunicator.LoginCompleted += new EventHandler<LoginCompletedEventArgs>(ClientCommunicator_LoginCompleted);
    7777      clientCommunicator.PullJobCompleted += new EventHandler<PullJobCompletedEventArgs>(ClientCommunicator_PullJobCompleted);
     78      clientCommunicator.SendJobResultCompleted += new EventHandler<SendJobResultCompletedEventArgs>(ClientCommunicator_SendJobResultCompleted);
    7879      clientCommunicator.LoginAsync(clientInfo);
    7980
     
    141142    private void GetFinishedJob(object jobId) {
    142143      long jId = (long)jobId;
    143       byte[] obj = engines[jId].GetFinishedJob();
     144      byte[] sJob = engines[jId].GetFinishedJob();
    144145     
     146      JobResult jobResult = new JobResult { JobId = jId, Result = sJob, Client = null };
     147      clientCommunicator.SendJobResultAsync(jobResult, true);
     148
    145149      AppDomain.Unload(appDomains[jId]);
    146150      appDomains.Remove(jId);
    147151      engines.Remove(jId);
     152      Status.CurrentJobs--;
     153      Debug.WriteLine("Decrement CurrentJobs to:" + Status.CurrentJobs.ToString());       
    148154
    149       Status.CurrentJobs--;
    150       Debug.WriteLine("Decrement CurrentJobs to:" + Status.CurrentJobs.ToString());     
    151155    }
    152156
     
    159163      bool sandboxed = false;
    160164
    161       IJob job = new TestJob { JobId = e.Result.JobId };
     165      //IJob job = new TestJob { JobId = e.Result.JobId };
    162166
    163167      PluginManager pm = PluginManager.Manager;
     
    165169
    166170      //AppDomain appDomain = CreateNewAppDomain(sandboxed);
    167       appDomains.Add(job.JobId, appDomain);
     171      appDomains.Add(e.Result.JobId, appDomain);
    168172
    169173      Executor engine = (Executor)appDomain.CreateInstanceAndUnwrap(typeof(Executor).Assembly.GetName().Name, typeof(Executor).FullName);
    170       engine.JobId = job.JobId;
     174      engine.JobId = e.Result.JobId;
    171175      engine.Queue = MessageQueue.GetInstance();
    172       engine.Start();
    173       engines.Add(engine.JobId, engine);
     176      engine.Start(e.Result.SerializedJob);
     177      engines.Add(e.Result.JobId, engine);
    174178
    175179      Status.CurrentJobs++;
     
    178182    }
    179183
    180     /// <summary>
    181     /// Simulator Class for new Jobs. will be replaced with fetching Jobs from the Interface
    182     /// </summary>
    183     /// <returns></returns>
    184     private IJob CreateNewJob() {
    185       Random random = new Random();
    186       IJob job = new TestJob();
    187       job.JobId = random.Next();
    188       return job;
     184    void ClientCommunicator_SendJobResultCompleted(object sender, SendJobResultCompletedEventArgs e) {     
     185      // TODO Removing of the Engines & AppDomains should happen here, not in the GetFinishedJob Method.
    189186    }
    190187  }
  • trunk/sources/HeuristicLab.Hive.Client.ExecutionEngine/Executor.cs

    r816 r830  
    3838    public MessageQueue Queue { get; set; }
    3939
    40     public void Start() {
     40    public void Start(byte[] serializedJob) {     
     41      Job = (IJob)PersistenceManager.RestoreFromGZip(serializedJob);
    4142      Job.JobStopped += new EventHandler(Job_JobStopped);
    4243      Job.Start();
Note: See TracChangeset for help on using the changeset viewer.