question

Jaceklusarczyk-3236 avatar image
0 Votes"
Jaceklusarczyk-3236 asked Jaceklusarczyk-3236 commented

Problem with Python runbook on Azure Autmation Accounts: script does not wait for a code to execute (?)

In runbook's code there is a fragment where it installes a python library with pip module. While executing it script should wait until it is done, but it does not. Locally when I run "pip.main(['download', '-d', '.', 'pandas'])" it takes few seconds until it gets executed, in Azure just the beginning of output is shown and then it goes without waiting for it to finish.

azure-automation
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

The same thing happens when I try to download a file with python's wget package. It seems that azure runtime does not 'wait' and wget.download throws an exception which makes no sense there

0 Votes 0 ·

And a traceback from wget:

Traceback (most recent call last): File "C:\Temp\gqdfk2zb.agu\6ead81f9-3994-49d1-b66f-fc90726196be", line 179, in <module> upload_pdf_file(newest_report_link) File "C:\Temp\gqdfk2zb.agu\6ead81f9-3994-49d1-b66f-fc90726196be", line 93, in upload_pdf_file wget.download(url, out = "/tmp/NEW:" + filename) File "C:\WPy64-3800\python-3.8.0.amd64\lib\site-packages\wget.py", line 506, in download (fd, tmpfile) = tempfile.mkstemp(".tmp", prefix=prefix, dir=".") File "C:\WPy64-3800\python-3.8.0.amd64\lib\tempfile.py", line 332, in mkstemp return _mkstemp_inner(dir, prefix, suffix, flags, output_type) File "C:\WPy64-3800\python-3.8.0.amd64\lib\tempfile.py", line 250, in _mkstemp_inner fd = _os.open(file, flags, 0o600)FileNotFoundError: [Errno 2] No such file or directory: '/tmp/NEW:2021-G_21_07C.pdf6l0z8j42.tmp'

0 Votes 0 ·

@Jaceklusarczyk-3236 Apologies for late response. Can you please share your runbook code so that I can test it from my end and also are you using Azure Sandbox or Hybrid Worker for execution of runbook?


0 Votes 0 ·

Sure, that would be better I think if you can have a look at that notebook
https://github.com/azureautomation/runbooks/blob/master/Utility/Python/import_py3package_from_pypi.py, line 96 will be an issue here.
I am using Azure Sandbox.

0 Votes 0 ·

1 Answer

SwathiDhanwada-MSFT avatar image
0 Votes"
SwathiDhanwada-MSFT answered Jaceklusarczyk-3236 commented

@Jaceklusarczyk-3236 I have tested it from my end. Using runbook I tried to import pandas package and I was able to download it without any issues. For your reference, adding images related to it.

Input:

120415-image.png

Output :

120483-image.png

120410-image.png

Imported Modules :

120476-image.png

There were no errors, warnings that were logged. Can you please elaborate your issue if you were prompted with errors?



image.png (44.9 KiB)
image.png (144.9 KiB)
image.png (137.4 KiB)
image.png (49.6 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Oh for chirst sake, I did it on a new automation account and it worked. Thank you!

0 Votes 0 ·