Tuesday, March 23, 2021

Google Cloud Platform or Google App Engine 'gcloud app deploy' not updating your app? Debugger not working?

If you use python, and occasionally run your app locally, you'll notice some files that are generated: .pyc and index.yaml. If you accidentally 'gcloud app deploy' these files, especially when you have not run it locally for a while, they can break your application! Or drive you crazy!

In particular, they break the Google Cloud Console debugger (formerly the stackdriver debugger)  ... so while you're trying to figure out why your application doesn't work as expected, the debugger keeps telling you that you're setting logpoints on non-existent lines of code!

What has happened, is that Google is not checking to see whether the .py source file and the .pyc file match. It would be very nice if they did this. They could just check the timestamps. It would be easy. But they don't. 

And you keep changing your source code in trivial ways, perhaps adding some logging to see what's going on, but the live deployed application doesn't change. And the debugger doesn't work!

The fix is obvious: delete the .pyc and index.yaml files. Or put them in your .gcloudignore file.

I hope this helps someone. :-)




CHAQ: Central Handler, Action Queue

The evolution of cheq into CHAQ is pretty easy to explain. 'Events' are things that happen to you, and 'actions' are things that you do. The Central Handler in a javascript application is called by system events that we initiate in our own code, and then we let go, so the browser can do what it needs to. But before we let go, we check what actions we need to take. They are on a queue of these actions, which we've loaded within our own code. We process them, then pass control to the browser.

You can see this code, used to explain itself in a baby web app, at chaq.rocks.  

One other change -- our 'option-oriented programming', where the program itself is determined by a JSON structure, refers to the names of other JSON objects, not to functions. I found that I would otherwise not make the functions generally usable by other JSON instructions. So functions are only called by 'process'. Ultimately, for namespace sanity, our functions are injected into process, where they are called by the program described in JSON, which I call the 'essence', and which is really a not-javascript-specific declarative programming language 'structure', which can be used for any level of abstraction you like.

The point of the essence is to give people an opportunity to maintain clarity of ideas in the description of the program's activity. Coding beyond the barrier of incomprehensibility (and other desired qualities) is very common in software development. Anything that helps us to prevent that, needs to be explored further.