edit Copy Return Up-pointing chevronRight-pointing chevronfacebooklinkedintwitter

Python

Versions

2.7.14, 3.6.3

Python is an easy-to-use programming language, which is often used for data science and scientific computations. This guide explains how you can run Python scripts on Nerdalize without any knowledge of Docker. You can simply upload a folder with your Python scripts, data files and, if you have any Python dependencies, a requirements.txt.

Running your Python workload on Nerdalize

  1. Make sure you’ve set up Nerd, our CLI.

  2. Set up your Python scripts and data files.

    Download our example dataset with our CO2 calculator and unzip it.

    Alternatively you can use your own dataset that contains a Python script. It may also include a requirements.txt file describing your Python dependencies. If you’re not sure what it should look like, just view our example dataset.

  3. Upload the folder containing your Python scripts and data files.

    $ nerd dataset upload --name=python-input path-to-data-folder
    
    Archiving (Step 1/2): 132 B / 132 B [=======] 100.00% 0s
    Uploading (Step 2/2): 1.02 KB / 1.02 KB [=======] 100.00% 0s
    Uploaded dataset: 'python-input'
    To run a job with a dataset, use: 'nerd job run'
    
  4. Execute the Python script.

    $ nerd job run \
      --name=python-run \
      --input=python-input:/input \
      --output=python-output:/output \
      nerdalize/pythonapp:v3 \
      co2_calc.py 5
    
    Submitted job: 'python-run'
    To see whats happening, use: 'nerd job list'
    

    If you’re using your own script, you can customise the script name and arguments as well as the Python version and output folder.

  5. Check on the status of your task.

    $ nerd job list
    
    JOB         IMAGE   INPUT          OUTPUT          MEMORY   VCPU   CREATED AT      PHASE     DETAILS   
    python-run  python  python-input   python-output   3.0      2.0    6 seconds ago   Running    
    

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

    If you want to review the log output, run:

    $ nerd job logs python-run
    
  6. Download the collection of output files.

    $ nerd dataset download python-output ~/my-python-output
    
    Downloading (Step 1/2): 972.80 KB / 972.80 KB [=======] 100.00% 0s
    Unarchiving (Step 2/2): 972.80 KB / 972.80 KB [=======] 100.00% 0s
    Downloaded 1 dataset
    

You’ve run Python on Nerdalize. Awesome!

You can run another Python computation or use your one of our other applications.

Have any questions about using Nerdalize cloud?

Get in touch