Python - External Modules: import within project

In order to use external modules on Saagie platform it is possible to import required module within your package.

For example to use polyglot module:

  • The following file will be used as an entry point script:
# Module import
import pygogo as gogo
import statistics

# Use of module
def compute_mean(data):
    gogo.Gogo('stdout', low_hdlr=hdlr).logger.debug(statistics.mean(data))

# Script
if __name__ == '__main__':
    hdlr = gogo.handlers.stdout_hdlr()
    compute_mean([1, 2, 7, 9, 5])

  • Create a zip file with the following structure:

Please note that whenever there is more than one python file into the zip archive, there have to be a file which will be used as an entry point.

  • You can then create a job and use the following command to launch the script:
Python execution command
python {file}