public static TOutput RunCheckpoint <TInput, TOutput>(this ICheckpointRunner runner, IAbstractCheckpoint <TInput, TOutput> wrapper, TInput input, ILoadingConvention <TInput, TOutput> loadingConvention) { return(runner.RunCheckpoint(wrapper.GetStepName(), wrapper.Run, input, loadingConvention)); }
public void Move(SampleSet <T> source, Action <IFileLocation, IFileLocation> move) { foreach (var sampleInfo in source.Keys) { IFileLocation stub = _convention(sampleInfo); ILoadingConvention <TIn, T> namingConvention = _loadingConventionGenerator(stub); namingConvention.Move(source[sampleInfo], move); } }
public SampleSet <T> Load(SampleSet <TIn> input) { var set = new SampleSet <T>(); foreach (var sample in input) { IFileLocation stub = _convention(sample.Key); ILoadingConvention <TIn, T> namingConvention = _loadingConventionGenerator(stub); T output = namingConvention.Load(sample.Value); set.Add(sample.Key, output); } return(set); }
public static TResult RunCheckpoint <TInput, TResult>(this ICheckpointRunner runner, string name, Func <TInput, IDirectoryLocation, TResult> run, TInput input, ILoadingConvention <TInput, TResult> loadingConvention) { return(runner.RunCheckpoint(name, (dir, mover) => { var result = run(input, dir); loadingConvention.Move(result, mover.Move); return loadingConvention.Load(input); }, () => loadingConvention.Load(input))); }
public LoadingConventionAsync(ILoadingConvention <TInput, TResult> loadingConvention) { _loadingConvention = loadingConvention; }
/// <summary> /// /// </summary> /// <param name="runner"></param> /// <param name="key"></param> /// <param name="wrapper"></param> /// <param name="input"></param> /// <param name="loadingConvention"></param> /// <typeparam name="TInput"></typeparam> /// <typeparam name="TOutput"></typeparam> /// <returns></returns> /// <exception cref="NotImplementedException"></exception> public static Task <TOutput> RunCheckpointAsync <TInput, TOutput>(this ICheckpointRunner runner, string key, ISandboxedCheckpoint <TInput, TOutput> wrapper, TInput input, ILoadingConvention <TInput, TOutput> loadingConvention) { var asyncLoadingConvention = new LoadingConventionAsync <TInput, TOutput>(loadingConvention); return(runner.RunCheckpoint(key, (tempInput, dir) => Task.Run(() => wrapper.Run(tempInput, dir)), input, asyncLoadingConvention)); }