Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/argv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,9 @@ export class Argv {
return this.map.get("privileged") ?? false;
}

get device (): string | null {
const device = this.map.get("device");
if (!device) return null;
return device;
get device (): string[] {
const val = this.map.get("device") ?? [];
return typeof val == "string" ? val.split(" ") : val;
}

get ulimit (): string | null {
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ process.on("SIGUSR2", async () => await cleanupJobResources(jobs));
requiresArg: false,
})
.option("device", {
type: "string",
description: "Set docker executor device option",
type: "array",
description: "Add devices to docker executor",
requiresArg: false,
})
.option("ulimit", {
Expand Down
8 changes: 4 additions & 4 deletions src/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -837,8 +837,8 @@ export class Job {
dockerCmd += "--privileged ";
}

if (this.argv.device) {
dockerCmd += `--device=${this.argv.device} `;
for (const device of this.argv.device) {
dockerCmd += `--device ${device} `;
}

if (this.argv.ulimit !== null) {
Expand Down Expand Up @@ -1418,8 +1418,8 @@ export class Job {
dockerCmd += "--privileged ";
}

if (this.argv.device) {
dockerCmd += `--device=${this.argv.device} `;
for (const device of this.argv.device) {
dockerCmd += `--device ${device} `;
}

if (this.argv.ulimit !== null) {
Expand Down