Esempio n. 1
0
        /// <inheritdoc />
        public override Task PurgeInstanceHistoryAsync(DateTime createdTimeFrom, DateTime?createdTimeTo, IEnumerable <OrchestrationStatus> runtimeStatus)
        {
            // TODO this cast is to avoid to change DurableTask.Core. Change it to use TaskHubClient.
            AzureStorageOrchestrationService serviceClient = (AzureStorageOrchestrationService)this.client.ServiceClient;

            return(serviceClient.PurgeInstanceHistoryAsync(createdTimeFrom, createdTimeTo, runtimeStatus));
        }
Esempio n. 2
0
        /// <inheritdoc />
        public override Task PurgeInstanceHistoryAsync(string instanceId)
        {
            // TODO this cast is to avoid to change DurableTask.Core. Change it to use TaskHubClient.
            AzureStorageOrchestrationService serviceClient = (AzureStorageOrchestrationService)this.client.ServiceClient;

            return(serviceClient.PurgeInstanceHistoryAsync(instanceId));
        }
        public Task PurgeInstanceHistoryByTimePeriod(DateTime createdTimeFrom, DateTime?createdTimeTo, IEnumerable <OrchestrationStatus> runtimeStatus)
        {
            Trace.TraceInformation($"Purging history from {createdTimeFrom} to {createdTimeTo}");

            // The Purge Instance History API only exists in the service object
            AzureStorageOrchestrationService service = (AzureStorageOrchestrationService)this.client.ServiceClient;

            return(service.PurgeInstanceHistoryAsync(createdTimeFrom, createdTimeTo, runtimeStatus));
        }
        public Task PurgeInstanceHistory()
        {
            Trace.TraceInformation($"Purging history for instance with id - {this.instanceId}");

            // The Purge Instance History API only exists in the service object
            AzureStorageOrchestrationService service = (AzureStorageOrchestrationService)this.client.ServiceClient;

            return(service.PurgeInstanceHistoryAsync(this.instanceId));
        }
        public async Task <DurableTask.Core.PurgeInstanceHistoryResult> PurgeInstanceHistoryAsync(string instanceId)
        {
            var azureStorageResult = await _azureStorageOrchestrationService.PurgeInstanceHistoryAsync(instanceId);

            return(new DurableTask.Core.PurgeInstanceHistoryResult
            {
                InstancesDeleted = azureStorageResult.InstancesDeleted
            });
        }
        /// <inheritdoc />
        public override async Task <PurgeHistoryResult> PurgeInstanceHistoryAsync(DateTime createdTimeFrom, DateTime?createdTimeTo, IEnumerable <OrchestrationStatus> runtimeStatus)
        {
            // TODO this cast is to avoid to change DurableTask.Core. Change it to use TaskHubClient.
            AzureStorageOrchestrationService serviceClient = (AzureStorageOrchestrationService)this.client.ServiceClient;

            DurableTask.AzureStorage.PurgeHistoryResult purgeHistoryResult =
                await serviceClient.PurgeInstanceHistoryAsync(createdTimeFrom, createdTimeTo, runtimeStatus);

            return(new PurgeHistoryResult(purgeHistoryResult.InstancesDeleted));
        }
        /// <inheritdoc />
        public override async Task <PurgeHistoryResult> PurgeInstanceHistoryAsync(string instanceId)
        {
            // TODO this cast is to avoid to change DurableTask.Core. Change it to use TaskHubClient.
            AzureStorageOrchestrationService serviceClient = (AzureStorageOrchestrationService)this.client.ServiceClient;

            DurableTask.AzureStorage.PurgeHistoryResult purgeHistoryResult =
                await serviceClient.PurgeInstanceHistoryAsync(instanceId);

            return(new PurgeHistoryResult(purgeHistoryResult.InstancesDeleted));
        }
        public async Task PurgeHistory(string connectionStringKey, string taskHubName, DateTime createdAfter, DateTime createdBefore, IEnumerable <OrchestrationStatus> runtimeStatuses)
        {
            Initialize(out _orchestrationService, out _client, connectionStringKey, taskHubName);

            var runtimeStatusesArray = runtimeStatuses?.ToArray();
            var stats = await _orchestrationService.PurgeInstanceHistoryAsync(createdAfter, createdBefore, runtimeStatusesArray);

            string messageToPrint = $"Purged orchestration history for all instances created between '{createdAfter}' and '{createdBefore}'";

            if (runtimeStatusesArray != null)
            {
                string statuses = string.Join(",", runtimeStatusesArray);
                messageToPrint += $" and whose runtime status matched one of the following: [{statuses}]";
            }

            ColoredConsole.WriteLine(Green(messageToPrint));
            ColoredConsole.WriteLine($"Instances deleted: {stats.InstancesDeleted}");
            ColoredConsole.WriteLine($"Rows deleted: {stats.RowsDeleted}");
        }