I have a service which can run and terminates azure batch tasks. I want to return task status after task terminating. Usually, I got exit code 137, but sometimes I got NullPointerException because the terminated task has no exit code. Is it a normal situation for Azure batch and I have to handle this?
My code for azure batch task terminating:
azureBatchClient.taskOperations().terminateTask(jobId, taskId);
You can terminate tasks which have not been run or may have been in the process of launching but was running preparatory steps (e.g., downloading resource files or task application packages). In such cases, there will be no exit code as the command process never started. You need to check the execution info to see if it is set (non-null) before accessing the exit code property.