我正在尝试使用c#完成天蓝色批处理云任务后将输出文件上传到Azure blob。我的代码工作正常,但是给出 FileUploadMiscError-任务失败“针对不同任务随机上载了一个错误,同时上载了一个输出文件” 错误。
ContainerSASUrl代码-
SharedAccessBlobPolicy sasConstraints = new SharedAccessBlobPolicy
{
SharedAccessExpiryTime = DateTime.UtcNow.AddHours(sasUrlExpirationTime),
Permissions = SharedAccessBlobPermissions.Write
};
string sasContainerToken = string.Empty;
CloudBlobContainer container = BlobClient.GetContainerReference(containerName);
if (await container.CreateIfNotExistsAsync())
{
sasContainerToken = container.GetSharedAccessSignature(sasConstraints);
}
sasContainerToken = container.GetSharedAccessSignature(sasConstraints);
string outputContainerSasUrl= string.Format("{0}{1}", container.Uri, sasContainerToken);
任务提交-
CloudTask task = new CloudTask(taskId, taskCommandLine)
{
OutputFiles = new List<OutputFile>
{
new OutputFile(
filePattern: @"../std*.txt",
destination: new OutputFileDestination(
new OutputFileBlobContainerDestination(
containerUrl: outputContainerSasUrl,
path: jobdetails.JobId+"/output")),
uploadOptions: new OutputFileUploadOptions(
uploadCondition: OutputFileUploadCondition.TaskCompletion)
),
new OutputFile(
filePattern: @"%AZ_BATCH_JOB_PREP_WORKING_DIR%\*.dat",
destination: new OutputFileDestination(new OutputFileBlobContainerDestination(
containerUrl: outputContainerSasUrl,
path:jobdetails.JobId+"/output")),
uploadOptions: new OutputFileUploadOptions(
uploadCondition: OutputFileUploadCondition.TaskCompletion))
}
};
task.UserIdentity = new UserIdentity(new AutoUserSpecification(AutoUserScope.Pool, ElevationLevel.Admin));
task.ResourceFiles = inputFiles;
TaskConstraints taskConstraints = new TaskConstraints();
taskConstraints.MaxTaskRetryCount = 2;
task.Constraints = taskConstraints;
此代码可以正常工作,但随机失败
答案 0 :(得分:0)
您可以检查应该与任务stdout.txt和stderr.txt一起编写的fileuploadout.txt和fileuploaderr.txt吗?理想情况下,如果您可以在此处共享它们(请确保删除其中记录的所有详细信息,例如SAS)。