Skip to content

Commit

Permalink
feat: add MROutstandingImageJobsTable to MRDataplane
Browse files Browse the repository at this point in the history
  • Loading branch information
edparris committed Feb 24, 2025
1 parent 6b65d05 commit ea4f516
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
27 changes: 27 additions & 0 deletions lib/osml/model_runner/mr_dataplane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ export class MRDataplaneConfig extends BaseConfig {
*/
public DDB_JOB_STATUS_TABLE: string;

/**
* The name of the DynamoDB table for outstanding image jobs.
* @default "OutstandingImageProcessingJobs"
*/
public DDB_OUTSTANDING_IMAGE_JOBS_TABLE: string

/**
* The name of the DynamoDB table for region request status.
* @default "RegionProcessingJobStatus"
Expand Down Expand Up @@ -337,6 +343,7 @@ export class MRDataplaneConfig extends BaseConfig {
DDB_ENDPOINT_PROCESSING_TABLE: "EndpointProcessingStatistics",
DDB_FEATURES_TABLE: "ImageProcessingFeatures",
DDB_JOB_STATUS_TABLE: "ImageProcessingJobStatus",
DDB_OUTSTANDING_IMAGE_JOBS_TABLE: "OutstandingImageProcessingJobs",
DDB_REGION_REQUEST_TABLE: "RegionProcessingJobStatus",
DDB_TTL_ATTRIBUTE: "expire_time",
ECS_AUTOSCALING_TASK_MAX_COUNT: 40,
Expand Down Expand Up @@ -431,6 +438,11 @@ export class MRDataplane extends Construct {
*/
public regionalS3Endpoint: string;

/**
* The DynamoDB table for outstanding image processing jobs.
*/
public outstandingImageJobsTable: OSMLTable;

/**
* The DynamoDB table for job status.
*/
Expand Down Expand Up @@ -555,6 +567,20 @@ export class MRDataplane extends Construct {
// Configure the construct with passed params
this.setup(props);

// Outstanding jobs currently being tracked by the scheduler
this.outstandingImageJobsTable = new OSMLTable(this, "MROutstandingImageJobsTable", {
tableName: this.config.DDB_OUTSTANDING_IMAGE_JOBS_TABLE,
partitionKey: {
name: "endpoint_id",
type: AttributeType.STRING
},
sortKey: {
name: "job_id",
type: AttributeType.STRING
},
removalPolicy: this.removalPolicy,
});

// Job status table to store worker status info
this.jobStatusTable = new OSMLTable(this, "MRJobStatusTable", {
tableName: this.config.DDB_JOB_STATUS_TABLE,
Expand Down Expand Up @@ -735,6 +761,7 @@ export class MRDataplane extends Construct {
let containerEnv = {
AWS_DEFAULT_REGION: props.account.region,
JOB_TABLE: this.jobStatusTable.table.tableName,
OUTSTANDING_JOBS_TABLE: this.outstandingImageJobsTable.table.tableName,
FEATURE_TABLE: this.featureTable.table.tableName,
ENDPOINT_TABLE: this.endpointStatisticsTable.table.tableName,
REGION_REQUEST_TABLE: this.regionRequestTable.table.tableName,
Expand Down
1 change: 1 addition & 0 deletions test/osml/model_runner/mr_dataplane.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ describe("MRDataplane constructor", () => {
expect(mrDataplane.removalPolicy).toBeDefined();
expect(mrDataplane.featureTable).toBeDefined();
expect(mrDataplane.jobStatusTable).toBeDefined();
expect(mrDataplane.outstandingImageJobsTable).toBeDefined();
expect(mrDataplane.regionRequestTable).toBeDefined();
expect(mrDataplane.endpointStatisticsTable).toBeDefined();
expect(mrDataplane.imageRequestQueue).toBeDefined();
Expand Down

0 comments on commit ea4f516

Please sign in to comment.