Search code examples
amazon-web-servicesaws-fargateaws-batch

Job with shareIdentifier or schedulingPriority can onlybe submitted to job queue with fair share scheduling policy


I have created a AWS Batch job definition, queue. When I submit a job using the CMD, I got the following error message.

Job with shareIdentifier or schedulingPriority can onlybe submitted to job queue with fair share scheduling policy.

Here is my job definition,


{
  "jobDefinitionName": "learning-job-definition",
  "jobDefinitionArn": "arn:aws:batch:us-east-1:0xxxxxxxxxx5:job-definition/learning-job-definition:2",
  "revision": 2,
  "status": "ACTIVE",
  "type": "container",
  "schedulingPriority": 1,
  "parameters": {},
  "retryStrategy": {
    "attempts": 2,
    "evaluateOnExit": []
  },
  "containerProperties": {
    "image": "0xxxxxxxxxx5.dkr.ecr.us-east-1.amazonaws.com/learnings:latest",
    "command": [],
    "jobRoleArn": "arn:aws:iam::0xxxxxxxxxx5:role/service-roles/axxxxxx-legacy-dev-vp-GzipperAWSBatchService-zjTK9JzNEbGZ",
    "executionRoleArn": "arn:aws:iam::0xxxxxxxxxx5:role/service-roles/axxxxxx-legacy-dev-vp-GzipperAWSBatchService-zjTK9JzNEbGZ",
    "volumes": [],
    "environment": [],
    "mountPoints": [],
    "readonlyRootFilesystem": true,
    "ulimits": [],
    "user": "test",
    "resourceRequirements": [
      {
        "value": "1.0",
        "type": "VCPU"
      },
      {
        "value": "2048",
        "type": "MEMORY"
      }
    ],
    "secrets": [],
    "networkConfiguration": {
      "assignPublicIp": "ENABLED",
      "interfaceConfigurations": []
    },
    "fargatePlatformConfiguration": {
      "platformVersion": "LATEST"
    },
    "ephemeralStorage": {
      "sizeInGiB": 21
    },
    "runtimePlatform": {
      "operatingSystemFamily": "LINUX",
      "cpuArchitecture": "X86_64"
    }
  },
  "timeout": {
    "attemptDurationSeconds": 600
  },
  "tags": {
    "Project": "axxxxxx",
    "Sub Project": "SharedaxxxxxxResource"
  },
  "platformCapabilities": [
    "FARGATE"
  ],
  "containerOrchestrationType": "ECS"
}

CMD

aws batch submit-job --job-name test-local-write-2 --job-definition learning-job-definition --job-queue learning-queue --scheduling-policy fair-share

I couldn't find similar issues online and there is no clear documentation on how to use shareIdentifier or schedulingPriority.


Solution

  • I found the mistake, it seems mentioning schedulingPriority in the JobDefinition will require Scheduling policy need to be added in the Job Queue.

    In my case, I don't need the schedulingPriority, so after removing that from Job definition everything is working as expected.