Right-pointing chevronfacebooklinkedintwitter



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. Upload the folder containing your Python scripts and data files.

    This folder may include a requirements.txt file describing your Python dependencies.

    $ nerd dataset upload --name=python-input <path>
    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'

    Don’t have a Python script at hand? Download our CO2 calculator and unzip it.

  3. Execute the Python script.

    Use the following command to execute our example 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'

    You can also use our Python image to run your own scripts.

    $ nerd job run --name=python-run --input=python-input:/input --output=python-output:/output nerdalize/pythonapp:v3 <main-python-file> <python-arguments>

    Or if you prefer using Python 2, you can use the following commands.

    $ nerd job run --name=python-run --input=python-input:/input --output=python-output:/output nerdalize/pythonapp:v2 <main-python-file> <python-arguments>
  4. 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
  5. Download the collection of output files.

    $ nerd dataset download --output-of python-run <target_dir>
    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