Skip to main content

jk_interprocesssync

Introduction

This python module provides simple synchronization and data transfer mechanisms for processes residing on the same host.

Information about this module can be found here:

Why this module?

Sometimes it is necessary to implement a single application as a set of multiple processes that cooperate on a specific problem or task. If that is the case these processes need to interoperate.

Limitations of this module

At this point, the implementation of this module is not very sophisticated. It is based on frequent polls of files or directory contents.

This approach is sufficient for limited amounts of data though. For larger amounts of data you require more sophisticated approaches. These might be added to this module at some point in the future, but for today this more simple approach exists.

This approach is somehow limited and costs a little bit of performance. In addition it is not extremely fast. Nevertheless if you use a RAM disk you will be able to process up to tens of thousands of data points per second.

How to use this module

Import this module

Please include this module into your application using the following code:

import jk_interprocesssync.fs

Basic concepts

Then - after importing - you need to follow this approach:

  • Instantiate an object that assists in synchronization or data transfer.
  • Use methods on this object for signalling, data transfer, waiting for signals or to wait for incoming data.

More about this is explained in the next sections.

Regular Events

Introduction

A regular event is a synchronization mechanism that has two operations:

  • sender : signal : signal the event;
  • listener : wait : blocks until it receives a signal; autoreset the signal;

This mechanism is implemented by Event.

NOTE: This implementation is to work in situations with ...

  • a single sender and a single listener
  • a single sender and multiple listeners

Implement a sender

Example:

evt = jk_interprocesssync.fs.Event("/my/dir/to/eventfile")

while True:
	... do something ...
	evt.signal()

Implement a listener

Example:

evt = jk_interprocesssync.fs.Event("/my/dir/to/eventfile")

for _ in evt.waitG():
	... do something ...

JSON Data Events

Introduction

A JSON data event is a synchronization mechanism that has two operations:

  • sender : signal : signal the event; additionally pass data to the listener;
  • listener : wait : blocks until it receives a signal; autoreset the signal; the data sent by the sender is returend and can be processed by the listener;

This mechanism is implemented by JSONDataEvent.

NOTE: This implementation is to work in situations with ...

  • a single sender and a single listener

Implement a sender

Example:

evt = jk_interprocesssync.fs.JSONDataEvent("/my/dir/to/ramdisk/eventfile")

while True:
	... do something ...
	evt.signal(... data ...)

Implement a listener

Example:

evt = jk_interprocesssync.fs.JSONDataEvent("/my/dir/to/ramdisk/eventfile")

for data in evt.waitG():
	... do something using the data...

JSON Data Queue

Introduction

A JSON data event is a synchronization mechanism that has two operations:

  • sender : put : put data into the queue; notifies the listener;
  • listener : get : blocks until it receives data; automatically remove the data from the queue;

This mechanism is implemented by JSONDataQueue.

NOTE: This implementation is to work in situations with ...

  • a single sender and a single listener
  • a single sender and a multiple listeners
  • a multiple senders and a single listener
  • a multiple senders and multiple listeners

Implement a sender

Example:

queue = jk_interprocesssync.fs.JSONDataQueue("/my/dir/to/ramdisk/queuedir")

while True:
	... do something ...
	queue.put(... data ...)

Implement a listener

Example:

queue = jk_interprocesssync.fs.JSONDataQueue("/my/dir/to/ramdisk/queuedir")

for data in queue.getG():
	... do something using the data...

Contact Information

This work is Open Source. This enables you to use this work for free.

Please have in mind this also enables you to contribute. We, the subspecies of software developers, can create great things. But the more collaborate, the more fantastic these things can become. Therefore Feel free to contact the author(s) listed below, either for giving feedback, providing comments, hints, indicate possible collaborations, ideas, improvements. Or maybe for "only" reporting some bugs:

License

This software is provided under the following license:

  • Apache Software License 2.0

Metadata

Release files for jk-interprocesssync 0.2020.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jk-interprocesssync 0.2020.4.1
File Size Uploaded
jk_interprocesssync-0.2020.4.1.tar.gz 9.7 kB Details

Release files / jk_interprocesssync-0.2020.4.1.tar.gz

Download URL jk_interprocesssync-0.2020.4.1.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4c3ea59a4ff46a190e43e65b3a5f94d0842743810ba68b0b3d4faa8d820a974d
BLAKE2b-256 checksum
How to use checksums
748db2df90d3d857503bc5b23faaeed34dbf68fa083ad5b2e1995aa8d84638bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.2

Release history Release notifications | RSS feed

This release

0.2020.4.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page