diff --git a/src/components/c2d/compute_engine_docker.ts b/src/components/c2d/compute_engine_docker.ts index 75a5aecbb..bd62a03d4 100644 --- a/src/components/c2d/compute_engine_docker.ts +++ b/src/components/c2d/compute_engine_docker.ts @@ -491,9 +491,18 @@ export class C2DEngineDocker extends C2DEngine { if (job.status === C2DStatusNumber.ConfiguringVolumes) { // create the volume & create container // TO DO C2D: Choose driver & size + // get env info + const environment = await this.getJobEnvironment(job) + const volume: VolumeCreateOptions = { Name: job.jobId + '-volume' } + // volume + if (environment != null) { + volume.DriverOpts = { + size: environment.diskGB > 0 ? `${environment.diskGB}G` : '1G' + } + } try { await this.docker.createVolume(volume) } catch (e) { @@ -503,8 +512,7 @@ export class C2DEngineDocker extends C2DEngine { await this.db.updateJob(job) await this.cleanupJob(job) } - // get env info - const environment = await this.getJobEnvironment(job) + // create the container const mountVols: any = { '/data': {} } let hostConfig: HostConfig = { @@ -518,7 +526,10 @@ export class C2DEngineDocker extends C2DEngine { ] } if (environment != null) { - // limit container CPU & Memory usage according to env specs + // storage (container) + hostConfig.StorageOpt = { + size: environment.diskGB > 0 ? `${environment.diskGB}G` : '1G' + } hostConfig = { ...hostConfig, ...(await buildCPUAndMemoryConstraints(environment, this.docker))