Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/05/11 16:45:27 (12 years ago)
Author:
ascheibe
Message:

#1672

  • removed magic numbers for upload retries
  • speed up job downloading by placing deserializing/downloading semaphores correctly
  • increased max. number of parallel downloads/deserializations
  • added more status messages when downloading to make it more clear what's actually happening
  • renamed some variables
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/HiveClient.cs

    r7059 r7125  
    113113        jobs = null;
    114114        throw;
    115       }
    116       finally {
     115      } finally {
    117116        OnRefreshed();
    118117      }
     
    297296        }
    298297        refreshableJob.Job.Modified = false;
    299       }
    300       finally {
     298      } finally {
    301299        refreshableJob.IsProgressing = false;
    302300      }
     
    362360            }
    363361          }
    364         }, -1, "Failed to upload plugins");
     362        }, Settings.Default.MaxRepeatServiceCalls, "Failed to upload plugins");
    365363        cancellationToken.ThrowIfCancellationRequested();
    366364        hiveTask.Task.PluginsNeededIds.Add(configPluginId);
     
    377375            }
    378376          }
    379         }, 50, "Failed to add task", log);
     377        }, Settings.Default.MaxRepeatServiceCalls, "Failed to add task", log);
    380378        cancellationToken.ThrowIfCancellationRequested();
    381379
     
    400398          if (!ae.InnerExceptions.All(e => e is TaskCanceledException)) throw ae; // for some reason the WaitAll throws a AggregateException containg a TaskCanceledException. i don't know where it comes from, however the tasks all finish properly, so for now just ignore it
    401399        }
    402       }
    403       finally {
     400      } finally {
    404401        if (!semaphoreReleased) taskUploadSemaphore.Release();
    405402      }
     
    423420        totalJobCount = allTasks.Count();
    424421
     422        refreshableJob.Progress.Status = "Downloading tasks...";
    425423        TaskDownloader downloader = new TaskDownloader(allTasks.Select(x => x.Id));
    426424        downloader.StartAsync();
     
    445443        }
    446444
     445        refreshableJob.Progress.Status = "Downloading/deserializing complete. Displaying tasks...";
    447446        // build child-task tree
    448447        foreach (HiveTask hiveTask in refreshableJob.HiveTasks) {
     
    451450
    452451        refreshableJob.OnLoaded();
    453       }
    454       finally {
     452      } finally {
    455453        refreshableJob.IsProgressing = false;
    456454      }
    457455    }
    458456
    459     private static void BuildHiveJobTree(HiveTask parentHiveJob, IEnumerable<LightweightTask> allJobs, IDictionary<Guid, HiveTask> allHiveJobs) {
    460       IEnumerable<LightweightTask> childTasks = from job in allJobs
    461                                                 where job.ParentTaskId.HasValue && job.ParentTaskId.Value == parentHiveJob.Task.Id
     457    private static void BuildHiveJobTree(HiveTask parentHiveTask, IEnumerable<LightweightTask> allTasks, IDictionary<Guid, HiveTask> allHiveTasks) {
     458      IEnumerable<LightweightTask> childTasks = from job in allTasks
     459                                                where job.ParentTaskId.HasValue && job.ParentTaskId.Value == parentHiveTask.Task.Id
    462460                                                orderby job.DateCreated ascending
    463461                                                select job;
    464462      foreach (LightweightTask task in childTasks) {
    465         HiveTask childHiveTask = allHiveJobs[task.Id];
    466         parentHiveJob.AddChildHiveJob(childHiveTask);
    467         BuildHiveJobTree(childHiveTask, allJobs, allHiveJobs);
     463        HiveTask childHiveTask = allHiveTasks[task.Id];
     464        parentHiveTask.AddChildHiveTask(childHiveTask);
     465        BuildHiveJobTree(childHiveTask, allTasks, allHiveTasks);
    468466      }
    469467    }
Note: See TracChangeset for help on using the changeset viewer.