Skip to content

Commit

Permalink
remove some commented lines
Browse files Browse the repository at this point in the history
  • Loading branch information
paulo-ocean committed Dec 13, 2024
1 parent 910c5dc commit 5651337
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions src/components/c2d/compute_engine_docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,13 @@ import type {
ComputeResult,
DockerPlatform
} from '../../@types/C2D/C2D.js'
// import { getProviderFeeToken } from '../../components/core/utils/feesHandler.js'
import { getConfiguration } from '../../utils/config.js'
import { C2DEngine } from './compute_engine_base.js'
import { C2DDatabase } from '../database/C2DDatabase.js'
import { create256Hash } from '../../utils/crypt.js'
import { Storage } from '../storage/index.js'
import Dockerode from 'dockerode'
import type {
ContainerCreateOptions,
HostConfig,
// ContainerStats,
VolumeCreateOptions
} from 'dockerode'
import type { ContainerCreateOptions, HostConfig, VolumeCreateOptions } from 'dockerode'
import * as tar from 'tar'
import {
createWriteStream,
Expand Down Expand Up @@ -554,7 +548,6 @@ export class C2DEngineDocker extends C2DEngine {

try {
const container = await this.docker.createContainer(containerInfo)
// this.checkResources(job, container)
console.log('container: ', container)
job.status = C2DStatusNumber.Provisioning
job.statusText = C2DStatusText.Provisioning
Expand Down Expand Up @@ -594,7 +587,6 @@ export class C2DEngineDocker extends C2DEngine {
if (details.State.Running === false) {
try {
await container.start()
// this.checkResources(job, container)
job.isStarted = true
await this.db.updateJob(job)
return
Expand All @@ -612,7 +604,6 @@ export class C2DEngineDocker extends C2DEngine {
}
}
} else {
// this.checkResources(job, container)
// is running, we need to stop it..
console.log('running, need to stop it?')
const timeNow = Date.now() / 1000
Expand Down Expand Up @@ -670,21 +661,6 @@ export class C2DEngineDocker extends C2DEngine {
}
}

// Seems like monitoring container stats is useles... everything related with cpu/mem is at zeros
// private async checkResources(job: DBComputeJob, container: Dockerode.Container) {
// const environment = await this.getJobEnvironment(job)
// try {
// const statsRaw: any = await container.stats({ stream: false })
// const stats = await JSON.parse(
// JSON.stringify(statsRaw) // await streamToString(statsRaw as Readable))
// )
// const memory = stats.memory_stats
// const cpu = stats.cpu_stats
// } catch (e) {
// console.error('error getting stats: ', e)
// }
// }

// eslint-disable-next-line require-await
private async cleanupJob(job: DBComputeJob) {
// cleaning up
Expand Down

0 comments on commit 5651337

Please sign in to comment.