Skip to content
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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ogautamu
Copy link

@ogautamu ogautamu commented May 16, 2023

(Added by @JasonWeill: This fixes #169.)

@welcome
Copy link

welcome bot commented May 16, 2023

Thanks for submitting your first pull request! You are awesome! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please make sure you followed the pull request template, as this will help us review your contribution more quickly.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also a intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@ogautamu ogautamu marked this pull request as draft May 16, 2023 22:57
@github-actions
Copy link
Contributor

Binder 👈 Launch a Binder on branch ogautamu/jupyter-scheduler/retry-timeout

@@ -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*$/;
Copy link
Collaborator

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);
Copy link
Collaborator

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.

name="maxRetryAttempts"
/>
<TextField
label={trans.__('Max Run Time (In Seconds)')}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
label={trans.__('Max Run Time (In Seconds)')}
label={trans.__('Maximum Run Time (seconds)')}

"Maximum" was not abbreviated above

name="maxRunTime"
/>
<TextField
label={trans.__('Max Wait Time (In Seconds)')}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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 === '') {
Copy link
Collaborator

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'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'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');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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) {
Copy link
Collaborator

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.
Copy link
Collaborator

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.
Copy link
Collaborator

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

@dlqqq dlqqq added the enhancement New feature or request label May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI: Implement timeouts, retries for jobs
3 participants