Here I go over one of my old projects which demos abstracting a Grid Engine job as a Python object and lets you construct, submit, control your jobs entirely from Python rather than having to interact with the shell and Grid Engine directly.
Project repo: https://github.com/owainkenwayucl/gepy