Esempio n. 1
0
        public EnvisionJobRunner(JobData job)
            : base(job)
        {
            ConfigParser parser = ConfigParser.Instance();

            string localBase = parser[ConfigOpts.Get(ConfigKey.BaseDirectory)].Value;
            string remoteBase = parser[ConfigOpts.Get(ConfigKey.RemoteBaseDirectory)].Value;
            string remoteResultsDir = parser[ConfigOpts.Get(ConfigKey.ResultsDirectory)].Value;
            string remoteResultsLogDir = parser[ConfigOpts.Get(ConfigKey.ResultsLogDirectory)].Value;
            string envOutputDir = parser[ConfigOpts.Get(ConfigKey.EnvisionOutputDirectoryName)].Value;
            string remoteJobNameDir = job.FriendlyName == string.Empty ? job.Guid : job.FriendlyName;

            EnvExePath = parser[ConfigOpts.Get(ConfigKey.EnvExePath)].Value;
            RemoteResultsDirectory = Path.Combine(remoteBase, remoteResultsDir, remoteJobNameDir);
            ResultsLogDirectory = Path.Combine(remoteBase, remoteResultsLogDir);
            ProjectWorkingDir = Path.Combine(localBase, job.Guid);
            EnvisionOutputDir = Path.Combine(ProjectWorkingDir, envOutputDir);
            EnvxFilePath = Path.Combine(ProjectWorkingDir, job.EnvxName);
            RemoteSourceDirectory = Path.Combine(remoteBase, job.ProjectSourceUri);

            logger.Info(EnvExePath);
            logger.Info(RemoteResultsDirectory);
            logger.Info(ResultsLogDirectory);
            logger.Info(ProjectWorkingDir);
            logger.Info(EnvisionOutputDir);
            logger.Info(EnvxFilePath);
            logger.Info(RemoteSourceDirectory);
        }
Esempio n. 2
0
        public static JobData DeepCopy(JobData rhs)
        {
            if (rhs == null) return null;

            JobData copy = new JobData()
            {
                Guid = string.Copy(rhs.Guid),
                EnvxName = string.Copy(rhs.EnvxName),
                ProjectSourceUri = string.Copy(rhs.ProjectSourceUri),
                SubmitTime = rhs.SubmitTime,
                FinishTime = rhs.FinishTime,
                StartTime = rhs.StartTime,
                FriendlyName = string.Copy(rhs.FriendlyName),
                EnvisionExitCode = rhs.EnvisionExitCode,
                TrackerGuid = string.Copy(rhs.TrackerGuid),
                JobPrivateWorkingSetSize = rhs.JobPrivateWorkingSetSize
            };

            copy.ProjectScenarios = new int[rhs.ProjectScenarios.Length];
            Array.Copy(rhs.ProjectScenarios, copy.ProjectScenarios, copy.ProjectScenarios.Length);

            return copy;
        }
Esempio n. 3
0
        /// <summary>
        /// Put a finished job into the finished jobs list.
        /// </summary>
        /// <param name="j">
        /// The JobData that has been finished
        /// </param>
        public void PushFinishedJob(JobData j)
        {
            JobData n;
            runningJobs.TryRemove(Guid.Parse(j.Guid), out n);
            finishedJobs.TryAdd(Guid.Parse(j.Guid), j);

            logger.InfoFormat("Put finished job {0} ({1}) with status {2} into finished jobs queue.", j.FriendlyName, j.Guid, j.Status.ToString());
        }
Esempio n. 4
0
        /// <summary>
        /// Put JobData j into the waiting queue.
        /// </summary>
        /// <param name="j">
        /// The jobdata that should be added.
        /// </param>
        /// <returns>
        /// True, always true!
        /// </returns>
        public bool PushJob(JobData j)
        {
            waitingJobs.Enqueue(j);
            logger.Info("Put job " + j.Guid + " in the queue");

            return true;
        }
Esempio n. 5
0
        /// <summary>
        /// Initializes j with the job next in the waiting jobs queue. If no jobs available j is initialized
        /// to null and false is returned.
        /// </summary>
        /// <param name="j">
        /// A jobdata that will be initialized with then next job in the queue.
        /// </param>
        /// <returns>
        /// True if successfully initialized j with a job, false otherwise, or false if there are no waiting jobs.
        /// </returns>
        public bool GetJob(out JobData j)
        {
            j = null;
            if (waitingJobs.Count <= 0)
            {
                return false;
            }

            return waitingJobs.TryDequeue(out j) &&
                runningJobs.TryAdd(Guid.Parse(j.Guid), j);
        }