Some of the users are using 100 + tasks in a parallel task which is impacting XL Release performance. We are looking for a way where we can limit parallel task execution to certain number.

Comments

  • Thank you for the suggestion. We understand the demand. As a next step, we will wait for a broader customer base to upvote this item, which will help us prioritize its implementation accordingly.

  • upvoted. In the meantime I have created the following functions.
    Two usecases:
    - Restrict and wait until a lock is available and continue with the next task.
    - Fail and skip the tasks when another release has already acuired the lock (used for example to spin up/down stages)

    def acquireLock(name, releaseId, maxRetries, skipAfterFailed = False):
    from java.lang import System, Math

    # folderVariables[] is caching the variables so we have to use the api to access the vars directly
    folder = folderApi.find("promotion-automated", 1)
    vars = folderApi.listVariables(folder.id, True)
    var = [ item for item in vars if item.key == "folder.locks" ] [0]

    retry = 0
    while var.value.has_key(name):
    retry += 1
    if retry >= maxRetries:
    break
    print("Retry {count} for {lock}, blocked by {id}".format(lock=name, count=retry, id=var.value[name]))
    time.sleep((int)(Math.random() * 60) + 1)
    vars = folderApi.listVariables(folder.id, True)
    var = [ item for item in vars if item.key == "folder.locks" ] [0]

    if not var.value.has_key(name):
    v = var.value
    v[name] = releaseId
    var.value = v
    # not working
    # var.value[name] = releaseId
    folderApi.updateVariable(folder.id, var)

    print("Lock {lock} acquired".format(lock=name))
    else:
    print("Acquiring lock {lock} failed after {retry} retries.".format(lock=name, retry=retry))
    if (skipAfterFailed):
    # Note that skipping an active task is not possible. We create an error (which can be caught via a failure handler)
    task = getCurrentTask()
    taskApi.skipTask(task.getId(), "Skipping task after {retry} retries".format(retry = retry))


    def releaseLock(name):
    from java.lang import System, Math

    # folderVariables[] is caching the variables so we have to use the api to access the vars directly
    folder = folderApi.find("promotion-automated", 1)
    vars = folderApi.listVariables(folder.id, True)
    var = [ item for item in vars if item.key == "folder.locks" ] [0]
    if var.value.has_key(name):
    print("Releasing lock {name}".format(name=name))
    v = var.value
    del v[name]
    var.value = v
    folderApi.updateVariable(folder.id, var)

  • In the upcoming Erawan release (version 24.1), we aim to introduce an Experimental system setting focused on regulating the concurrent execution of jobs per Release node to improve system stability. Throughout the release execution, a single task may trigger various jobs, such as pre-condition checks, the actual task script, failure handler script, and more.
    System administrators will be able to configure and set limits on the number of simultaneous job executions.