Building Science Gateways with Django Globus Portal Framework

By Greg Nawrocki, Globus

We often speak of Globus as a “platform for research data management”. What we mean by that is that Globus isn’t just the web browser interface, it’s about being able to use our service integrated into portals, science gateways and applications. Effectively, how can Globus fit into those workflows and research data automation processes you’ve already developed or are considering building. To support that mantra of unlimited extensibility we expose the very same APIs that our web interface uses, and if Python is your language of choice, we wrap those APIs in a really nice and easy to use SDK. 

I often say that one of the best things about Globus, everything from the endpoint installation to aspects of the platform, is that it has extensive and well-written documentation supporting it. However, given the breadth and depth of our documentation, it can sometimes be difficult to find the specific information you are looking for, or find yourself down a rabbit hole. 

For those interested in building upon our platform and exercising their coding chops, I’ve listed some of my favorite references below to help you on your journey. 

From a high level our documentation is excellent. Look for the “API” menu to find info on the Auth API, Transfer API and the Python SDK (among other things). 

The best way to experience using the API (and the SDK) is via our Globus Jupyter Notebooks.

You can also access these on our JupyterHub that we use for tutorials.  The hub itself uses Globus Auth for access control so you can use your Globus credentials to log in. 

In the globus-jupyter-notebooks folder: 

Platform_Introduction_Native_App_Auth.ipynb works just like the example above that you can download and run locally. You need to manually cut and paste the token you get from Globus Auth. 

Platform_Introduction_JupyterHub_Auth.ipynb takes the tokens stored by the hub (remember you authenticate with Globus Auth) and builds a transfer class that has the necessary headers to use the transfer APIs. 

If you’re interested in how Globus Auth is used to secure a Jupyter Hub, this is an excellent article: Using Globus in Jupyter Notebooks

To see how all of this ties together—especially if you’re a Python developer—take a look at the open source Django Globus Portal Framework. This is a new reference implementation based on the Modern Research Data Portal design pattern: The Modern Research Data Portal: A Design Pattern for Networked, Data-Intensive Science. 

If you’re impatient like me, you can jumpstart your portal (or other web app) development using a ready-to-deploy version here: Cookiecutter Django Globus App. This will give you a working app with just a couple of commands; then you can customize to your heart’s content. 

Lastly, our GitHub is a wealth of knowledge: https://github.com/globus. It includes all of the above repo’s as well as source code for the following: 

The Python SDK: https://github.com/globus/globus-sdk-python 

Using Globus Auth in command line and other native apps: https://github.com/globus/native-app-examples 

Simple automation scripts: https://github.com/globus/automation-examples; this includes both bash and Python examples of automating simple tasks. 

The Globus Command Line Interface (CLI): https://github.com/globus/globus-cli 

And speaking of the CLI (Command Line Interface (CLI)) if what you hope to accomplish are data automation tasks don’t discount using the CLI in shell scripts. I’m constantly amazed at what I can do in a few lines of bash script. The CLI is also an excellent tool for “thinking” about how the SDK methods function as it is a pretty tight wrapper around the SDK. 

Looking forward to hearing about more great portals, applications and automations built with the Globus platform!