public void Start(string[] args)
        {
            var options = new Options();

            if (CommandLine.Parser.Default.ParseArguments(args, options))
            {
                IModeRunner modeRunner = ModeRunnerFactory.getRunner(options.Mode, options);

                modeRunner.ValidateOptions();
                modeRunner.Run();
            }
        }
示例#2
0
        public int Launch()
        {
            CommonOptions      commonOptions = _modeRunner.CommonOptions;
            IDirectoryLocation outFolder     = commonOptions.OutputDirectory;
            var log   = outFolder.GetFileLocation("CanvasLog.txt");
            var error = outFolder.GetFileLocation("CanvasError.txt");

            using (ILogger logger = new Logger(log, error))
            {
                try
                {
                    logger.Info($"Running Canvas {_mode} {_version}");
                    logger.Info($"Command-line arguments: {string.Join(" ", _args)}");
                    var checkpointRunner =
                        GetCheckpointRunner(
                            logger,
                            outFolder,
                            commonOptions.StartCheckpoint,
                            commonOptions.StopCheckpoint,
                            commonOptions.WholeGenomeFasta);
                    using (var manager = checkpointRunner.Manager)
                    {
                        IDirectoryLocation loggingFolder = outFolder.CreateSubdirectory("Logging");
                        IsasConfiguration  config        = IsasConfiguration.GetConfiguration();
                        IWorkManager       workManager   = new LocalWorkManager(logger, loggingFolder, 0, config.MaximumMemoryGB, config.MaximumHoursPerProcess);
                        _modeRunner.Run(logger, checkpointRunner, workManager);
                        manager.CheckFinalState();
                    }
                }
                catch (StopCheckpointFoundException) { }
                catch (Exception e)
                {
                    logger.Error($"Canvas workflow error: {e}");
                    return(-1);
                }
            }
            return(0);
        }
示例#3
0
        public int Launch()
        {
            try
            {
                var executableProcessor = new ExecutableProcessor(_settings, _logger);
                var runtimeExecutable   = new FileLocation(executableProcessor.GetEnvironmentExecutablePath("dotnet"));

                ICommandFactory GetDotnetCommand(string component)
                {
                    return(new CommandManager(executableProcessor).GetDotnetCommandFactory($"{component}.dll", component));
                }
                _logger.Info($"Running Canvas {_mode} {_version}");
                _logger.Info($"Command-line arguments: {string.Join(" ", _args)}");
                var runnerFactory = new CanvasRunnerFactory(_logger, _checkpointRunner, _workDoer, runtimeExecutable, GetDotnetCommand);
                _modeRunner.Run(runnerFactory);
                return(0);
            }
            catch (Exception e)
            {
                _logger.Error($"Canvas workflow error: {e}");
                return(-1);
            }
        }
示例#4
0
        public int Launch()
        {
            CommonOptions      commonOptions = _modeRunner.CommonOptions;
            IDirectoryLocation outFolder     = commonOptions.OutputDirectory;
            var log   = outFolder.GetFileLocation("CanvasLog.txt");
            var error = outFolder.GetFileLocation("CanvasError.txt");
            IsasConfiguration  config     = IsasConfiguration.GetConfiguration();
            IDirectoryLocation genomeRoot = commonOptions.WholeGenomeFasta?.Parent?.Parent?.Parent?.Parent?.Parent;
            int returnValue = 0;

            IsasFrameworkFactory.RunWithIsasFramework(outFolder, log, error, commonOptions.StartCheckpoint, commonOptions.StopCheckpoint, 0,
                                                      config.MaximumMemoryGB, config.MaximumHoursPerProcess, false, genomeRoot,
                                                      frameworkServices =>
            {
                var logger = frameworkServices.Logger;
                try
                {
                    var executableProcessor = new ExecutableProcessor(new NullSampleSettings(), logger);
#if DotNetCore
                    var runtimeExecutable = new FileLocation(executableProcessor.GetEnvironmentExecutablePath("dotnet"));
#else
                    var runtimeExecutable = CrossPlatform.IsThisLinux() ? new FileLocation(executableProcessor.GetMonoPath()) : null;
#endif
                    frameworkServices.Logger.Info($"Running Canvas {_mode} {_version}");
                    logger.Info($"Command-line arguments: {string.Join(" ", _args)}");
                    _modeRunner.Run(logger, frameworkServices.Checkpointer, frameworkServices.WorkManager, runtimeExecutable);
                    returnValue = 0;
                }
                catch (Exception e)
                {
                    logger.Error($"Canvas workflow error: {e}");
                    returnValue = -1;
                }
            });
            return(returnValue);
        }