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

Async execution improvements #12282

Open
wants to merge 79 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
1882b3b
Fix Bazel on NixOS
somebody1234 Jan 16, 2025
1102878
Rename monthly repeat periods for schedules
somebody1234 Feb 7, 2025
58165d5
Add "weekly" repeat type alongside "daily" repeat type
somebody1234 Feb 7, 2025
9b2eda4
Split project schedule date input to date and timezone inputs (time
somebody1234 Feb 7, 2025
574d9bd
WIP: Time field for schedule
somebody1234 Feb 7, 2025
3f4dee5
Add devtools option to hide advanced project schedule options
somebody1234 Feb 7, 2025
8831eb5
Default months input for "new schedule" form to all months
somebody1234 Feb 10, 2025
ce77e77
Remove "hourly" repeat type
somebody1234 Feb 10, 2025
922d98e
Show 3 repeats vertically
somebody1234 Feb 10, 2025
edeea05
Remove hourly repeat type
somebody1234 Feb 10, 2025
aafc8eb
Fix error
somebody1234 Feb 10, 2025
703dfbb
Show executions count instead of list of times in calendar
somebody1234 Feb 10, 2025
58f71c2
Fix "delete execution" path...
somebody1234 Feb 10, 2025
5bc3431
Add stale time to "list project executions" query; extract to hook
somebody1234 Feb 11, 2025
df04156
Move project execution repeat times to end of form
somebody1234 Feb 11, 2025
58c656e
Use ISO date for date input
somebody1234 Feb 11, 2025
68f6267
Use ISO date for calendar text
somebody1234 Feb 11, 2025
70fc984
Fix clicking on execution count
somebody1234 Feb 11, 2025
ffcd8d9
Use ISO format for repeat dates
somebody1234 Feb 11, 2025
4a2aa20
Hide currently selected dropdown option to avoid repeating text
somebody1234 Feb 11, 2025
4d0f343
Adjust time zone ComboBox size
somebody1234 Feb 11, 2025
1a34f3e
Fix time field
somebody1234 Feb 11, 2025
799a6c4
Merge time field back into date picker for "new project excecution" d…
somebody1234 Feb 11, 2025
22186d4
Fix focus issues for date picker
somebody1234 Feb 11, 2025
d2d3cb5
Partially fix `ComboBox` performance issues
somebody1234 Feb 12, 2025
c48ad2e
Fix `ComboBox` filtering
somebody1234 Feb 12, 2025
2ea9afd
Formatting
somebody1234 Feb 12, 2025
c600e30
Fix computing repeat dates of executions
somebody1234 Feb 12, 2025
4c316b5
WIP: Fix project execution repeats
somebody1234 Feb 12, 2025
10682e3
Show validation issues in dev mode
somebody1234 Feb 12, 2025
fd9a90d
Switch `firstProjectExecutionOnOrAfter` to use `ZonedDateTime`
somebody1234 Feb 12, 2025
b67dcb3
Use `ZonedDateTime` in project execution components
somebody1234 Feb 12, 2025
763d6de
Fix project schedule tests
somebody1234 Feb 13, 2025
9093495
Fix broken `ComboBox` input; WIP: Minimal view for `ProjectExecution`…
somebody1234 Feb 14, 2025
da2899a
Minimal view for `ProjectExecution`s listed in calendar
somebody1234 Feb 14, 2025
208625f
Fix visual tooltips in minimal `ProjectExecution` view
somebody1234 Feb 14, 2025
9fc8d4c
Fix timezone issues with repeat times
somebody1234 Feb 14, 2025
b7f4d05
Add `getProjectExecutionDetails` endpoint wrapper function
somebody1234 Feb 14, 2025
d6d31e0
Show session details for project executions with asssociated sessions
somebody1234 Feb 14, 2025
be60ec4
Merge branch 'develop' into wip/sb/async-execution-improvements
somebody1234 Feb 17, 2025
441c2fa
Fix logs icon
somebody1234 Feb 17, 2025
a195674
Fix type error
somebody1234 Feb 17, 2025
731061f
Select all days by default when repeating weekly
somebody1234 Feb 18, 2025
e585f17
Update feature flags defaults
somebody1234 Feb 18, 2025
76ca5c2
Merge branch 'develop' into wip/sb/async-execution-improvements
somebody1234 Feb 18, 2025
047a9ca
`MultiSelector` variant with separated options
somebody1234 Feb 18, 2025
0f5ef3e
Consistent width for "New Schedule" inputs
somebody1234 Feb 18, 2025
3c00ae3
[dashboard/DateInput] More spacing between date and time
somebody1234 Feb 18, 2025
570e493
[dashboard/ComboBox] Fix value passed to `onChange` event
somebody1234 Feb 18, 2025
4637921
[dashboard/Dropdown] WIP: Consistent sizing with inputs
somebody1234 Feb 18, 2025
ca7a5a7
[dashboard/NewProjectExecutionModal] Stop grouping repeat time and ti…
somebody1234 Feb 18, 2025
a05aeac
[dashboard/NewProjectExecutionModal] Adjust input width to be wide en…
somebody1234 Feb 18, 2025
76a6fed
[dashboard/Dropdown] Add rounding variants
somebody1234 Feb 18, 2025
5d34018
[dashboard/AriaComponents] Add rounding to other components
somebody1234 Feb 18, 2025
dfc7b9c
[dashboard/DatePicker] Fix styling
somebody1234 Feb 18, 2025
42b8ae7
[dashboard/Dropdown] Fix resize when focusing/unfocusing
somebody1234 Feb 18, 2025
038d8a5
[dashboard/MultiSelector] Format stories
somebody1234 Feb 18, 2025
699aba3
[dashboard/DatePicker] Add stories
somebody1234 Feb 18, 2025
4d515c6
[dashboard/ComboBox] Add stories
somebody1234 Feb 18, 2025
6ea4a5c
[dashboard/Dropdown] Add stories
somebody1234 Feb 18, 2025
0e97462
[dashboard/NewProjectExecutionModal] Limit timezones to whitelisted set
somebody1234 Feb 18, 2025
2321fa7
[dashboard/NewProjectExecutionModal] Compute GMT offset for timezones
somebody1234 Feb 18, 2025
f017bb4
[dashboard/Dropdown] Remove broken story
somebody1234 Feb 19, 2025
7b4229b
Merge branch 'develop' into wip/sb/async-execution-improvements
somebody1234 Feb 19, 2025
0505708
[ts-common/projectExecution] Remove repeats for executions of type "n…
somebody1234 Feb 19, 2025
55fe5df
[dashboard/NewProjectExecutionModal] Hide "Repeats at" text when choo…
somebody1234 Feb 19, 2025
17d8990
Merge branch 'develop' into wip/sb/async-execution-improvements
somebody1234 Feb 19, 2025
af118ca
[ts/Backend] Make repeat types camelCase
somebody1234 Feb 19, 2025
6497d51
Adjust API
somebody1234 Feb 20, 2025
4c6adbd
[dashboard/NewProjectExecutionModal] Unconditionally disable `Monthly…
somebody1234 Feb 20, 2025
21db092
[dashboard/NewProjectExecutionModal] Fix incorrect week number for 7t…
somebody1234 Feb 20, 2025
d45cf6e
[ts/dateTime] Move constants and functions from `dashboard/NewProject…
somebody1234 Feb 20, 2025
a612011
[ts/dateTime] Fix `getDay` to use 0 = Monday instead of 0 = Sunday to…
somebody1234 Feb 20, 2025
24b1ee0
[ts/dateTime] Reorder day of week arrays
somebody1234 Feb 20, 2025
9b46540
[ts/projectExecution] Fix type errors
somebody1234 Feb 20, 2025
0503420
[dashboard/NewProjectExecutionModal] Fix bugs
somebody1234 Feb 20, 2025
42067c6
[ts/projectExecution] Revert repeat type to camelCase
somebody1234 Feb 20, 2025
e97ac6e
Merge branch 'develop' into wip/sb/async-execution-improvements
somebody1234 Feb 20, 2025
8fe4dea
[ts/projectExecution] Fix more bugs
somebody1234 Feb 20, 2025
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
1 change: 1 addition & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ test --test_output=errors
build --show_result=20
build --reuse_sandbox_directories
build --nolegacy_external_runfiles
build --incompatible_strict_action_env
build --noexperimental_check_output_files --experimental_allow_tags_propagation
fetch --noexperimental_check_output_files --experimental_allow_tags_propagation
query --noexperimental_check_output_files --experimental_allow_tags_propagation
Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@tanstack/vue-query": "5.59.20"
},
"dependencies": {
"@internationalized/date": "3.7.0",
"@tanstack/query-persist-client-core": "5.59.20",
"@tanstack/vue-query": "5.59.20",
"@types/node": "^20.11.21",
Expand Down
51 changes: 28 additions & 23 deletions app/common/src/services/Backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,20 +381,20 @@ export type ProjectParallelMode = (typeof PROJECT_PARALLEL_MODES)[number]

export const PROJECT_EXECUTION_REPEAT_TYPES = [
'none',
'hourly',
'daily',
'monthly-date',
'monthly-weekday',
'monthly-last-weekday',
'weekly',
'monthlyDate',
'monthlyWeekday',
'monthlyLastWeekday',
] as const

export const PROJECT_EXECUTION_REPEAT_TYPE_TO_TEXT_ID = {
none: 'noneProjectExecutionRepeatType',
hourly: 'hourlyProjectExecutionRepeatType',
daily: 'dailyProjectExecutionRepeatType',
'monthly-date': 'monthlyProjectExecutionRepeatType',
'monthly-weekday': 'monthlyProjectExecutionRepeatType',
'monthly-last-weekday': 'monthlyProjectExecutionRepeatType',
weekly: 'weeklyProjectExecutionRepeatType',
monthlyDate: 'monthlyProjectExecutionRepeatType',
monthlyWeekday: 'monthlyProjectExecutionRepeatType',
monthlyLastWeekday: 'monthlyProjectExecutionRepeatType',
} satisfies {
readonly [K in ProjectExecutionRepeatType]: TextId & `${string}ProjectExecutionRepeatType`
}
Expand All @@ -407,22 +407,20 @@ export interface ProjectExecutionNoneRepeatInfo {
readonly type: 'none'
}

/** Details for a project execution that repeats hourly. */
export interface ProjectExecutionHourlyRepeatInfo {
readonly type: 'hourly'
readonly startHour: number
readonly endHour: number
}

/** Details for a project execution that repeats daily. */
export interface ProjectExecutionDailyRepeatInfo {
readonly type: 'daily'
}

/** Details for a project execution that repeats weekly on one or more days. */
export interface ProjectExecutionWeeklyRepeatInfo {
readonly type: 'weekly'
readonly daysOfWeek: readonly number[]
}

/** Details for a project execution that repeats monthly on a specific date. */
export interface ProjectExecutionMonthlyDateRepeatInfo {
readonly type: 'monthly-date'
readonly type: 'monthlyDate'
readonly date: number
readonly months: readonly number[]
}
Expand All @@ -432,7 +430,7 @@ export interface ProjectExecutionMonthlyDateRepeatInfo {
* of a specific month.
*/
export interface ProjectExecutionMonthlyWeekdayRepeatInfo {
readonly type: 'monthly-weekday'
readonly type: 'monthlyWeekday'
readonly weekNumber: number
readonly dayOfWeek: number
readonly months: readonly number[]
Expand All @@ -443,14 +441,14 @@ export interface ProjectExecutionMonthlyWeekdayRepeatInfo {
* of a specific month.
*/
export interface ProjectExecutionMonthlyLastWeekdayRepeatInfo {
readonly type: 'monthly-last-weekday'
readonly type: 'monthlyLastWeekday'
readonly dayOfWeek: number
readonly months: readonly number[]
}

export type ProjectExecutionRepeatInfo =
| ProjectExecutionHourlyRepeatInfo
| ProjectExecutionDailyRepeatInfo
| ProjectExecutionWeeklyRepeatInfo
| ProjectExecutionMonthlyDateRepeatInfo
| ProjectExecutionMonthlyWeekdayRepeatInfo
| ProjectExecutionMonthlyLastWeekdayRepeatInfo
Expand All @@ -459,18 +457,21 @@ export type ProjectExecutionRepeatInfo =
/** Metadata for a {@link ProjectExecution}. */
export interface ProjectExecutionInfo {
readonly projectId: ProjectId
readonly timeZone: string
readonly repeat: ProjectExecutionRepeatInfo
readonly parallelMode: ProjectParallelMode
readonly maxDurationMinutes: number
readonly startDate: dateTime.Rfc3339DateTime
readonly endDate: dateTime.Rfc3339DateTime | null
readonly timeZone: string
readonly maxDurationMinutes: number
readonly parallelMode: ProjectParallelMode
}

/** A specific execution schedule of a project. */
export interface ProjectExecution extends ProjectExecutionInfo {
readonly enabled: boolean
readonly executionId: ProjectExecutionId
readonly organizationId: OrganizationId
readonly versionId: S3ObjectVersionId
readonly nextExecution: dateTime.Rfc3339DateTime
readonly projectSessions?: readonly ProjectSession[]
}

/** Metadata describing the location of an uploaded file. */
Expand Down Expand Up @@ -1824,6 +1825,10 @@ export default abstract class Backend {
body: CreateProjectExecutionRequestBody,
title: string,
): Promise<ProjectExecution>
abstract getProjectExecutionDetails(
executionId: ProjectExecutionId,
title: string,
): Promise<ProjectExecution>
abstract updateProjectExecution(
executionId: ProjectExecutionId,
body: UpdateProjectExecutionRequestBody,
Expand Down
101 changes: 35 additions & 66 deletions app/common/src/services/Backend/__test__/projectExecution.test.ts
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 { 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)),
startDate: toRfc3339(
new ZonedDateTime(2000, 1, 1, TIME_ZONE, TIME_ZONE_WINTER_OFFSET, 7, 3).toDate(),
),
endDate: null,
timeZone: '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())
},
)
Loading
Loading