admin管理员组文章数量:1305093
I have a Cloud Run Job on GCP that gets invoked programmatically. The invoker code passes ContainerOverrides
to the request like this:
var request = new RunJobRequest
{
JobName = JobName.FromProjectLocationJob(
"myproject", "region", "job-name"),
Overrides = new RunJobRequest.Types.Overrides
{
ContainerOverrides =
{
new List<RunJobRequest.Types.Overrides.Types.ContainerOverride>()
{
new()
{
Name = "pass arguments",
ClearArgs = true,
Args =
{
new List<string>
{
"arg1", "arg2"
}
}
}
}
},
TaskCount = 1
}
};
var response = this._cloudRunClient.RunJob(request);
I can see the arguments in the request, and I can see them in the Run Job execution in the console:
Command and arguments: (container entrypoint) arg1 arg2
But the problem is the args
collection is empty in the Run Job code:
if (args.Length == 0)
{
logger.Log(LogSeverity.Warning, $"No arguments received");
}
I always get No arguments received
. I've also tried making a request manually from GCP console, adding override arguments, but with the same results.
According to this example it should work:
What's missing here?
I have a Cloud Run Job on GCP that gets invoked programmatically. The invoker code passes ContainerOverrides
to the request like this:
var request = new RunJobRequest
{
JobName = JobName.FromProjectLocationJob(
"myproject", "region", "job-name"),
Overrides = new RunJobRequest.Types.Overrides
{
ContainerOverrides =
{
new List<RunJobRequest.Types.Overrides.Types.ContainerOverride>()
{
new()
{
Name = "pass arguments",
ClearArgs = true,
Args =
{
new List<string>
{
"arg1", "arg2"
}
}
}
}
},
TaskCount = 1
}
};
var response = this._cloudRunClient.RunJob(request);
I can see the arguments in the request, and I can see them in the Run Job execution in the console:
Command and arguments: (container entrypoint) arg1 arg2
But the problem is the args
collection is empty in the Run Job code:
if (args.Length == 0)
{
logger.Log(LogSeverity.Warning, $"No arguments received");
}
I always get No arguments received
. I've also tried making a request manually from GCP console, adding override arguments, but with the same results.
According to this example it should work: https://github/CharlieDigital/gcr-invoke-job-overrides
What's missing here?
Share Improve this question asked Feb 3 at 20:39 Alex PopescuAlex Popescu 711 silver badge9 bronze badges1 Answer
Reset to default 0I’m trying to replicate your problem but everything seems to be working correctly on my end. The logs from my cloud run job shows that the arguments are received before and after the overrides similar to the example you’ve provided.
It seems like your container is not receiving the arguments properly. You may check your Dockerfile for any misconfiguration then run your container locally to test if the arguments are being passed correctly. However, this doesn’t mean that the container actually receives them and you still need to verify it in the logs.
docker run gcr.io/[PROJECT-ID]/[CLOUD-RUN-JOB] arg1 arg2
本文标签: net coreGCP Cloud Run Job not receiving invocation argumentsStack Overflow
版权声明:本文标题:.net core - GCP Cloud Run Job not receiving invocation arguments - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741798918a2398103.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论