Exemple #1
0
        /// <summary>
        /// Entry from HPC Scheduler
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        static int Main(string[] args)
        {
            ReturnValues returnValue = ReturnValues.FailJob;

            try
            {
                ParseArgs(args);

                returnValue = Job.ProcessJobXml(jobxml, schedulerPass, jobIndex, backfill, resourceCount);
            }
            catch (Exception ex)
            {
                FlexLM_Activation_Sample.EventWriteException(ex.Message);
            }
            return((int)returnValue);
        }
Exemple #2
0
        /// <summary>
        /// Run the command specified in the config file, PollCommandName, using
        /// the arguments, PollCommandArguments.
        /// </summary>

        private static void PollLicenseServer()
        {
            // Run the command and get the exit code.
            Process application = new Process();

            application.StartInfo.FileName = ConfigurationManager.AppSettings["PollCommandName"];
            if (String.IsNullOrEmpty(application.StartInfo.FileName))
            {
                throw new Exception("No executable specified in the config file for PollCommandName");
            }

            application.StartInfo.Arguments = ConfigurationManager.AppSettings["PollCommandArguments"];
            if (application.StartInfo.Arguments == null)
            {
                application.StartInfo.Arguments = "";
            }
            application.StartInfo.RedirectStandardOutput = true;
            application.StartInfo.RedirectStandardError  = true;
            application.StartInfo.UseShellExecute        = false;
            application.StartInfo.WorkingDirectory       = Directory.GetCurrentDirectory();

            application.Start();

            String stdout = application.StandardOutput.ReadToEnd();
            String stderr = application.StandardError.ReadToEnd();

            application.WaitForExit();

            Int32 exitcode = application.ExitCode;

            FlexLM_Activation_Sample.EventWritePollServer(
                application.StartInfo.WorkingDirectory,
                application.StartInfo.FileName,
                application.StartInfo.Arguments,
                exitcode,
                stdout.Substring(0, Math.Min(stdout.Length, 256)), // Avoid filling the log with long string
                stderr.Substring(0, Math.Min(stderr.Length, 256)), // Avoid filling the log with long string
                application.StartTime,
                application.ExitTime);

            ParseFlexlmOutput(stdout);
        }
Exemple #3
0
 private static void LogEvent(string Message)
 {
     FlexLM_Activation_Sample.EventWriteInvalidJobXml(_jobXmlFile, _schedulerPass, _jobIndex, _backfill, _resourceCount, Message);
 }