Skip to main content

Simplify Function Scheduler with Python 3

Project description

f-scheduler

Simplify Lightweight Function Scheduler with Python 3

f(unction)-scheduler is a Python package designed to Simplify Lightweight Function Scheduling. It is built with Python 3.

Inspiration

The inspiration for this project came from studying the code of Apache Airflow operators.

The functionality and design patterns observed in the Airflow operators have greatly influenced the development of f-scheduler.

Installation

You can install f-scheduler using pip:

pip install f-scheduler

Usage

# import f_scheduler package
from f_scheduler import ConditionOperator, DefaultFunctionOperator, IterFunctionOperator, DAG, Converter

# create a DAG
dag = DAG(use_graphlib=True)

# add tasks to the DAG
dag.add_task(DefaultFunctionOperator(function=print, param=(['hello']), task_id='hello_task'))
dag.add_task(DefaultFunctionOperator(function=print, param=(['bye']), task_id='bye_task'))
dag.add_task(ConditionOperator(10 > 1, task_id='condition_task'))
dag.add_task(IterFunctionOperator(function=print, param=(['What your name?']), iterations=5, task_id='iter_task'))

# set the dependency between tasks :  hello_task >> condition_task >> iter_task >> bye_task
task_order = ['hello_task', 'condition_task', 'iter_task', 'bye_task']

# set the dependency between tasks
# using the converter
converter = Converter(dag)
converter.convert_list_to_dag(task_order).run()
# or dag.set_downstream('hello_task', 'condition_task')
# dag.set_downstream('condition_task', 'iter_task')

# if you want to get the return value of the task, you can use this method
print(dag.get_return_value('iter_task'))

# print all tasks
print(dag.get_all_tasks())

# clear all tasks
dag.clear()

License

f-scheduler is licensed under the Apache License.

Project Links

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

f_scheduler-0.4.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

f_scheduler-0.4.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file f_scheduler-0.4.0.tar.gz.

File metadata

  • Download URL: f_scheduler-0.4.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for f_scheduler-0.4.0.tar.gz
Algorithm Hash digest
SHA256 c90234398dddb3e98540834187fbfe51382907ade5f8aac32d3c19661f2f8464
MD5 ab1fec9583e02e7225c972fec3cdd001
BLAKE2b-256 213eee35fd153faf6b04c294199f1b24612131fec108c8644bf3d62540118930

See more details on using hashes here.

File details

Details for the file f_scheduler-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: f_scheduler-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for f_scheduler-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7e80da1ff9fd4c1a17808e28836f5d3e7df1d16386390284da39ffaffe4a0d14
MD5 4818686237977d905bc8e071e710f47e
BLAKE2b-256 b419918de821ff83f7ec1ed132e82273bc51a6312af7e5f451b79dd0e6a17a07

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