Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pool: Unexpect element taskSlotsPerNode in template #132

Open
bitsofinfo opened this issue Jun 7, 2021 · 5 comments
Open

pool: Unexpect element taskSlotsPerNode in template #132

bitsofinfo opened this issue Jun 7, 2021 · 5 comments

Comments

@bitsofinfo
Copy link

Get error:
Unexpect element taskSlotsPerNode in template

Trying to create a pool with this template:

{
    "parameters": {
        "nodeCount": {
            "type": "int",
            "metadata": {
                "description": "The number of pool nodes"
            }
        },
        "poolId": {
            "type": "string",
            "metadata": {
                "description": "The pool ID "
            }
        },
        "subnetId": {
            "type": "string",
            "metadata": {
                "description": "The subnet ID pool vms go in "
            }
        }
    },
    "pool": {
        "type": "Microsoft.Batch/batchAccounts/pools",
        "apiVersion": "2016-12-01",
        "properties": {
            "id": "[parameters('poolId')]",
            "virtualMachineConfiguration": {
                "imageReference": {
                    "publisher": "microsoft-azure-batch",
                    "offer": "centos-container",
                    "sku": "7-7",
                    "version": "latest"
                },
                "nodeAgentSKUId": "batch.node.centos 7",
                "containerConfiguration": {
                    "type": "dockerCompatible",
                    "containerRegistries": [
                        {
                            "registryServer": "abceastusdevncc.azurecr.io",
                            "username": "abceastusdevncc",
                            "password": "xxxx"
                        }
                    ]
                }
            },
            "vmSize": "STANDARD_D3_V2",
            "networkConfiguration": {
                "subnetId": "[parameters('subnetId')]",
                "dynamicVNetAssignmentScope": "none",
                "publicIPAddressConfiguration": {
                    "provision": "BatchManaged"
                }
            },

            "targetDedicatedNodes": "[parameters('nodeCount')]",
            "enableAutoScale": false,
            "taskSlotsPerNode": 4,
            "taskSchedulingPolicy": {
                "nodeFillType": "Pack"
            },
            "identity": {
                "type": "UserAssigned",
                "userAssignedIdentities": [
                    {
                        "resourceId": "/subscriptions/xxx/resourceGroups/abc-eastus-dev-nuc-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/abceastdevncctch001-id",
                        "clientId": "xxx",
                        "principalId": "xxx"
                    }
                ]
            }
        }
    }
}
@bitsofinfo bitsofinfo changed the title Unexpect element taskSlotsPerNode in template pool: Unexpect element taskSlotsPerNode in template Jun 7, 2021
@bitsofinfo
Copy link
Author

#129

@bitsofinfo
Copy link
Author

looks like api version is based to: 2018: https://github.com/Azure/azure-batch-cli-extensions/blob/master/azext/batch/models/constants.py#L69

If I try that API version and maxTasksPerNode then I get

Reason: The property 'maxTasksPerNode' does not exist on type 'Microsoft.Azure.Batch.Protocol.Entities.Pool'. Make sure to only use property names that are defined by the type.

@themorey
Copy link

themorey commented Jun 8, 2021

here is what I was able to get working with a template and an autopool:

