Add automatic cluster pool allocation.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
ManyToOne,
|
||||
JoinColumn,
|
||||
CreateDateColumn,
|
||||
} from 'typeorm';
|
||||
import { Cluster } from './cluster.entity';
|
||||
import { ClusterPool, PoolStrategy } from './cluster-pool.entity';
|
||||
import { Application } from '../../applications/entities/application.entity';
|
||||
|
||||
export type ClusterAllocationStatus = 'success' | 'failed';
|
||||
|
||||
@Entity('cluster_allocation_logs')
|
||||
export class ClusterAllocationLog {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column({ nullable: true })
|
||||
applicationId?: string | null;
|
||||
|
||||
@ManyToOne(() => Application, { nullable: true, onDelete: 'SET NULL' })
|
||||
@JoinColumn({ name: 'applicationId' })
|
||||
application: Application;
|
||||
|
||||
@Column()
|
||||
userId: string;
|
||||
|
||||
@Column({ nullable: true })
|
||||
poolId?: string | null;
|
||||
|
||||
@ManyToOne(() => ClusterPool, { nullable: true, onDelete: 'SET NULL' })
|
||||
@JoinColumn({ name: 'poolId' })
|
||||
pool: ClusterPool;
|
||||
|
||||
@Column({ nullable: true })
|
||||
selectedClusterId?: string | null;
|
||||
|
||||
@ManyToOne(() => Cluster, { nullable: true, onDelete: 'SET NULL' })
|
||||
@JoinColumn({ name: 'selectedClusterId' })
|
||||
selectedCluster: Cluster;
|
||||
|
||||
@Column({ default: 'weighted-resource' })
|
||||
strategy: PoolStrategy;
|
||||
|
||||
@Column({ type: 'jsonb', nullable: true })
|
||||
estimatedRequest: Record<string, any>;
|
||||
|
||||
@Column({ type: 'jsonb', nullable: true })
|
||||
candidateScores: Record<string, any>[];
|
||||
|
||||
@Column({ type: 'jsonb', nullable: true })
|
||||
rejectionReasons: Record<string, any>[];
|
||||
|
||||
@Column({ default: 'success' })
|
||||
status: ClusterAllocationStatus;
|
||||
|
||||
@Column({ nullable: true })
|
||||
message: string;
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt: Date;
|
||||
}
|
||||
Reference in New Issue
Block a user