Skip to main content

XCOFDK is a runtime environment to provide multithreading, multiprocessing and life cycle management to programs.

Project description

Project Description

XCOFDK is the architecture of an eXtensible, Customizable and Object-oriented Framework Development Kit.

This project presents an implementation of XCOFDK for Python through the package xcofdk.
It provides Python applications with a runtime environment capable of:

  • stable and reliable execution at any time,
  • running active services responsible for life-cycle management,
  • managed, unified error handling,
  • parallel or concurrent processing out-of-the-box,
  • instant access for transparent task or process communication,
  • providing API for auxiliary, bundled services commonly expected for application developement.

Installation

XCOFDK is available for Python versions 3.8+ on both POSIX and Windows platfroms.

NOTE:
By installing you agree to the terms and conditions of use of the software (see section Licensing below).

Install using PyPI package xcofdk:

$> # install for Python 3.12
$> python3.12 -m pip install xcofdk

Quick Start

The example below demonstrates typical use of the framework of XCOFDK by multithreaded applications.
Representing a quite simple example, it creates application's main task with synchronous execution type, which is executed by the framework from within program's entry point Main(), that is synchronously to program's MainThread:

# file : quickStart.py

from threading import current_thread as _PyCurThread  # for demonstration purposes only

from xcofdk             import fwapi
from xcofdk.fwcom       import ETernaryCallbackResultID
from xcofdk.fwcom       import override
from xcofdk.fwcom       import xlogif
from xcofdk.fwapi.xtask import MainXTask
from xcofdk.fwapi.xtask import XTaskProfile

class AppMainTask(MainXTask):
    def __init__(self):
        _tp = XTaskProfile.CreateSynchronousTaskProfile(aliasName_='appMainTask')
        MainXTask.__init__(self, taskProfile_=_tp)

    @override
    def RunXTask(self) -> ETernaryCallbackResultID:
        _msg  = 'sync.' if self.xtaskProfile.isSynchronousTask else 'async.'
        _msg  = f'Welcome to XCOFDK by {_msg} {self.xtaskAliasName}:'
        _msg += f'\n\tcurrent host thread : {_PyCurThread().name}'
        xlogif.LogInfo(_msg)
        return ETernaryCallbackResultID.STOP

def Main():
    if not fwapi.StartXcoFW(): return 71   # step 1: start the framework
                                           #
    _myTsk = AppMainTask()                 # step 2: create application's main task
    _myTsk.Start()                         # step 3: start main task
    _myTsk.Join()                          # step 4: wait for main task's termination
    fwapi.StopXcoFW()                      # step 5: stop the framework
    _bLcErrorFree = fwapi.JoinXcoFW()      # step 6: wait for framework's coordinated shutdown
                                           #
    res = 72 if not _bLcErrorFree else 0   # step 7: check for LC failure (if any)
    return res

if __name__ == "__main__":
    exit(Main())

The output of the program should look like below:

$> python3.12 -m quickStart
...
[14:11:19.856 KPI] Done initial (resource) loading, consumed CPU time was: 0.090
[14:11:19.857 KPI] Framework is up and running, consumed CPU time was: 0.064
[14:11:19.868 XINF][XTd_501001] Welcome to XCOFDK by sync. appMainTask:
    current host thread : MainThread
[14:11:19.871 INF][XTd_501001] Got request to stop framework.
[14:11:19.872 KPI][XTd_501001] Starting coordinated shutdown...
[14:11:19.873 INF][XTd_501001] Got request to join framework.
[14:11:19.873 INF][XTd_501001] Waiting for framework to complete shutdown sequence...
[14:11:19.974 KPI] Finished coordinated shutdown.
[14:11:19.991 KPI] Framework active tracking duration: 0.188

--------------------------------------------------------------------------------
Fatals(0), Errors(0), Warnings(0), Infos(4)
Total processing time: 0.293
--------------------------------------------------------------------------------
...

More related information available on:


Licensing

XCOFDK is available under MIT License.


Links

<style> td, th { border: none!important; } </style>
Main page : XCOFDK on GitHub
Wiki : XCOFDK Wiki
License file : MIT License

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xcofdk-2.0.1-py3-none-any.whl (521.6 kB view details)

Uploaded Python 3

File details

Details for the file xcofdk-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: xcofdk-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 521.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for xcofdk-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9b70e77bdcc11f49a026ff4e78a7680ad814c35f4757b9f17137859f6ddfdb43
MD5 34aee85de965625d9aff890b9e587859
BLAKE2b-256 32847dbb7e7cde801401727f5182e72c5364457c0d343ac0bde6c1a6bb09e10b

See more details on using hashes here.

Supported by

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