JobStatistics or JobStats are null when I am trying to retrieve them RRS feed

  • Discussion générale

  • I am trying to retrieve some data from azure jobs as the kernelCPUTime or the UserCPUTime but i get informations "null" even when the job is complete.

    They put this comment above the function in the SDK 

         * Resource usage statistics for the entire lifetime of the Job.
         * This property is populated only if the CloudJob was retrieved with an
         * expand clause including the 'stats' attribute; otherwise it is null. The
         * statistics may not be immediately available. The Batch service performs
         * periodic roll-up of statistics. The typical delay is about 30 minutes.
        @JsonProperty(value = "stats")
        private JobStatistics stats;

    How can I get the informations needed
    Is someone already get them?
    They talk about 30 minutes. This is too long for my work.

    Here is my code. hope it cal help to understand my point.

         override suspend fun update(job: CloudJob, tasks: List<CloudTask>/*, sqlTransaction: SQLTransaction*/): AzureBatchJob {
                   this.tasks = tasks

                   val completedTaskCount = tasks.count { it.state() == TaskState.COMPLETED }
                   val taskCount = tasks.size
                   progress = 10 + (completedTaskCount.toDouble() * 90.0 / taskCount.toDouble()).toInt()

                   return if (job.state() != JobState.COMPLETED) {
                   } else {
                       sqlTransaction.inTransaction { consumer->


                       val kernelCPUTime = job.stats().kernelCPUTime()
                       val userCPUTime = job.stats().userCPUTime()
             "STARTSSSSSSSSSSSSSSSS =========> kernelCPUTime $kernelCPUTime ---------- userCPUTime $userCPUTime")
                       val isCancelled = tasks.any { it.state() != TaskState.COMPLETED }

    Thanks a lot for reading.

    vendredi 15 janvier 2021 17:01

Toutes les réponses

  • Bonjour ShikaZer0,

    As this is a French forum I would kindly ask you to either translate your Post in French or to post it again on the English Forum:

    Merci d’avoir contacté les forums MSDN France. La langue utilisée sur ces forums est la langue Française. Donc, s’il vous plaît, modifiez votre premier message comme on vous demande dans l’étiquette sur les forums MSDN France.
    Merci pour votre compréhension et collaboration.


    Microsoft propose ce service gratuitement, dans le but d'aider les utilisateurs et d'élargir les connaissances générales liées aux produits et technologies Microsoft. Ce contenu est fourni "tel quel" et il n'implique aucune responsabilité de la part de Microsoft.

    vendredi 15 janvier 2021 18:07