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



我正在尝试在HPC服务器2019集群上调度作业。我想这样做,而不必输入我正在使用的服务帐户的密码。下面是代码,但是没有注释连接

失败的代码行
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);

相关内容

  • 没有找到相关文章

最新更新