示例#1
0
 /// <summary>
 /// Distributes the task over HPC
 /// </summary>
 /// <param name="distributableObject">distributable task</param>
 public override void Distribute(IDistributable distributableObject)
 {
     this.Name = distributableObject.JobName;
     ClusterSubmitter.SubmitAndWait(this, distributableObject, MaxSubmitAfterTasksFail, OnSubmitted);
     CopyResults.AddRange(ArgumentCollection.EnumerateValuesOfTypeFromParsable <OutputFile>(distributableObject).Select(file => file.ToString()).Distinct().Where(s => s != "-"));
     if (CopyResults.Count > 0)
     {
         HpcLib.CopyFiles(CopyResults, ExternalRemoteDirectoryName, Environment.CurrentDirectory);
     }
 }
示例#2
0
        /// <summary>
        /// Attempts to connect the the scheduler specified by Cluster and retrieve the Job specified by JobID. Will throw a SchedulerException if either of those fails.
        /// </summary>
        /// <returns>scheduler job</returns>
        public ISchedulerJob GetV2Job()
        {
            ISchedulerJob job;

            IScheduler scheduler;

            HpcLib.TryConnect(Cluster, out scheduler).Enforce <SchedulerException>("Unable to connect to head node {0}", Cluster);
            HpcLib.TryGetJob(scheduler, Username, JobID, out job).Enforce <SchedulerException>("Unable to load jobID {0} for user {1}", JobID, Username);

            return(job);
        }
示例#3
0
 private static void CopyExes(ClusterSubmitterArgs clusterArgs)
 {
     if (clusterArgs.ExeRelativeDirectoryName == null)
     {
         clusterArgs.ExeRelativeDirectoryName = HpcLib.CopyExesToCluster(clusterArgs.ExternalRemoteDirectoryName, clusterArgs.ExeName);
     }
     else
     {
         Console.WriteLine(Resource.Using_exe + clusterArgs.ExeRelativeDirectoryName);
         string absoluteExeDir = clusterArgs.ExternalRemoteDirectoryName + "\\" + clusterArgs.ExeRelativeDirectoryName;
         Helper.CheckCondition(Directory.Exists(absoluteExeDir), "Directory {0} does not exist!", absoluteExeDir);
     }
 }
示例#4
0
        /// <summary>
        /// Connect to HPC
        /// </summary>
        /// <param name="schedulerName">scheduler name</param>
        /// <param name="jobID">job id</param>
        /// <param name="usernameOrNull">user name</param>
        /// <param name="jobListener">job listener</param>
        /// <returns></returns>
        public static bool TryConnect(string schedulerName, int jobID, string usernameOrNull, out JobListener jobListener)
        {
            IScheduler    scheduler;
            ISchedulerJob job;

            if (HpcLib.TryConnect(schedulerName, out scheduler) && HpcLib.TryGetJob(scheduler, usernameOrNull, jobID, out job))
            {
                jobListener = new JobListener(scheduler, job);
                return(true);
            }
            else
            {
                jobListener = null;
                return(false);
            }
        }
示例#5
0
        private bool Connect()
        {
            if (_scheduler != null)
            {
                return(true);
            }

            bool connected = false;

            using (ParallelOptionsScope.Suspend())
            {
                connected = HpcLib.TryConnect(Cluster, out _scheduler);
            }

            return(connected);
        }
示例#6
0
        /// <summary>
        /// Finalize parse
        /// </summary>
        public void FinalizeParse()
        {
            Helper.CheckCondition <ParseException>(Version == 3, "Only API version 3 is supported.");    // technically, I think version 2 api is the same, so we could probably relax this.
            Helper.CheckCondition <ParseException>(TaskCount > 0, "You must specify a positive task count using -TaskCount");
            Helper.CheckCondition <ParseException>(Cluster != null, "You must specify a cluster name using -cluster name");

            if (Dir == null)
            {
                Dir = Environment.CurrentDirectory;
                string username = HpcLib.GetCurrentUsername();
                Dir         = username + Dir.Substring(2); // first 2 characters are the drive. e.g. D:
                RelativeDir = true;
            }
            if (ExeName == null)
            {
                ExeName = SpecialFunctions.GetEntryOrCallingAssembly().GetName().Name;
            }

            if (Cluster.Equals(":auto:", StringComparison.CurrentCultureIgnoreCase) || Cluster.Equals("$auto$", StringComparison.CurrentCultureIgnoreCase))
            {
                Cluster = HpcLib.GetMostAppropriateCluster(TaskCount).Cluster;
            }
        }
示例#7
0
 /// <summary>
 /// Copies input files
 /// </summary>
 /// <param name="filesToCopy">list of input files</param>
 /// <param name="baseDestnDir">target dir</param>
 public static void CopyInputFiles(List <string> filesToCopy, string baseDestnDir)
 {
     HpcLib.CopyFiles(filesToCopy, Environment.CurrentDirectory, baseDestnDir);
 }