public void NewInstanceStored(InstanceStorageInfo instance)
        {
            Guard.Against.Null(instance, nameof(instance));

            _logger.Log(LogLevel.Information, "Notifying {0} observers of new instance stored {1}", _observers.Count, instance.SopInstanceUid);

            var observerHandledInstances = 0;

            foreach (var observer in _observers)
            {
                try
                {
                    observer.OnNext(instance);
                    observerHandledInstances++;
                }
                catch (InstanceNotSupportedException)
                {
                    //no op
                }
                catch (ArgumentNullException ex)
                {
                    _logger.Log(LogLevel.Error, ex, "Received a null instance");
                }
            }

            if (observerHandledInstances == 0)
            {
                _logger.Log(LogLevel.Warning, "Instance not supported by any of the configured AE Titles, notifying Storage Space Reclaimer Service.");
                _cleanupQueue.QueueInstance(instance);
            }
        }
Example #2
0
 protected void RemoveInstances(List <InstanceStorageInfo> instances)
 {
     _logger.Log(LogLevel.Debug, $"Notifying Disk Reclaimer to delete {instances.Count} instances.");
     foreach (var instance in instances)
     {
         _cleanupQueue.QueueInstance(instance.InstanceStorageFullPath);
     }
     _logger.Log(LogLevel.Information, $"Notified Disk Reclaimer to delete {instances.Count} instances.");
 }
Example #3
0
 private void RemoveInstances(IEnumerable <string> files)
 {
     _logger.Log(LogLevel.Debug, $"Notifying Disk Reclaimer to delete {files.Count()} instances.");
     foreach (var file in files)
     {
         _cleanupQueue.QueueInstance(file);
     }
     _logger.Log(LogLevel.Information, $"Notified Disk Reclaimer to delete {files.Count()} instances.");
 }
 private void RemoveFiles(string[] files)
 {
     _logger.Log(LogLevel.Debug, $"Notifying Disk Reclaimer to delete {files.Length} files.");
     foreach (var file in files)
     {
         _cleanupQueue.QueueInstance(file);
     }
     _logger.Log(LogLevel.Information, $"Notified Disk Reclaimer to delete {files.Length} files.");
 }
Example #5
0
        private void CleanupJobFiles(InferenceJob job)
        {
            Guard.Against.Null(job, nameof(job));

            if (!_fileSystem.Directory.Exists(job.JobPayloadsStoragePath))
            {
                return;
            }

            using var _ = (_logger.BeginScope(new LogginDataDictionary <string, object> { { "JobId", job.JobId }, { "PayloadId", job.PayloadId } }));
            var filePaths = _fileSystem.Directory.GetFiles(job.JobPayloadsStoragePath, "*", System.IO.SearchOption.AllDirectories);

            _logger.Log(LogLevel.Debug, $"Notifying Disk Reclaimer to delete {filePaths.LongLength} files.");
            foreach (var file in filePaths)
            {
                _cleanupQueue.QueueInstance(file);
            }
            _logger.Log(LogLevel.Information, $"Notified Disk Reclaimer to delete {filePaths.LongLength} files.");
        }