Ejemplo n.º 1
0
        public async Task <RunResult> RunAlgorithmAsync(string codeName, IEnumerable <object> arguments, int?timeout = null)
        {
            using (UnitOfWorkProvider.Create(DbContextOptions.DisableTransactionMode))
            {
                var algorithm = await _algorithmRepository.GetByCodeNameWithArgs(codeName);

                if (algorithm == null)
                {
                    throw new NotFoundException("Given algorithm codeName doesn't exists");
                }

                var args = _argumentTranslator.Process(arguments);

                // Create Run In Db
                return(await CreateRunAndLaunch(algorithm, args, timeout));
            }
        }
Ejemplo n.º 2
0
        public async Task <AlgorithmDTO> Get(string codeName)
        {
            using (UnitOfWorkProvider.Create())
            {
                var entity = await _algorithmRepository.GetByCodeNameWithArgs(codeName);

                if (entity == null)
                {
                    throw new NotFoundException("Given algorithm codeName doesn't exists");
                }

                return(new AlgorithmDTO
                {
                    CodeName = entity.CodeName,
                    Description = entity.Description,
                    Title = entity.Title
                });
            }
        }