{
    "parameters": {
        "poolId": {
            "type": "string",
            "metadata": {
                "description": "The name of the Azure Batch pool to run the job(s)"
            },
            "defaultValue": "EP-autopool"
        },
        "jobId": {
            "type": "string",
            "metadata": {
                "description": "The name of Azure Batch job (must match folder name used for Input files)"
            }
        },
        "numberNodes": {
            "type": "int",
            "defaultValue": 1,
            "metadata": {
                "description": "The max number of VMs in the Azure Batch pool"
            }
        },
        "taskSlotsPerNode": {
            "type": "int",
            "defaultValue": 8,
            "metadata": {
                "description": "The max number of tasks to run on each node (ie. Standard_D16ds_v4 = 8; Standard_32ds_v4 = 16; etc"
            }
        },
        "vmSize": {
            "type": "string",
            "metadata": {
                "description": "The size of the virtual machines that run the application"
            },
            "defaultValue": "Standard_D16ds_v4"
        },
        "energyPlusPkgVer": {
            "type": "string",
            "metadata": {
                "description": "The EnergyPlus version to run"
            },
            "defaultValue": "9.4.0"
        },
        "weather": {
            "type": "string",
            "defaultValue": "USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw",
            "metadata": {
                "description": "Enter the filename (plus extension) of the weather file"
            }
        }
    },
    "job": {
        "type": "Microsoft.Batch/batchAccounts/jobs",
        "apiVersion": "2018-12-01",
        "properties": {
            "id": "[parameters('jobId')]",
            "constraints": {
                "maxTaskRetryCount": 3   
            },
            "jobPreparationTask": {
                "commandLine": "cmd /c dir",
                "resourceFiles": [
                    {
                        "autoStorageContainerName": "fgrp-energyplus-inputs",
                        "blobPrefix": "common-inputs"
                    }
                ]
            },
            "poolInfo": {
                "autoPoolSpecification": {
                    "autoPoolIdPrefix": "[parameters('poolId')]",
                    "keepAlive": "false",
                    "poolLifetimeOption": "job",
                    "pool": {
                        "vmSize": "[parameters('vmSize')]",
                        "virtualMachineConfiguration": {
                          "imageReference": {
                            "offer": "windowsserver",
                            "publisher": "microsoftwindowsserver",
                            "sku": "2019-datacenter",
                            "version": "latest"
                          },    
                          "nodeAgentSkuId": "batch.node.windows amd64"
                        },
                        "enableInterNodeCommunication": false,
                        "enableAutoScale": false,
                        "targetDedicatedNodes": "[parameters('numberNodes')]",
                        "maxTasksPerNode": "[parameters('taskSlotsPerNode')]",
                        "taskSchedulingPolicy": {
                          "nodeFillType": "Pack"
                        },
                        "applicationPackageReferences": [
                            {
                                "applicationId": "energyplus",
                                "version": "[parameters('energyPlusPkgVer')]"
                            }
                        ],
                        "startTask": {
                            "commandLine": "cmd /c @\"%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command \"iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/Azure/batch-insights/master/scripts/run-windows.ps1'))\"",
                            "environmentSettings": [
                                {
                                    "name": "APP_INSIGHTS_INSTRUMENTATION_KEY",
                                    "value": "<removed>"
                                },
                                {
                                    "name": "APP_INSIGHTS_APP_ID",
                                    "value": "<removed>"
                                },
                                {
                                    "name": "BATCH_INSIGHTS_DOWNLOAD_URL",
                                    "value": "https://github.com/Azure/batch-insights/releases/download/v1.0.0/batch-insights.exe"
                                }
                            ],
                            "userIdentity": {
                                "autoUser": {
                                    "scope":"pool",
                                    "elevationLevel":"admin"
                                  }
                            }
                        }
                    }
                }
            },
            "taskFactory": {
                "type": "taskPerFile",
                "source": {
                    "fileGroup": "energyplus-inputs",
                    "prefix": "[parameters('jobId')]"
                },
                "repeatTask": {
                    "commandLine": "cmd /c cd %AZ_BATCH_APP_PACKAGE_energyplus#[parameters('energyPlusPkgVer')]%\\EnergyPlus-[parameters('energyPlusPkgVer')]-*  && copy %AZ_BATCH_JOB_PREP_WORKING_DIR%\\common-inputs\\* %AZ_BATCH_TASK_WORKING_DIR%\\ && energyplus.exe -w %AZ_BATCH_TASK_WORKING_DIR%\\[parameters('weather')] %AZ_BATCH_TASK_WORKING_DIR%\\{fileName}",
                    "constraints": {
                        "retentionTime": "PT5M"
                    },
                    "resourceFiles": [
                        {
                            "blobSource": "{url}",
                            "filePath": "{fileName}"
                        }
                    ],
                    "outputFiles": [
                        {
                            "filePattern": "%AZ_BATCH_APP_PACKAGE_energyplus#[parameters('energyPlusPkgVer')]%\\EnergyPlus-[parameters('energyPlusPkgVer')]-*\\eplus*",
                            "destination": {
                                "autoStorage": {
                                    "path": "[parameters('jobId')]/{fileNameWithoutExtension}/outputs",
                                    "fileGroup": "energyplus-outputs"
                                }
                            },
                            "uploadOptions": {
                                "uploadCondition": "TaskCompletion"
                            }
                        },
                                                {
                            "filePattern": "../[*].txt",
                            "destination": {
                                "autoStorage": {
                                    "fileGroup": "energyplus-outputs",
                                    "path": "[parameters('jobId')]/{fileNameWithoutExtension}/logs"
                                }
                            },
                            "uploadOptions": {
                                "uploadCondition": "taskCompletion"
                            }
                        },
                        {
                            "filePattern": "../[*].out",
                            "destination": {
                                "autoStorage": {
                                    "fileGroup": "energyplus-outputs",
                                    "path": "[parameters('jobId')]/{fileNameWithoutExtension}/logs"
                                }
                            },
                            "uploadOptions": {
                                "uploadCondition": "taskCompletion"
                            }
                        }
                    ]
                }
            },
            "onAllTasksComplete": "terminatejob"
        }
    }
}

@bitsofinfo
Copy link
Author

hmm, yeah difference here though is I'm not using autoPoolSpecification but am creating the pool on its own separate from job submissions

@fblampe
Copy link

fblampe commented Apr 1, 2022

@bitsofinfo did you ever get this to work without an auto pool spec?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants