示例#1
0
        /// <summary>
        /// If the current object is a folder, it returns the contained objects.
        /// </summary>
        /// <returns>An iterator over all contained objects that match the specified string.</returns>
        /// <param name="match">A shell expression (similar to the argument of Directory.GetFiles()).</param>
        public override IEnumerable<IClusterResidentObject> GetFilesAndFolders(string match)
        {
            HashSet<Uri> folders = new HashSet<Uri>();
            foreach (var child in this.client.EnumerateSubdirectories(this.uri))
            {
                folders.Add(child);
            }

            Regex re = Utilities.RegexFromSearchPattern(match);
            foreach (var child in this.client.ExpandFileOrDirectory(this.uri))
            {
                if (!re.IsMatch(PathFromUri(this.baseUri, child))) continue;

                bool isFolder = folders.Contains(child);
                var file = new DfsFile(this.Config, this.baseUri, this.Job, this.client, PathFromUri(this.baseUri, child), this.ShouldCacheLocally, isFolder);

                long length;
                long time;
                this.client.GetFileStatus(child, out time, out length);
                file.size = length;
                file.CreationTime = TimeFromLong(time);

                yield return file;
            }
        }
        /// <summary>
        /// The directory where a specific process is created on the cluster.
        /// </summary>
        /// <param name="identifier">Process identifier</param>
        /// <param name="machine">Machine where process ran.</param>
        /// <returns>Home directory containing the process information (not working directory of vertex).</returns>
        /// <param name="job">Job where the process belongs.</param>
        /// <param name="terminated">True if vertex is terminated.</param>
        public override IClusterResidentObject ProcessDirectory(DryadProcessIdentifier identifier, bool terminated, string machine, DryadLinqJobSummary job)
        {
            if (identifier.ToString() == "jm")
            {
                // The job manager process is special
                var result = new DfsFile(this, this.JobsFolderUri, job, this.DfsClient, job.ClusterJobId, terminated, true);
                return result;
            }

            // vertices not supported
            return null;
        }