locked
Troubleshooting a Azure Batch App RRS feed

  • Question

  • Hey all,

      I'm trying my first Azure Batch App (based on the ImageMagick sample) and I'm stuck. I'm trying to understand the best way to troubleshoot the problem that the External Program finishes but the output file isn't there. The error from log looks like:

    An exception has occurred processing task: One or more errors occurred.. Could not find file 'C:\user\tasks\shared\TaskProcessorHost\6e1b454c-91bb-44cb-b8f9-b3e58cebc9ca\0001.png'.. 

    Trying to log the stdout and strerr via:

    ExternalProcessResult processOutput = process.Run();
    Log.Info("stdout:");
    Log.Info(processOutput.StandardOutput);
    Log.Info("Stderr:");
    Log.Info(processOutput.StandardError);

    yields a python error: 

    • Fatal Python error: Py_Initialize: can't initialize sys standard streams OSError: [Errno 9] Bad file descriptor 

    which seems to be a python problem when the standard streams get redirected. (My app is python based.)

    I was going to try to replace my TaskProcessor ExternalProcess.CommandPath to invoke a .cmd file which would to something like:

    mybatchimage.exe > foo.out
    and then get the  TaskProcessResult to use the foo.out as the outputfile.

    Is it possible to invoke a .cmd that is in the application image zip?

    Is there another way to see what's going on? 

    ----- Ed

    Friday, December 5, 2014 5:38 PM

Answers

  • Hello Ed,

    Sorry to hear you're seeing problems.

    Yes, it is possible to invoke a .cmd that is in the application image zip.  When your Batch application runs, the zip is decompressed into your TaskProcessor.ExecutablesPath and you can do whatever you like with those files.  We provide the ExternalProcess class as a helper for invoking programs and capturing output, but you don't have to.  ExternalProcess.Run should work with .cmd files, but if not you can always drop down to the .NET Process API instead to get finer control over the process.

    This would also be my answer to "Is there another way to see what's going on?"  ExternalProcess tries to provide a convenient launcher for external programs in Batch but if it's not doing what you want then you can drop down to the .NET Process API or even the Win32 API to get finer control.

    This may also help to address your Python issue as the ExternalProcess class always redirects stdout and stderr (so that they can be displayed in the portal), but by launching from a .cmd file or the .NET Process API you can bypass our redirection if this conflicts with Python.  This means you will need to check exit codes and build the TaskProcessResult yourself instead of using the ExternalProcessResult to do it, but hopefully that is all fairly self-explanatory -- let us know if you need any more info.

    • Marked as answer by DigitalEdSC Monday, December 8, 2014 7:42 PM
    Sunday, December 7, 2014 8:35 PM