@punks/backend-entity-manager 0.0.295 → 0.0.296

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
- import { BathJobDefinition, GetBatchJobStatusInput, SubmitBatchJobInput } from "./types";
1
+ import { AwsJobDefinition, GetBatchJobStatusInput, SubmitBatchJobInput } from "./types";
2
2
  export declare class AwsBatchService {
3
3
  private readonly logger;
4
4
  cancelJobInput(): Promise<void>;
5
5
  getJobInstance(input: GetBatchJobStatusInput): Promise<import("@aws-sdk/client-batch").JobSummary | undefined>;
6
6
  submitJob(input: SubmitBatchJobInput): Promise<void>;
7
- ensureJobDefinition(definition: BathJobDefinition): Promise<import("@aws-sdk/client-batch").JobDefinition>;
7
+ ensureJobDefinition(definition: AwsJobDefinition): Promise<import("@aws-sdk/client-batch").JobDefinition>;
8
8
  private unregisterJobDefinition;
9
9
  private registerJobDefinition;
10
10
  private getLatestJobDefinition;
@@ -1,3 +1,4 @@
1
+ import { AwsBatchInfrastructureParams, AwsBatchInvocationParams } from "../models";
1
2
  export type BathJobDefinition = {
2
3
  jobUid: string;
3
4
  image: string;
@@ -18,3 +19,8 @@ export type GetBatchJobStatusInput = {
18
19
  jobUid: string;
19
20
  instanceId: string;
20
21
  };
22
+ export type AwsJobDefinition = {
23
+ jobUid: string;
24
+ infrastructureParams: AwsBatchInfrastructureParams;
25
+ invocationParams: AwsBatchInvocationParams;
26
+ };
@@ -1,9 +1,11 @@
1
1
  import { JobDefinition } from "../../../../extensions/jobs/abstractions/definition";
2
+ export type AwsJobComputePlatformType = "ec2" | "fargate";
2
3
  export type AwsBatchInfrastructureParams = {
3
4
  vcpu: number;
4
5
  memory: number;
5
6
  gpuMemory?: number;
6
7
  dockerImage: string;
8
+ computePlatformType?: AwsJobComputePlatformType;
7
9
  };
8
10
  export type AwsBatchInvocationParams = {
9
11
  startCommand: string[];
package/dist/esm/index.js CHANGED
@@ -40070,25 +40070,27 @@ let AwsBatchService = AwsBatchService_1 = class AwsBatchService {
40070
40070
  await this.client().send(new RegisterJobDefinitionCommand({
40071
40071
  jobDefinitionName: jobName,
40072
40072
  type: JobDefinitionType.Container,
40073
- platformCapabilities: [PlatformCapability.FARGATE],
40073
+ platformCapabilities: definition.infrastructureParams.computePlatformType === "ec2"
40074
+ ? [PlatformCapability.EC2]
40075
+ : [PlatformCapability.FARGATE],
40074
40076
  containerProperties: {
40075
- command: definition.defaultCommand,
40076
- image: definition.image,
40077
+ command: definition.invocationParams.startCommand,
40078
+ image: definition.infrastructureParams.dockerImage,
40077
40079
  executionRoleArn: this.awsSettings.batchExecutionRole,
40078
40080
  resourceRequirements: [
40079
40081
  {
40080
40082
  type: ResourceType.MEMORY,
40081
- value: definition.memory.toString(),
40083
+ value: definition.infrastructureParams.memory.toString(),
40082
40084
  },
40083
40085
  {
40084
40086
  type: ResourceType.VCPU,
40085
- value: definition.vcpu.toString(),
40087
+ value: definition.infrastructureParams.vcpu.toString(),
40086
40088
  },
40087
- ...(definition.gpuMemory
40089
+ ...(definition.infrastructureParams.gpuMemory
40088
40090
  ? [
40089
40091
  {
40090
40092
  type: ResourceType.GPU,
40091
- value: definition.gpuMemory.toString(),
40093
+ value: definition.infrastructureParams.gpuMemory.toString(),
40092
40094
  },
40093
40095
  ]
40094
40096
  : []),
@@ -40194,15 +40196,12 @@ let AwsJobsProvider = class AwsJobsProvider {
40194
40196
  }
40195
40197
  async upsertJobDefinition(input) {
40196
40198
  const { definition } = input;
40197
- const awsInfraParams = definition.infrastructureParams;
40198
- const awsInvocationParams = definition.invocationParams;
40199
+ const infrastructureParams = definition.infrastructureParams;
40200
+ const invocationParams = definition.invocationParams;
40199
40201
  await this.awsBatchService.ensureJobDefinition({
40200
- image: awsInfraParams.dockerImage,
40201
40202
  jobUid: definition.uid,
40202
- memory: awsInfraParams.memory,
40203
- gpuMemory: awsInfraParams.gpuMemory,
40204
- vcpu: awsInfraParams.vcpu,
40205
- defaultCommand: awsInvocationParams.startCommand,
40203
+ infrastructureParams,
40204
+ invocationParams,
40206
40205
  });
40207
40206
  }
40208
40207
  async getJobStatus(input) {