Checkmark=facebooklinklinkedinOngoing indicator +Left-facing arrowRight-facing arrowCheckmarkDown-pointing chevronLeft-pointing chevronRight-pointing chevronUp-pointing chevrontwitter x

Running Python scripts in the cloud — Super easy!

At Nerdalize, we’re trying to make computing as easy and straightforward as possible. Last month we released a Python Docker image that allows you to run your scripts without creating a custom image. You can just upload your script, requirements.txt and data files and run it right away. We’ve got a Python 2 and a Python 3 version, both of which are built on the official Python Docker image.

Don’t have an account for the testing period? You can use the following promo code for early access: try-python.

Try our example script: The CO2 calculator

We also created a nifty little CO2 calculator that you can use to try out our Python image. Just follow the quickstart to calculate how much CO2 is saved by Nerdalize each year. It’ll show you:

1) Total CO2 savings in kilograms and travel distances (by car, train & plane). For example, for just a few households, the reduction of CO2 emissions is equal to almost 4 car trips 🚗 around the world 🌎. The CO2 calculator will give you the exact number.

2) A chart showing how many airplane trips you could make to various destinations.


Run it yourself

Make sure to follow these steps to run the example script on the Nerdalize cloud:

  1. Set up Nerd, our CLI.

  2. Download our CO2 calculator here, unzip it, and upload the folder as the dataset.

    $ nerd dataset upload <path-to-dataset-folder>
    105.30 MiB / 194.31 MiB [=======>---] 51% 4s
    Upload complete! ID of new dataset: '<dataset-id>'
    
  3. Start Python.

    $ nerd workload start nerdalize/pythonapp:v3 --input-dataset <dataset-id>
    Workload created with ID: <workload-id>
    
  4. Run the CO2 calculator and determine the amount of households.

    $ nerd task create <workload-id> -- co2_calc.py <number-of-households>
    Started task with ID: <task-id>
    
  5. Have a look at the travelling distances and CO2 emissions in the logs.

    1. List the workload’s workers.

      $ nerd workload describe <workload-id>
      Workload Details:
      ID:              <workload-id>
      Image:           nerdalize/pythonapp:v3
      Input:
      Created:         2 minutes ago
      Workers:         <worker-id> (Running)
      
    2. Request the log output for a worker.

      $ nerd worker logs <workload-id> <worker-id>
      
  6. Check on the status of your tasks.

    $ nerd task list <workload-id>
    TASK ID               CMD   OUTPUT ID              STATUS    CREATED
    <task-id>             []    <output-id>            SUCCESS   22 minutes ago
    

    When your task’s status is SUCCESS it’s finished and you can continue to download the output.

  7. Download the output graph of the number of flights you can take.

    $ nerd dataset download <output-id> <target-dir>
    
  8. Stop Python.

    $ nerd workload stop <workload-id>
    

Are you ready to try it yourself? Give Python a spin! Right-facing arrow


Run your own Python scripts faster?

Of course you can also use this image to run your own Python scripts on a large number of high speed cores. It’s super easy: just make sure you follow the same steps as are described in the Python quickstart.

Are you frequently running the same scripts? Then it might be smarter (and faster) to create your own Python-based image and work with input datasets separately.

Find out how to use datasets and how to use private images.

About our cloudsoftware
Liesanne Wieleman
posted this January 25