Skip to main content

DAG in django

Project description

django-dagmodel

https://img.shields.io/pypi/v/dag.svg

DAG in django

Installation

$ pip install django-dagmodel

or

$ python setup install

Usage

from dag import with_dag_node, with_dag_edge, with_dag


class MyJob(model.Model):
    name = models.CharField(max_length=20)


class MyNode(with_dag_node('MyEdge', 'MyDag')):
    name = models.CharField(max_length=10, unique=True)

    def __str__(self):
        return self.name


class MyEdge(with_dag_edge(MyNode)):
    def __str__(self):
        return f"{self.prev_node} -> {self.next_node}"

    def __repr__(self):
        return f"{self.prev_node} -> {self.next_node}"


class MyDag(with_dag(MyJob, 'MyEdge')): ...

>>> job = TestJob.objects.create(name='myjob')
>>> dag = MyDag.objects.create(job=job)

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.1.0 (2021-06-12)

  • First release on PyPI.

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

django-dagmodel-0.1.0.tar.gz (7.0 kB view hashes)

Uploaded Source

Built Distribution

django_dagmodel-0.1.0-py2.py3-none-any.whl (5.7 kB view hashes)

Uploaded Python 2 Python 3

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