Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2063 for trunk


Ignore:
Timestamp:
06/18/09 17:19:32 (15 years ago)
Author:
kgrading
Message:

added "time for shutdown" behavior: Snapshots of jobs get sent back to the server and then killed. When all jobs are killed, the client switches to disconnect state (#669)

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Client.Communication/3.2/WcfService.cs

    r2025 r2063  
    267267      if (e.Error == null && e.Result.Success == true)
    268268        SendHeartBeatCompleted(sender, e);
    269       else
     269      else {
     270        Logging.Instance.Error(this.ToString(), "Error: " + e.Result.StatusMessage);
    270271        HandleNetworkError(e.Error);
     272      }
    271273    }
    272274
  • trunk/sources/HeuristicLab.Hive.Client.Core/3.2/Core.cs

    r2025 r2063  
    176176        case MessageContainer.MessageType.UptimeLimitDisconnect:
    177177          Logging.Instance.Info(this.ToString(), "Uptime Limit reached, storing jobs and sending them back");
    178           WcfService.Instance.Disconnect();
     178
     179          //check if there are running jobs
     180          if (engines.Count > 0) {
     181            //make sure there is no more fetching of jobs while the snapshots get processed
     182            currentlyFetching = true;
     183            //request a snapshot of each running job
     184            foreach (KeyValuePair<Guid, Executor> kvp in engines) {
     185              kvp.Value.RequestSnapshot();
     186            }
     187           
     188          } else {
     189            //Disconnect afterwards
     190            WcfService.Instance.Disconnect();
     191          }
    179192          break;
    180193       
     
    239252        engines[jId].Progress,
    240253        null);
    241       engines[jId].StartOnlyJob();
     254
     255      //Uptime Limit reached, now is a good time to destroy this jobs.
     256      if (!UptimeManager.Instance.isOnline()) {
     257        lock (engines) {
     258          appDomains[jId].UnhandledException -= new UnhandledExceptionEventHandler(appDomain_UnhandledException);
     259          AppDomain.Unload(appDomains[jId]);
     260          appDomains.Remove(jId);
     261          engines.Remove(jId);
     262          jobs.Remove(jId);
     263        }
     264        GC.Collect();
     265
     266        //Still anything running?
     267        if (engines.Count == 0)
     268          WcfService.Instance.Disconnect();
     269     
     270      } else {
     271        engines[jId].StartOnlyJob();
     272      }
    242273    }
    243274
     
    249280    void wcfService_LoginCompleted(object sender, LoginCompletedEventArgs e) {
    250281      if (e.Result.Success) {
     282        currentlyFetching = false;
    251283        Logging.Instance.Info(this.ToString(), "Login completed to Hive Server @ " + DateTime.Now);       
    252284      } else
Note: See TracChangeset for help on using the changeset viewer.