Skip to content

Commit

Permalink
[IngestionClient] Revert faulty ingestion client commits (#2258)
Browse files Browse the repository at this point in the history
* reset back to commit 2fd035a

* merge commit 1c5f343

* update template version

* update VisualStudioVersion
  • Loading branch information
HenryvanderVegte authored Feb 5, 2024
1 parent 3d62e3a commit 3ce1dff
Show file tree
Hide file tree
Showing 21 changed files with 752 additions and 559 deletions.
6 changes: 6 additions & 0 deletions samples/ingestion/ingestion-client/BatchIngestionClient.sln
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RealtimeTranscription", "Re
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DatabaseMigrator", "DatabaseMigrator\DatabaseMigrator.csproj", "{5BD38646-D3F3-481B-909E-353750AC5384}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7BC59BB6-7DD9-4D72-8AA0-91F774D6E45A}"
ProjectSection(SolutionItems) = preProject
Setup\ArmTemplateBatch.json = Setup\ArmTemplateBatch.json
Setup\ArmTemplateRealtime.json = Setup\ArmTemplateRealtime.json
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
4 changes: 2 additions & 2 deletions samples/ingestion/ingestion-client/Connector/BatchClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static class BatchClient
{
private const string TranscriptionsBasePath = "speechtotext/v3.0/Transcriptions/";

private const int MaxNumberOfRetries = 3;
private const int MaxNumberOfRetries = 10;

private static readonly TimeSpan PostTimeout = TimeSpan.FromMinutes(1);

Expand All @@ -34,7 +34,7 @@ public static class BatchClient
private static readonly AsyncRetryPolicy RetryPolicy =
Policy
.Handle<Exception>(e => e is HttpStatusCodeException || e is HttpRequestException)
.WaitAndRetryAsync(MaxNumberOfRetries, retryAttempt => TimeSpan.FromSeconds(2));
.WaitAndRetryAsync(MaxNumberOfRetries, retryAttempt => TimeSpan.FromSeconds(5));

public static Task<TranscriptionReportFile> GetTranscriptionReportFileFromSasAsync(string sasUri)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// <copyright file="TranscriptionAnalyticsJobStatus.cs" company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
// </copyright>

namespace Connector.Enums
{
public enum TranscriptionAnalyticsJobStatus
{
NotSubmitted,
Running,
Completed
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ public TextAnalyticsRequests(
IEnumerable<TextAnalyticsRequest> audioLevelRequests,
IEnumerable<TextAnalyticsRequest> conversationRequests)
{
this.UtteranceLevelRequests = utteranceLevelRequests;
this.AudioLevelRequests = audioLevelRequests;
this.ConversationRequests = conversationRequests;
this.UtteranceLevelRequests = utteranceLevelRequests ?? new List<TextAnalyticsRequest>();
this.AudioLevelRequests = audioLevelRequests ?? new List<TextAnalyticsRequest>();
this.ConversationRequests = conversationRequests ?? new List<TextAnalyticsRequest>();
}

public IEnumerable<TextAnalyticsRequest> UtteranceLevelRequests { get; }
public IEnumerable<TextAnalyticsRequest> UtteranceLevelRequests { get; set; }

public IEnumerable<TextAnalyticsRequest> AudioLevelRequests { get; }
public IEnumerable<TextAnalyticsRequest> AudioLevelRequests { get; set; }

public IEnumerable<TextAnalyticsRequest> ConversationRequests { get; }
public IEnumerable<TextAnalyticsRequest> ConversationRequests { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public async Task MoveFileAsync(string inputContainerName, string inputFileName

if (!keepSource)
{
await inputBlockBlobClient.DeleteAsync().ConfigureAwait(false);
await inputBlockBlobClient.DeleteIfExistsAsync().ConfigureAwait(false);
}

return;
Expand All @@ -178,7 +178,7 @@ public async Task MoveFileAsync(string inputContainerName, string inputFileName

if (!keepSource)
{
await inputBlockBlobClient.DeleteAsync().ConfigureAwait(false);
await inputBlockBlobClient.DeleteIfExistsAsync().ConfigureAwait(false);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
// </copyright>

using FetchTranscription.Database;
using FetchTranscription;

using Microsoft.Azure.WebJobs.Hosting;

[assembly: WebJobsStartup(typeof(DatabaseInitializationService), "DatabaseInitialize")]

namespace FetchTranscription.Database
namespace FetchTranscription
{
using Connector.Database;

using FetchTranscriptionFunction;

using Microsoft.Azure.WebJobs.Description;
using Microsoft.Azure.WebJobs.Host.Config;
using Microsoft.EntityFrameworkCore;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
// </copyright>

using FetchTranscription.Database;
using FetchTranscription;

using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Hosting;

[assembly: WebJobsStartup(typeof(DatabaseInitializationService), "DatabaseInitialize")]

namespace FetchTranscription.Database
namespace FetchTranscription
{
public class DatabaseInitializationService : IWebJobsStartup
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
// </copyright>

namespace FetchTranscriptionFunction
namespace FetchTranscription
{
using System;
using System.Threading.Tasks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
// </copyright>

namespace FetchTranscriptionFunction
namespace FetchTranscription
{
using System;
using Connector;
Expand Down Expand Up @@ -59,7 +59,7 @@ public static class FetchTranscriptionEnvironmentVariables

public static readonly string TextAnalyticsKey = Environment.GetEnvironmentVariable(nameof(TextAnalyticsKey), EnvironmentVariableTarget.Process);

public static readonly string TextAnalyticsRegion = Environment.GetEnvironmentVariable(nameof(TextAnalyticsRegion), EnvironmentVariableTarget.Process);
public static readonly string TextAnalyticsEndpoint = Environment.GetEnvironmentVariable(nameof(TextAnalyticsEndpoint), EnvironmentVariableTarget.Process);

public static readonly string PiiCategories = Environment.GetEnvironmentVariable(nameof(PiiCategories), EnvironmentVariableTarget.Process);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ namespace FetchTranscription

using Connector.Database;

using FetchTranscriptionFunction;

using Microsoft.Azure.Functions.Extensions.DependencyInjection;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// <copyright file="ITranscriptionAnalyticsProvider.cs" company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
// </copyright>

namespace FetchTranscription
{
using System.Collections.Generic;
using System.Threading.Tasks;

using Connector;
using Connector.Enums;
using Connector.Serializable.TranscriptionStartedServiceBusMessage;

public interface ITranscriptionAnalyticsProvider
{
/// <summary>
/// Gets the status of the transcription analytics jobs that are monitored by the provider
/// </summary>
/// <param name="audioFileInfos">The audio file infos with transcription analytics jobs info</param>
/// <returns>The overall status of all jobs monitored by the provider</returns>
Task<TranscriptionAnalyticsJobStatus> GetTranscriptionAnalyticsJobStatusAsync(IEnumerable<AudioFileInfo> audioFileInfos);

/// <summary>
/// Submits transcription analytics jobs based on the transcript in speechtranscript and sets the job ids in the corresponding audio file infos.
/// </summary>
/// <param name="speechTranscriptMappings">The mapping from audio file info to transcript</param>
/// <returns>The errors if any.</returns>
Task<IEnumerable<string>> SubmitTranscriptionAnalyticsJobsAsync(Dictionary<AudioFileInfo, SpeechTranscript> speechTranscriptMappings);

/// <summary>
/// Fetches the transcription analytics results and adds them to the corresponding speech transcript
/// </summary>
/// <param name="speechTranscriptMappings">The mapping from audio file info to transcript</param>
/// <returns>The errors if any.</returns>
Task<IEnumerable<string>> AddTranscriptionAnalyticsResultsToTranscriptsAsync(Dictionary<AudioFileInfo, SpeechTranscript> speechTranscriptMappings);
}
}
Loading

0 comments on commit 3ce1dff

Please sign in to comment.