public void GetFileListFromDir() { AtlasWorkFlows.Utils.IPLocationTests.SetIpName("pc.cern.ch"); var dataStore = utils.BuildSampleDirectoryBeforeBuild("GetFileListFromDir", "ds1.1.1"); var configInfo = utils.GetLocal(dataStore); var w = new WindowsDataset(dataStore); var list = w.ListOfDSFiles("ds1.1.1"); Assert.AreEqual(5, list.Length); }
public void GetFileListFromDirWithoutFileList() { AtlasWorkFlows.Utils.IPLocationTests.SetIpName("pc.cern.ch"); var dataStore = utils.BuildSampleDirectoryBeforeBuild("GetFileListFromDirWithoutFileList", "ds1.1.1"); var f = new FileInfo(Path.Combine(dataStore.FullName, "ds1.1.1", "aa_dataset_complete_file_list.txt")); Assert.IsTrue(f.Exists); f.Delete(); var configInfo = utils.GetLocal(dataStore); var w = new WindowsDataset(dataStore); var list = w.ListOfDSFiles("ds1.1.1"); Assert.AreEqual(5, list.Length); }
public static Location GetLocation(Dictionary<string, string> props) { var l = new Location(); l.Name = props["Name"]; var dirCacheLocations = props["Paths"].Split(',') .Select(dirname => new DirectoryInfo(dirname.Trim())) .ToArray(); // We are always good - and we test for directory locations on the fly l.LocationTests.Add(() => true); l.GetDSInfo = name => { var d = FindDataset(dirCacheLocations, name); if (d == null) { return new DSInfo() { Name = name, IsLocal = filter => false, CanBeGeneratedAutomatically = false, ListOfFiles = () => new string[0], LocationProvider = l, }; } else { var w = new WindowsDataset(d.Parent); return new DSInfo() { Name = name, IsLocal = filter => w.FindDSFiles(name, filter) != null, CanBeGeneratedAutomatically = false, ListOfFiles = () => w.ListOfDSFiles(name), LocationProvider = l, }; } }; // Even though we claim we can't download a data file locally - we can. It is just that we won't do it automatically. var linuxFinder = FetchToRemoteLinuxDirInstance.FetchRemoteLinuxInstance(props); l.GetDS = (dsinfo, status, filter, failNow, timeout) => { var d = FindDataset(dirCacheLocations, dsinfo.Name); if (d == null) { var validLocalCache = FindLocalCache(dirCacheLocations); if (validLocalCache == null) { throw new InvalidOperationException(string.Format("No local cache directory has been created; we can't copy any files locally until it has. See the {0}.Paths property in the configuration", l.Name)); } var dsdir = new DirectoryInfo(Path.Combine(validLocalCache.FullName, dsinfo.Name.SantizeDSName())); dsdir.Create(); return LoadDatasetFromOtherSource(new WindowsDataset(dsdir.Parent), dsinfo, status, filter, l.Name, linuxFinder, props["LinuxTempLocation"], failNow, timeout); } var w = new WindowsDataset(d.Parent); var result = w.FindDSFiles(dsinfo.Name, filter); if (result != null) { return result; } return LoadDatasetFromOtherSource(w, dsinfo, status, filter, l.Name, linuxFinder, string.Format("{0}/{1}", props["LinuxTempLocation"], dsinfo.Name.SantizeDSName()), failNow, timeout); }; return l; }