-
Notifications
You must be signed in to change notification settings - Fork 25
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
added retry & timeout fields #371
base: main
Are you sure you want to change the base?
Conversation
Thanks for submitting your first pull request! You are awesome! 🤗 |
for more information, see https://pre-commit.ci
src/util/job-name-validation.tsx
Outdated
@@ -5,6 +5,7 @@ import { TranslationBundle } from '@jupyterlab/translation'; | |||
const jobNameRegex = /^[a-zA-Z0-9._][a-zA-Z0-9._ -]{0,62}$/; | |||
const invalidFirstCharRegex = /^[^a-zA-Z0-9._]/; | |||
const invalidCharRegex = /[^a-zA-Z0-9._ -]/g; | |||
const validIntegerRregex = /^[+]?[1-9]\d*$/; |
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.
Rregex
is misspelled.
I don't see a reason why zero-prefixed integers like 035
should be rejected, since they'll resolve to valid numeric values anyway. The +
is redundant in this case. This could be simplified to /^\d+$/
.
const handleNumericInputChange = (event: ChangeEvent<HTMLInputElement>) => { | ||
const target = event.target; | ||
|
||
const parameterNameIdx = parameterNameMatch(target.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 code is copied from the code for setting parameters, which have user-provided names and values. Your change is intended to add input fields with only user-provided values.
src/mainviews/create-job.tsx
Outdated
name="maxRetryAttempts" | ||
/> | ||
<TextField | ||
label={trans.__('Max Run Time (In Seconds)')} |
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.
label={trans.__('Max Run Time (In Seconds)')} | |
label={trans.__('Maximum Run Time (seconds)')} |
"Maximum" was not abbreviated above
src/mainviews/create-job.tsx
Outdated
name="maxRunTime" | ||
/> | ||
<TextField | ||
label={trans.__('Max Wait Time (In Seconds)')} |
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.
label={trans.__('Max Wait Time (In Seconds)')} | |
label={trans.__('Maximum Wait Time (seconds)')} |
|
||
export function MaxRetryAttemptsError(maxRetryAttempts: string, trans: TranslationBundle): string { | ||
// Check for blank | ||
if (maxRetryAttempts === '') { |
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 an optional parameter, since existing users editing job definitions will not have these values set.
|
||
if (!validIntegerRregex.test(maxWaitTime)) { | ||
return trans.__( | ||
'Max wait time must be an integer' |
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.
'Max wait time must be an integer' | |
'Must be an integer, %1 or greater', minWaitTime |
const integerValue = +maxWaitTime | ||
// Check for length. | ||
if (integerValue < 1) { | ||
return trans.__('Max wait time must be greater than 1'); |
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.
return trans.__('Max wait time must be greater than 1'); | |
return trans.__('Must be an integer, %1 or greater', minWaitTime) |
} | ||
const integerValue = +maxWaitTime | ||
// Check for length. | ||
if (integerValue < 1) { |
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 a symbolic constant
); | ||
} | ||
const integerValue = +maxWaitTime | ||
// Check for length. |
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.
Fix or delete this comment
); | ||
} | ||
const integerValue = +maxRunTime | ||
// Check for length. |
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.
Fix or delete this comment
(Added by @JasonWeill: This fixes #169.)