/// <summary>Deletes all the data related to the job.</summary> /// <remarks>After calling this method, the instance of <see cref="T:MapReduceJob"/> /// should not be used anymore.</remarks> public void DeleteJobData() { lock (_jobName) { var blobSet = new MapReduceBlobSet(_blobStorage, _queueStorage); blobSet.DeleteJobData(_jobName); } }
/// <summary>Gets the result of a job.</summary> /// <returns>The result item.</returns> /// <exception cref="InvalidOperationException">If the result is not ready (<seealso cref="M:IsCompleted"/>).</exception> public TMapOut GetResult() { lock (_jobName) { var blobSet = new MapReduceBlobSet(_blobStorage, _queueStorage); return(blobSet.GetAggregatedResult <TMapOut>(_jobName)); } }
/// <summary>Pushes a batch of items for processing.</summary> /// <param name="functions">The functions for map/reduce/aggregate operations.</param> /// <param name="items">The items to process (at least two).</param> /// <param name="workerCount">The max number of workers to use.</param> /// <returns>The batch ID.</returns> /// <exception cref="InvalidOperationException">If the method was already called.</exception> /// <exception cref="ArgumentException">If <paramref name="items"/> contains less than two items.</exception> public string PushItems(IMapReduceFunctions functions, IList <TMapIn> items, int workerCount) { lock (_jobName) { if (_itemsPushed) { throw new InvalidOperationException("A batch was already pushed to the work queue"); } var blobSet = new MapReduceBlobSet(_blobStorage, _queueStorage); blobSet.GenerateBlobSets(_jobName, new List <object>(from i in items select(object) i), functions, workerCount, typeof(TMapIn), typeof(TMapOut)); _itemsPushed = true; return(_jobName); } }
/// <summary>Indicates whether the job is completed.</summary> /// <returns><c>true</c> if the batch is completed, <c>false</c> otherwise.</returns> public bool IsCompleted() { lock (_jobName) { var blobSet = new MapReduceBlobSet(_blobStorage, _queueStorage); var status = blobSet.GetCompletedBlobSets(_jobName); if (status.Item1 < status.Item2) { return(false); } try { blobSet.GetAggregatedResult <object>(_jobName); return(true); } catch (InvalidOperationException) { return(false); } } }
void AggregateData(string jobName) { var blobSet = new MapReduceBlobSet(BlobStorage, QueueStorage); blobSet.PerformAggregate(jobName); }
void ProcessBlobSet(string jobName, int blobSetId) { var blobSet = new MapReduceBlobSet(BlobStorage, QueueStorage); blobSet.PerformMapReduce(jobName, blobSetId); }