public void Append(ICountableLookup lookup, IProcess caller, IReadOnlySlimRow[] filterRows) { var process = ProcessCreator.Invoke(filterRows); var rows = process.TakeRowsAndReleaseOwnership(caller); var rowCount = 0; foreach (var row in rows) { rowCount++; string key = null; try { key = KeyGenerator(row); } catch (Exception ex) { throw KeyGeneratorException.Wrap(caller, row, ex); } if (string.IsNullOrEmpty(key)) { continue; } lookup.AddRow(key, row); } caller?.Context.Log(LogSeverity.Debug, caller, "fetched {RowCount} rows, lookup size is {LookupSize}", rowCount, lookup.Count); }
private void CalculateProcess() { var initialProcess = ApplicationContainer.Resolve <IInitialProcessCreator>().CreateInitialProcess(); var processCreator = new ProcessCreator(initialProcess); process = processCreator.CreateProcess(); }
protected Process LaunchTestsApp(FileInfo appFile, Actions action, Guid telemetryKey, ProgramInfo pi = null, bool waitForExit = true, string viewName = null) { Arguments args = new Arguments { ApiUrl = this.BaseUrl, Action = action }; args.DebugMode = true; args.ProgramInfo = pi; args.ViewName = viewName; args.TelemetryKey = telemetryKey; Process process = ProcessCreator.Create(appFile, args, this.outputs, this.errors); this.Log($"Started process: {appFile.FullName}"); process.Start(); process.BeginOutputReadLine(); process.BeginErrorReadLine(); if (waitForExit) { process.WaitForExit(); this.Log($"Finished process: {appFile.FullName}"); } return(process); }
Process LaunchTestRunner(PNUnitTestInfo testInfo, string testInfoPath) { string testingArgs = string.Format( "\"{0}\" \"{1}\"", testInfoPath, mPathToAssemblies); // You should customize this section depending on the applications // you've got and the platform they run on. Process result = null; if (testInfo.TestName.StartsWith("windows:")) { result = ProcessCreator.CreateGuiApplicationRunnerProcess( testInfo, "windows.exe", testingArgs, mPathToAssemblies); } if (testInfo.TestName.StartsWith("linux:")) { result = ProcessCreator.CreateGuiApplicationRunnerProcess( testInfo, "linux", testingArgs, mPathToAssemblies); } if (testInfo.TestName.StartsWith("mac:")) { result = ProcessCreator.CreateGuiApplicationRunnerProcess( testInfo, "macos.app/Contents/MacOS/macos", testingArgs, mPathToAssemblies); } if (result == null) { result = ProcessCreator.CreateTestRunnerProc(testingArgs, mPathToAssemblies); } result.Start(); return(result); }
public void SendStatus(object sender, System.Timers.ElapsedEventArgs args) { eventLog.WriteEntry("Tick started", EventLogEntryType.Information); try { dynamic result = SendStatus(); if (result == null) { return; } if (result.command == null) { return; } string message = result.message != null ? $"-m {result.message}" : ""; eventLog.WriteEntry($"Starting process for {result.command}\n-c {result.command} {message}"); ProcessCreator processCreator = new ProcessCreator(); processCreator.createProcess(WORKING_DIR + WORKER_EXECUTABLE_NAME, $"-c {result.command} {message}"); } catch (Exception ex) { eventLog.WriteEntry($"Tick failed: {ex.Message} {ex.StackTrace}", EventLogEntryType.Error); } eventLog.WriteEntry("Tick finished", EventLogEntryType.Information); }
public void TraceNewProcess(IEnumerable <string> procargs, bool spawnNewConsoleWindow, TraceOptions traceOptions) { using (var process = new ProcessCreator(procargs) { SpawnNewConsoleWindow = spawnNewConsoleWindow }) { process.StartSuspended(); using (var kernelTraceCollector = new TraceCollector(KernelTraceEventParser.KernelSessionName)) using (var customTraceCollector = new TraceCollector(WinTraceUserTraceSessionName)) { InitializeProcessHandlers(kernelTraceCollector, customTraceCollector, process.ProcessId, traceOptions); ThreadPool.QueueUserWorkItem((o) => { process.Join(); StopCollectors(kernelTraceCollector, customTraceCollector); stopEvent.Set(); }); stopTraceCollectors = () => { StopCollectors(kernelTraceCollector, customTraceCollector); }; ThreadPool.QueueUserWorkItem((o) => { kernelTraceCollector.Start(); }); ThreadPool.QueueUserWorkItem((o) => { customTraceCollector.Start(); }); Thread.Sleep(1000); // resume thread process.Resume(); stopEvent.WaitOne(); } } }
public void Append(ICountableLookup lookup, IProcess caller, IReadOnlySlimRow[] filterRows) { var process = ProcessCreator.Invoke(filterRows); var rows = process.Evaluate(caller).TakeRowsAndReleaseOwnership(); var rowCount = 0; foreach (var row in rows) { rowCount++; string key = null; try { key = KeyGenerator(row); } catch (EtlException) { throw; } catch (Exception) { var exception = new ProcessExecutionException(caller, row, nameof(RowLookupBuilder) + " failed"); throw exception; } if (string.IsNullOrEmpty(key)) { continue; } lookup.AddRow(key, row); } caller?.Context.Log(LogSeverity.Debug, caller, "fetched {RowCount} rows, lookup size is {LookupSize}", rowCount, lookup.Count); }
internal override ProcessResult Prepare(ProcessResult processResult) { processResult = base.Prepare(processResult); if (processResult.State == ProcessState.Error) { return(processResult); } var udidName = Guid.NewGuid().ToString(); logger.MoveSrcToTempDir(); FilesHelper.MoveToTemp(WorkingDir, SRC_FILE_NAME, udidName + SRC_EXT); logger.CreateProcess(CREATE_ARGS); Process proc = ProcessCreator.Create(WorkingDir, CREATE_ARGS); logger.CreateConsoleProject(); processResult = ExecuteProcess <CreateDotNetConsoleProjectFailed>(proc, processResult); if (processResult.State == ProcessState.Error) { logger.CreateConsoleProject(false); logger.EndWriting(); return(processResult); } logger.CreateConsoleProject(true); logger.MoveSrcToWorkingDir(); FilesHelper.MoveFromTemp(WorkingDir, udidName + SRC_EXT, SRC_FILE_NAME); return(processResult); }
Process PreloadTestRunner() { Process preload = ProcessCreator.CreateTestRunnerProc( string.Format("preload \"{0}\"", mPathToAssemblies), mPathToAssemblies); preload.Start(); return(preload); }
// In windows fpc -version returned ExitCode = 1, while version is successfully printed, and compilation works internal override ProcessResult TestBuildSystem(ProcessResult processResult) { logger.TestBuildSystem(); processResult.Status = BuildStatus.BuildSystemTest; logger.CreateProcess(VersionCheckParams); Process proc = ProcessCreator.Create(WorkingDir, VersionCheckParams); processResult = ExecuteTestBuildProcess <BuildSystemNotFound>(proc, processResult); if (processResult.State == ProcessState.Error) { logger.TestBuildSystem(false); logger.EndWriting(); } else { logger.TestBuildSystem(true); } return(processResult); }
private static void RunServerProcess(string[] args) { var filename = args[0]; var port = GetTcpPort(args); var profileServerFlag = GetProfileServerFlag(args); Logger.LogInfo("Server image file name is: {0}", filename); Logger.LogInfo("TCP port is: {0}", port); Logger.LogInfo("Profile server flag is: {0}", profileServerFlag); if (profileServerFlag) { Debug.WriteLine("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); Debug.WriteLine(string.Format("Run server executable with argument (i.e. tcp port number) {0}", port)); Debug.WriteLine("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); } else { using (var job = new JobObject()) { // Create a new Job for this process and its children. Logger.LogInfo("Creating job."); job.AddCurrentProcess(); Logger.LogInfo("Job created successfully."); // Create the child process and redirect stdin, stdout, stderr. var argumentLine = (port.HasValue ? port.Value.ToString() : ""); Logger.LogInfo("Creating server process."); using (var createProcessResult = new ProcessCreator().CreateProcess(filename, argumentLine, CreateProcessOptions.Default)) { Logger.LogInfo("Server process created successfully (pid={0}).", createProcessResult.Process.Id); Logger.LogInfo("Waiting for server process to exit."); createProcessResult.Process.WaitForExit(); Logger.LogInfo("Server process exit code: 0x{0:x8}.", createProcessResult.Process.ExitCode); } } Logger.LogInfo("Exiting normally."); } }
protected Process LaunchPackageUpdaterTestsAppWithArgs(out FileInfo appFile, string appName, string testSubfolderName, bool waitForExit) { appFile = TestAppProvider.ExtractApp(appName, testSubfolderName, this.Log); Arguments args = new Arguments { ApiUrl = this.BaseUrl }; args.TelemetryKey = Apps.Keys.PackageUpdaterClient; Process process = ProcessCreator.Create(appFile, args, this.outputs, this.errors); this.Log($"Started process: {appFile.FullName}"); process.Start(); process.BeginOutputReadLine(); process.BeginErrorReadLine(); if (waitForExit) { process.WaitForExit(); this.Log($"Finished process: {appFile.FullName}"); } return(process); }