/// <summary> /// create bundle, process the file /// </summary> public string ProcessLocalInputfile(string filename, TempFileHandle tempFile, IDictionary <string, string> properties) { var bundleInfo = bundleRepo.Create(filename, properties); ScheduleProcessLocalFile(bundleInfo.BundleId, filename, tempFile); return(bundleInfo.BundleId); }
public void ScheduleProcessLocalFile(string bundleId, string filename, TempFileHandle tempFile, byte[] dynatraceTag = null) { var processTracer = dynatraceSdk.TraceIncomingMessageProcess(messagingSystemInfo); processTracer.SetDynatraceByteTag(dynatraceTag); processTracer.Trace(() => AsyncHelper.RunSync(() => ProcessFileAsync(bundleId, filename, tempFile)) ); tempFile.Dispose(); // now it's safe to delete temp file }
public async Task DownloadAndScheduleProcessFileAsync(string bundleId, string url, string filename) { bundleRepo.SetBundleStatus(bundleId, BundleStatus.Downloading); try { using (TempFileHandle tempFile = await downloadService.Download(bundleId, url, filename)) { await ProcessFileAsync(bundleId, filename, tempFile); } } catch (Exception e) { bundleRepo.SetBundleStatus(bundleId, BundleStatus.Failed, e.ToString()); } }
public void CreateTempFileHandleTest() { string?tempFileName = null; using (var temp = new TempFileHandle()) { tempFileName = temp.FilePath; this.TestContext.WriteLine(temp.FilePath); Assert.IsTrue(File.Exists(tempFileName)); } Assert.IsFalse(File.Exists(tempFileName)); }
private async Task ProcessFileAsync(string bundleId, string filename, TempFileHandle tempFile) { if (settings.Value.DuplicationDetectionEnabled && !SetHashAndCheckIfDuplicated(bundleId, tempFile.File)) { // duplication detected return; } bundleRepo.SetBundleStatus(bundleId, BundleStatus.Analyzing); try { await ProcessFile(bundleId, tempFile.File); bundleRepo.SetBundleStatus(bundleId, BundleStatus.Finished); } catch (Exception e) { bundleRepo.SetBundleStatus(bundleId, BundleStatus.Failed, e.ToString()); } }
private async Task ProcessFileAsync(string bundleId, string filename, TempFileHandle tempFile) { if (settings.Value.DuplicationDetectionEnabled && !SetHashAndCheckIfDuplicated(bundleId, tempFile.File)) { // duplication detected return; } bundleRepo.SetBundleStatus(bundleId, BundleStatus.Analyzing); try { await ProcessFile(bundleId, tempFile.File); IEnumerable <DumpMetainfo> dumps = await InitialAnalysis(bundleId, tempFile.File.Directory); analysisService.ScheduleDumpAnalysis(dumps); bundleRepo.SetBundleStatus(bundleId, BundleStatus.Finished); } catch (Exception e) { bundleRepo.SetBundleStatus(bundleId, BundleStatus.Failed, e.ToString()); } }