Exemple #1
0
        private static int NormalMethod(ParameterContainer param)
        {
            try
            {
                if (param.PrintHelp())
                {
                    return(ErrorCode.ServiceHost_PrintCommandHelp);
                }
                else
                {
                    param.Parse();
                }
            }
            catch (ParameterException e)
            {
                Console.Error.WriteLine(e.Message);
                return(ErrorCode.ServiceHost_IncorrectCommandLineParameter);
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.Message);
                return(ErrorCode.ServiceHost_UnexpectedException);
            }
            ServiceInfo serviceInfo = new ServiceInfo(param.JobId, param.TaskId, int.Parse(param.CoreId), param.RegistrationPath, param.FileName, null, null);

            OpenService(serviceInfo);
            return(0);
        }
Exemple #2
0
        static int Main(string[] args)
        {
            TraceHelper.TraceEvent(
                TraceEventType.Information, "HpcServiceHost entry point is called. Time: {0}", DateTime.UtcNow.ToString());
            //
            //  Check if HpcServiceHost is being run to launch pre/post tasks
            //
            uint exitCode = 0;

            if (RunPrePostTask(ref exitCode))
            {
                return((int)exitCode);
            }

            // HpcServiceHost.exe is running without a job
            if (args.Length > 0)
            {
                if (args[0].Equals("-StandAlone", StringComparison.OrdinalIgnoreCase))
                {
                    if (args.Length > 1 && !string.IsNullOrEmpty(args[1]))
                    {
                        ServiceHostRuntimeConfiguration.StorageCredential = args[1];
                    }

                    ServiceHostRuntimeConfiguration.Standalone = true;
                    StartService();
                    ListenSvcInfoChanged();
                }
                else
                {
                    ServiceHostRuntimeConfiguration.Standalone = false;
                    ParameterContainer param = new ParameterContainer(args);
                    NormalMethod(param);
                }
            }
            //Thread.Sleep(Timeout.Infinite);

            return(0);
        }