-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cli): Add Concurrency for the make cog cli. #2640
Conversation
@@ -113,11 +118,17 @@ export class CommandCogCreate extends CommandLineAction { | |||
|
|||
const tmpFolder = await makeTempFolder(`basemaps-${job.id}-${CliId}`); | |||
|
|||
const Q = pLimit(this.concurrency?.value ? this.concurrency.value : DefaultConcurrency); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use ??
parameterLongName: '--concurrency', | ||
description: 'Number of concurrency create cog jobs', | ||
required: false, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to set the default concurrency value here via defaultValue
, rather than in a constant on line 24? That would mean we wouldn't need to check if it had been supplied every time it is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good point. This default value won't be set into this.concurrency.value
if this parameter not used, the use case is this.concurrency.defaultValue
, so we still need to check exists and set this.concurrency.defaultValue
in not exists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This default value won't be set into this.concurrency.value if this parameter not used, the use case is this.concurrency.defaultValue
That is just a typing problem, and one of the reasons I think we should change our cli parser.
if no value is provided, the this.concurrency.value
will be defaultValue
Array.from(names).map((name) => | ||
Q(async () => { | ||
const tiffJob = await CogStacJob.load(jobLocation); | ||
this.processTiff(tiffJob, name, tmpFolder, isCommit, logger.child({ tiffName: name })); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be awaited?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, just fixed.
Changes