0
votes

I have published a cloud service with my worker role - it is meant to be polling for messages from a queue and uploading a file to a blob services. The messages are being sent to the queue, but I cannot see that the files are being uploaded. From the portal, I can see that the worker role is live. I don't know what I am missing. Am I meant to write some where in my code to run automatically? The code, when run on the virtual machine seems to work fine and will poll for messages as well as upload files. Furthermore, I am not sure how to debug the service once it is deployed and I am open to any suggestions.

I am using Python to develop the whole service.

This is my code:

if __name__ == '__main__':
  while True:
  message = message_bus_service.receive_subscription_message('jsonpayload-topic','sMessage')
  guid = message.body
  try:
      message.delete()
  except:
      print "No messages"
  //bunch of code that does things with the guid and uploads//
  sleep(10)

this is in the csdef file:

     <Runtime>
      <Environment>
        <Variable name="EMULATED">
          <RoleInstanceValue xpath="/RoleEnvironment/Deployment/@emulated" />
        </Variable>
      </Environment>
      <EntryPoint>
        <ProgramEntryPoint commandLine="bin\ps.cmd LaunchWorker.ps1" setReadyOnProcessStart="true" />
      </EntryPoint>
    </Runtime>

As you can see, the setReadyOnProcessStart is set to "true"

1
Edit your question to show some code. Show how you set up your role's OnStart() and Run(). Otherwise, we'd only be guessing. - David Makogon
I don't have OnStart() or run() - Eimi Okuno
I have put everything in a new project. Before, the cloud service was actually giving errors. Now, because it's a new project it does not produce errors. However it still does not want to output anything. Any help? - Eimi Okuno

1 Answers

0
votes

There's an example of configuring automatic start here that you could check through.. http://www.dexterposh.com/2015/07/powershell-azure-custom-settings.html

Also, have you considered configuring remote access so you can log on and troubleshoot directly (i.e. check your code is running etc.) Configuring Remote Desktop for Worker role in the new portal