예제 #1
0
        public ScheduleResult ScheduleSnakepitJob(
            [FromServices] ISchedulerProxy scheduler,
            [FromQuery] Guid projectUid,
            [FromQuery] string fileName
            )
        {
            //The URL to get the export data is in snakepit construct url from configuration
            var snakepitHost = ConfigStore.GetValueString("SNAKEPIT_HOST", null);

            if (!string.IsNullOrEmpty(snakepitHost))
            {
                var exportDataUrl =
                    $"{HttpContext.Request.Scheme}://{snakepitHost}/export{HttpContext.Request.QueryString.ToString()}";

                return(ScheduleJob(exportDataUrl, fileName, scheduler, 3 * FIVE_MIN_SCHEDULER_TIMEOUT));
            }

            throw new ServiceException(HttpStatusCode.InternalServerError,
                                       new ContractExecutionResult(
                                           ContractExecutionStatesEnum.InternalProcessingError,
                                           "Missing SNAKEPIT_HOST environment variable"
                                           )
                                       );
        }