Skip to main content

Workflow framework for data pre- and postprocessing.

Project description

PyPI version PyPI license pipeline status coverage report

The ioProc workflow manager

ioproc is a light-weight workflow manager for Python ensuring robust, scalable and reproducible data pipelines. The tool is developed at the German Aerospace Center (DLR) for and in the scientific context of energy systems analysis, however, it is widely applicable in other scientific fields.

how-to install

Setup a new Python environment and install ioProc using

pip install ioproc   

how-to configure

Configure your pipeline in the user.yaml. The workflow is defined by a list of actions. These must contain the fields project, call and data (with sub fields read_from_dmgr, and write_to_dmgr). The user may specify additional fields for each action under the optional key args.
You may get inspiration from the default actions in general.py.

You may also have a look into the snippets section where several basic ioproc functionalities are described:

default actions provided by ioProc

readExcel

This function is used to parse Excel files and storing it in the Data manager.

@action('general')
def parse_excel(dmgr, config, params):
    '''
    Parses given `excelFile` for specified `excelSheets` as dataframe object and stores it in the datamanager by the 
    key specified in `write_to_dmgr`.
    `excelHeader` can be set to `True` or `False`.
    
    The action may be specified in the user.yaml as follows:
    - action:
        project: general
        call: parse_excel
        data:
            read_from_dmgr: null
            write_to_dmgr: parsedData
        args:  
            excelFile: spreadsheet.xlsx
            excelSheet: sheet1
            excelHeader: True
    '''

    args = params['args']
    file = get_field(args, 'excelFile')
    excel_sheet = get_excel_sheet(args)
    header = get_header(get_field(args, 'excelHeader'))
    parsed_excel = pd.read_excel(io=file, sheet_name=excel_sheet, header=header)

    with dmgr.overwrite:
        dmgr[params['data']['write_to_dmgr']] = parsed_excel

checkpoint

Checkpoints save the current state and content of the data manger to disk in HDF5 format. The workflow can be resumed at any time from previously created checkpoints.

@action('general')
def checkpoint(dmgr, config, params):
    '''
    creates a checkpoint file in the current working directory with name
    Cache_TAG while TAG is supplied by the action config.

    :param tag: the tag for this checkpoint, this can never be "start"
    '''
    assert params['tag'] != 'start', 'checkpoints can not be named start'
    dmgr.toCache(params['tag'])
    mainlogger.info('set checkpoint "{}"'.format(params['tag']))

printData

This action prints all data stored in the data manager to the console. It can therefore be used for conveniently debugging a workflow.

@action('general')
def printData(dmgr, config, params):
    '''
    simple debugging printing function. Prints all data in the data manager.

    Does not have any parameters.
    '''
    for k, v in dmgr.items():
        mainlogger.info(k+' = \n'+str(v))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ioproc-2.2.0.tar.gz (25.6 kB view details)

Uploaded Source

Built Distribution

ioproc-2.2.0-py3-none-any.whl (34.5 kB view details)

Uploaded Python 3

File details

Details for the file ioproc-2.2.0.tar.gz.

File metadata

  • Download URL: ioproc-2.2.0.tar.gz
  • Upload date:
  • Size: 25.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.5 Windows/10

File hashes

Hashes for ioproc-2.2.0.tar.gz
Algorithm Hash digest
SHA256 39d46139322ea10e42ab2b19c92fa8994d52d0f1a0bcc4f1759ca220139f7191
MD5 ac534b2624eba75553c46053ad51bd56
BLAKE2b-256 85a6497ec40841db21cd000cf32a645d0c353cc5c8160cf27894185f4386b9de

See more details on using hashes here.

File details

Details for the file ioproc-2.2.0-py3-none-any.whl.

File metadata

  • Download URL: ioproc-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 34.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.5 Windows/10

File hashes

Hashes for ioproc-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0cc52358608cbae2a6825e74ae0bb76279281459ccce38515ace889bd34ce22e
MD5 fd4f1afb01d6762fb940d69ef2e0ab10
BLAKE2b-256 37d151b61eede347099e656ebe8a7a26268ac290ab7096c05fadd708ee96998c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page