Guide to creating a zip package for PYTHON offline tasks

Updated at:

Note: Python offline tasks support Python 3.6.

Specifications for PYTHON offline task application zip packages

  1. Do not include start.sh or start_flow.sh in the root directory of the zip package.

    The following example shows the zip package structure.

    xxx.zip     ## The zip package must contain only the algorithm code. Do not include the start.sh and start_flow.sh files in the root directory.
      - my_algo.py
      - Other required files

    The following example shows the code for my_algo.py. You can customize the code based on your business logic.

    Note: If you configure input and response parameters in Data Development, you can retrieve them from the ZERG_APP_PARAM environment variable.

    #!/usr/bin/python
    # -*- coding:utf-8 -*-
    
    import sys
    
    print("------start")
    
    print("Args:"+ str(sys.argv))
    
    print("------end")

    In the folder that contains my_algo.py and other required algorithm files, run the following command to create the python_job_test.zip package.

    zip -r python_job_test.zip ./*

    Upload the created zip package when you add the application.

  1. Write the offline task application script

    When you add the offline task application, write the application script as shown in the following example.

    #! /bin/bash
    
    cd `dirname $0`
    
    echo "--------start------->>"
    
    python my_algo.py "$1"
    
    echo "--------end------->>"

    After you finish writing the script, save it.