/// <summary> /// Fetch a dataset from the grid using Rucio to a local directory. /// </summary> /// <param name="connection">A previously configured connection with everything ready to go for GRID access.</param> /// <param name="dataSetName">The rucio dataset name</param> /// <param name="localDirectory">The local directory (on Linux) where the file should be downloaded</param> /// <param name="fileStatus">Gets updates as new files are downloaded. This will contain just the filename.</param> /// <param name="fileNameFilter">Filter function to alter the files that are to be downloaded</param> /// <param name="failNow">Checked periodically, if ever returns true, then bail out</param> /// <param name="timeout">How long before we should timeout in seconds</param> /// <returns>The connections used so you can chain</returns> public static ISSHConnection DownloadFromGRID(this ISSHConnection connection, string dataSetName, string localDirectory, Action <string> fileStatus = null, Func <string[], string[]> fileNameFilter = null, Func <bool> failNow = null, int timeout = 3600) { return(connection.DownloadFromGRIDAsync(dataSetName, localDirectory, fileStatus, fileNameFilter, failNow, timeout) .WaitAndUnwrapException()); }