public async Task <ExecuteJobResponse> ExecuteJob( ExecuteJobRequestBody request ) { int jobIndex = GenerateNextJobIndex(); string tag = $"antling-job-{jobIndex}"; string buildLog = await imageBuilder.Build(request.Image, tag); // TODO: run a container with the image string containerLog = await docker.Run(new DockerRunOptions { Image = tag, Rm = true, Name = $"antling_job_container_{jobIndex}" }); // TODO: enforce time constraints // TODO: extract results from the container // TODO: destroy the container await docker.Rmi(tag); return(new ExecuteJobResponse { ImageBuildLog = buildLog, ContainerLog = containerLog, Results = null }); }
public async Task <ExecuteJobResponse> ExecuteJob( [FromBody] ExecuteJobRequestBody body, [FromServices] JobRunner runner ) { logger.LogInformation("Running a new job."); return(await runner.ExecuteJob(body)); }