-
Notifications
You must be signed in to change notification settings - Fork 326
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Async execution improvements (#12282)
- Close enso-org/cloud-v2#1739 - Invalidate executions periodically (every minute) to make sure they are up to date - Fix path for deleting project executions - Use ISO dates for all dates - including the date input - Fix not being able to edit dates - Add combo box for selecting timezone - Hide selected option in dropdown so that it does not show up twice - Completely hide advanced options (execution time limit, parallel mode) by default - Rename "X of month" to "Monthly on X" - Change "daily" repeat type to mean every day - Add "weekly" repeat type - Remove "hourly" repeat type - Show count of executions per day in calendar cells instead of list of times - Only show three next repeat dates, and move to end -⚠️ Not yet using the new endpoint yet to fetch execution status # Important Notes None
- Loading branch information
1 parent
d688c38
commit fb690e6
Showing
48 changed files
with
2,063 additions
and
844 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 37 additions & 68 deletions
105
app/common/src/services/Backend/__test__/projectExecution.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,100 +1,69 @@ | ||
import { ZonedDateTime } from '@internationalized/date' | ||
import * as v from 'vitest' | ||
import { toRfc3339 } from '../../../utilities/data/dateTime' | ||
import { IanaTimeZone, toRfc3339 } from '../../../utilities/data/dateTime' | ||
import { ProjectExecutionInfo, ProjectId } from '../../Backend' | ||
import { firstProjectExecutionOnOrAfter, nextProjectExecutionDate } from '../projectExecution' | ||
|
||
const HOURLY_EXECUTION_1: ProjectExecutionInfo = { | ||
projectId: ProjectId('project-aaaaaaaa'), | ||
repeat: { | ||
type: 'hourly', | ||
startHour: 7, | ||
endHour: 15, | ||
}, | ||
startDate: toRfc3339(new Date(2020, 0, 1, 10, 59)), | ||
timeZone: 'UTC', | ||
maxDurationMinutes: 60, | ||
parallelMode: 'ignore', | ||
} | ||
const TIME_ZONE = 'America/Los_Angeles' | ||
const TIME_ZONE_WINTER_OFFSET = -28800000 | ||
const TIME_ZONE_SUMMER_OFFSET = -25200000 | ||
|
||
const HOURLY_EXECUTION_2: ProjectExecutionInfo = { | ||
const WEEKLY_EXECUTION: ProjectExecutionInfo = { | ||
projectId: ProjectId('project-aaaaaaaa'), | ||
repeat: { | ||
type: 'hourly', | ||
startHour: 20, | ||
endHour: 4, | ||
}, | ||
startDate: toRfc3339(new Date(2015, 2, 8, 22, 33)), | ||
timeZone: 'UTC', | ||
maxDurationMinutes: 60, | ||
parallelMode: 'ignore', | ||
} | ||
|
||
const DAILY_EXECUTION: ProjectExecutionInfo = { | ||
projectId: ProjectId('project-aaaaaaaa'), | ||
repeat: { | ||
type: 'daily', | ||
type: 'weekly', | ||
daysOfWeek: [0, 5], | ||
}, | ||
startDate: toRfc3339(new Date(2000, 0, 1, 7, 3)), | ||
timeZone: 'UTC', | ||
startDate: toRfc3339( | ||
new ZonedDateTime(2000, 1, 1, TIME_ZONE, TIME_ZONE_WINTER_OFFSET, 7, 3).toDate(), | ||
), | ||
endDate: null, | ||
timeZone: IanaTimeZone('UTC'), | ||
maxDurationMinutes: 60, | ||
parallelMode: 'ignore', | ||
} | ||
|
||
v.test.each([ | ||
{ | ||
info: DAILY_EXECUTION, | ||
current: new Date(2000, 5, 4, 7, 3), | ||
next1: new Date(2000, 5, 9, 7, 3), | ||
next2: new Date(2000, 5, 11, 7, 3), | ||
next3: new Date(2000, 5, 16, 7, 3), | ||
}, | ||
{ | ||
info: HOURLY_EXECUTION_1, | ||
current: new Date(2022, 10, 21, 14, 59), | ||
next1: new Date(2022, 10, 21, 15, 59), | ||
next2: new Date(2022, 10, 22, 7, 59), | ||
next3: new Date(2022, 10, 22, 8, 59), | ||
}, | ||
{ | ||
info: HOURLY_EXECUTION_2, | ||
current: new Date(2018, 4, 11, 3, 33), | ||
next1: new Date(2018, 4, 11, 4, 33), | ||
next2: new Date(2018, 4, 11, 20, 33), | ||
next3: new Date(2018, 4, 11, 21, 33), | ||
}, | ||
{ | ||
info: HOURLY_EXECUTION_2, | ||
current: new Date(2018, 4, 11, 23, 33), | ||
next1: new Date(2018, 4, 12, 0, 33), | ||
next2: new Date(2018, 4, 12, 1, 33), | ||
next3: new Date(2018, 4, 12, 2, 33), | ||
info: WEEKLY_EXECUTION, | ||
current: new ZonedDateTime(2000, 6, 4, TIME_ZONE, TIME_ZONE_SUMMER_OFFSET, 7, 3), | ||
next1: new ZonedDateTime(2000, 6, 9, TIME_ZONE, TIME_ZONE_SUMMER_OFFSET, 7, 3), | ||
next2: new ZonedDateTime(2000, 6, 11, TIME_ZONE, TIME_ZONE_SUMMER_OFFSET, 7, 3), | ||
next3: new ZonedDateTime(2000, 6, 16, TIME_ZONE, TIME_ZONE_SUMMER_OFFSET, 7, 3), | ||
}, | ||
] satisfies readonly { | ||
info: ProjectExecutionInfo | ||
current: Date | ||
next1: Date | ||
next2: Date | ||
next3: Date | ||
current: ZonedDateTime | ||
next1: ZonedDateTime | ||
next2: ZonedDateTime | ||
next3: ZonedDateTime | ||
}[])( | ||
'Get next project execution date (current: $current)', | ||
({ info, current, next1, next2, next3 }) => { | ||
v.expect(nextProjectExecutionDate(info, current)).toStrictEqual(next1) | ||
v.expect(nextProjectExecutionDate(info, next1)).toStrictEqual(next2) | ||
v.expect(nextProjectExecutionDate(info, next2)).toStrictEqual(next3) | ||
v.expect(nextProjectExecutionDate(info, current)?.toString()).toBe(next1.toString()) | ||
v.expect(nextProjectExecutionDate(info, next1)?.toString()).toBe(next2.toString()) | ||
v.expect(nextProjectExecutionDate(info, next2)?.toString()).toBe(next3.toString()) | ||
}, | ||
) | ||
|
||
v.test.each([ | ||
{ info: DAILY_EXECUTION, current: new Date(1999, 1, 1), next: new Date(2000, 0, 2, 7, 3) }, | ||
{ info: DAILY_EXECUTION, current: new Date(2000, 10, 16), next: new Date(2000, 10, 17, 7, 3) }, | ||
{ | ||
info: WEEKLY_EXECUTION, | ||
current: new ZonedDateTime(1999, 1, 1, TIME_ZONE, TIME_ZONE_WINTER_OFFSET), | ||
next: new ZonedDateTime(2000, 1, 2, TIME_ZONE, TIME_ZONE_WINTER_OFFSET, 7, 3), | ||
}, | ||
{ | ||
info: WEEKLY_EXECUTION, | ||
current: new ZonedDateTime(2000, 11, 16, TIME_ZONE, TIME_ZONE_WINTER_OFFSET), | ||
next: new ZonedDateTime(2000, 11, 17, TIME_ZONE, TIME_ZONE_WINTER_OFFSET, 7, 3), | ||
}, | ||
] satisfies readonly { | ||
info: ProjectExecutionInfo | ||
current: Date | ||
next: Date | ||
current: ZonedDateTime | ||
next: ZonedDateTime | ||
}[])( | ||
'Get first project execution date on or after (current: $current)', | ||
({ info, current, next }) => { | ||
v.expect(firstProjectExecutionOnOrAfter(info, current)).toStrictEqual(next) | ||
v.expect(firstProjectExecutionOnOrAfter(info, current).toString()).toBe(next.toString()) | ||
}, | ||
) |
Oops, something went wrong.