简体   繁体   English

连接到 HPC 调度程序时如何以编程方式设置用户密码凭据

[英]How to programatically set user password credentials when connecting to an HPC Scheduler

I am trying to schedule a job on an HPC Server 2019 cluster.我正在尝试在 HPC Server 2019 集群上安排作业。 I would like to do this without having to enter the password of the service account that I am using.我想这样做而无需输入我正在使用的服务帐户的密码。 Below is the code but the without commenting the line of code it fails to connect下面是代码,但没有注释它无法连接的代码行

        string userName = GetKeyVaultSecret("ServiceAccount");
        string password = GetKeyVaultSecret("ServiceAccountPassword");

        using (IScheduler scheduler = new Scheduler())
        {
            try
            {
                    // Connect to the scheduler as another user
                    Console.WriteLine("Connecting to {0} as {1}...", clusterName, userName);
                    scheduler.SetCachedCredentials(userName,password); // If I comment this line I am prompted for a password and it connects
                    scheduler.ConnectServiceAsClient(clusterName, () => userName);
            }
            catch (Exception e)
            {
                Console.Error.WriteLine("Could not connect to the scheduler: {0}", e.Message);
                if (e.InnerException != null) Console.WriteLine(e.InnerException.Message.ToString());
                return 1; 
            }

错误是我不应该在这里设置用户名和密码,而是在我提交作业时

        scheduler.SubmitJob(job, @"domain\" + userName, password);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM