Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- DropForeignKey
ALTER TABLE "public"."TaskRunExecutionSnapshot" DROP CONSTRAINT IF EXISTS "TaskRunExecutionSnapshot_batchId_fkey";

-- DropForeignKey
ALTER TABLE "public"."TaskRunExecutionSnapshot" DROP CONSTRAINT IF EXISTS "TaskRunExecutionSnapshot_environmentId_fkey";

-- DropForeignKey
ALTER TABLE "public"."TaskRunExecutionSnapshot" DROP CONSTRAINT IF EXISTS "TaskRunExecutionSnapshot_organizationId_fkey";

-- DropForeignKey
ALTER TABLE "public"."TaskRunExecutionSnapshot" DROP CONSTRAINT IF EXISTS "TaskRunExecutionSnapshot_projectId_fkey";

-- DropForeignKey
ALTER TABLE "public"."TaskRunExecutionSnapshot" DROP CONSTRAINT IF EXISTS "TaskRunExecutionSnapshot_workerId_fkey";
23 changes: 4 additions & 19 deletions internal-packages/database/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ model Organization {
organizationAccessTokens OrganizationAccessToken[]
workerGroups WorkerInstanceGroup[]
workerInstances WorkerInstance[]
executionSnapshots TaskRunExecutionSnapshot[]
githubAppInstallations GithubAppInstallation[]
}

Expand Down Expand Up @@ -326,7 +325,6 @@ model RuntimeEnvironment {
taskRunCheckpoints TaskRunCheckpoint[]
waitpoints Waitpoint[]
workerInstances WorkerInstance[]
executionSnapshots TaskRunExecutionSnapshot[]
waitpointTags WaitpointTag[]
BulkActionGroup BulkActionGroup[]

Expand Down Expand Up @@ -391,7 +389,6 @@ model Project {
waitpoints Waitpoint[]
taskRunWaitpoints TaskRunWaitpoint[]
taskRunCheckpoints TaskRunCheckpoint[]
executionSnapshots TaskRunExecutionSnapshot[]
waitpointTags WaitpointTag[]
connectedGithubRepository ConnectedGithubRepository?

Expand Down Expand Up @@ -898,21 +895,15 @@ model TaskRunExecutionSnapshot {

// Batch
batchId String?
batch BatchTaskRun? @relation(fields: [batchId], references: [id])

/// This is the current run attempt number. Users can define how many attempts they want for a run.
attemptNumber Int?

/// Environment
environmentId String
environment RuntimeEnvironment @relation(fields: [environmentId], references: [id])
environmentType RuntimeEnvironmentType

projectId String
project Project @relation(fields: [projectId], references: [id])

organizationId String
organization Organization @relation(fields: [organizationId], references: [id])
projectId String
organizationId String

/// Waitpoints that have been completed for this execution
completedWaitpoints Waitpoint[] @relation("completedWaitpoints")
Expand All @@ -926,8 +917,6 @@ model TaskRunExecutionSnapshot {

/// Worker
workerId String?
worker WorkerInstance? @relation(fields: [workerId], references: [id])

runnerId String?

createdAt DateTime @default(now())
Expand Down Expand Up @@ -1149,8 +1138,6 @@ model WorkerInstance {
workerGroup WorkerInstanceGroup @relation(fields: [workerGroupId], references: [id])
workerGroupId String

TaskRunExecutionSnapshot TaskRunExecutionSnapshot[]

organization Organization? @relation(fields: [organizationId], references: [id], onDelete: Cascade, onUpdate: Cascade)
organizationId String?

Expand Down Expand Up @@ -1541,13 +1528,11 @@ model BatchTaskRun {
batchVersion String @default("v1")

//engine v2
/// Snapshots that reference this batch
executionSnapshots TaskRunExecutionSnapshot[]
/// Specific run blockers,
runsBlocked TaskRunWaitpoint[]
runsBlocked TaskRunWaitpoint[]
/// Waitpoints that are blocked by this batch.
/// When a Batch is created it blocks execution of the associated parent run (for andWait)
waitpoints Waitpoint[]
waitpoints Waitpoint[]

// This is for v3 batches
/// sealed is set to true once no more items can be added to the batch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,12 +374,10 @@ export class ExecutionSnapshotSystem {
});
}

//update the snapshot heartbeat time
await prisma.taskRunExecutionSnapshot.update({
where: { id: latestSnapshot.id },
data: {
lastHeartbeatAt: new Date(),
},
this.$.logger.info("heartbeatRun snapshot heartbeat updated", {
id: latestSnapshot.id,
runId: latestSnapshot.runId,
lastHeartbeatAt: new Date(),
});

//extending the heartbeat
Expand Down