Esempio n. 1
0
def list_dags(detail=False):
    from dagflow.loader import get_DagRepo_Object
    repo = get_DagRepo_Object()
    detail = str(detail).strip().lower()
    detail = True if detail == "true" else False
    dag_list = repo.list_dags(detail=detail)
    return dag_list
Esempio n. 2
0
 def list_dags(self, detail=False):
     from dagflow.loader import get_DagRepo_Object
     repo = get_DagRepo_Object()
     detail = str(detail).strip().lower()
     detail = True if detail == "true" else False
     dag_list = dagflow_sdk.list_dags(detail)
     for dag in dag_list:
         pprint(dag)
Esempio n. 3
0
__author__ = 'godq'

import subprocess
import fire
import os
import sys
import json
from pprint import pprint

import dagflow.sdk as dagflow_sdk
from dagflow.loader import get_DagRepo_Object
dag_repo = get_DagRepo_Object()


class Manage:
    def __init__(self):
        pass

    @staticmethod
    def __load_dag_def_file(dag_def_path):
        if not os.path.isfile(dag_def_path):
            raise Exception("Dag def file {} not found!".format(dag_def_path))
        with open(dag_def_path, "r") as fd:
            data = fd.read()
        if isinstance(data, bytes):
            data = data.decode()
        dag = json.loads(data)
        return dag

    def register_dag(self, dag_def_path):
        dag = self.__load_dag_def_file(dag_def_path)
Esempio n. 4
0
File: dag.py Progetto: GodQ/dagflow
__author__ = 'godq'

import json

from dagflow.loader import get_DagRepo_Object
from dagflow.utils.cache_manager import CacheManager
from dagflow.step import StepStatus
from dagflow.exceptions import StepFailed
from dagflow.utils.dlock import DLock

dag_repo_obj = get_DagRepo_Object()
'''
Graph def:
    step1 -> step2, step3 -> step4
    
    ==> 
    
    step_downstreams:
    {
        step1: [step2, step3]
        step2: [step4]
        step3: [step4]
        step4: []
    }
    step_upstreams:
    {
        step1: []
        step2: [step1]
        step3: [step1]
        step4: [step2, step3]
    }
Esempio n. 5
0
def list_dag_runs(dag_name):
    from dagflow.loader import get_DagRepo_Object
    repo = get_DagRepo_Object()
    dag_run_list = repo.list_dag_runs(dag_name=dag_name)
    return dag_run_list
Esempio n. 6
0
def list_dag_run_events(dag_name, dag_run_id):
    from dagflow.loader import get_DagRepo_Object
    repo = get_DagRepo_Object()
    dag_run_events_list = repo.find_dag_run_events(dag_name=dag_name, dag_run_id=dag_run_id)
    return dag_run_events_list
Esempio n. 7
0
def add_event_to_repo(dag_name, run_id, event):
    from dagflow.loader import get_DagRepo_Object
    dag_repo = get_DagRepo_Object()
    dag_repo.add_dag_run_event(dag_name, run_id, event=event)