asmg_workflow
workflow is a package for scientific workflow construction. To change the imported API, change the dictionary API_MODULES to have an entry DE_API_MODULE["code.subpackage.module"]=True in this __init__.py file.
1# ----------------------------------------------------------------------------- 2# Name: __init__ 3# Purpose: To define the API interface for workflow package 4# Authors: aric.sanders@nist.gov, 5# Created: 9/18/2020 6# License: MIT License 7# ----------------------------------------------------------------------------- 8 9""" 10workflow is a package for scientific workflow construction. 11To change the imported API, change the dictionary API_MODULES to have an entry 12DE_API_MODULE["code.subpackage.module"]=True 13 in this __init__.py file. 14 15""" 16 17#---------------------------------------------------------------------- 18# Standard Imports 19import os 20import sys 21 22# ----------------------------------------------------------------------------- 23# Third Party Imports 24 25# ----------------------------------------------------------------------------- 26# Module Constants 27VERBOSE_IMPORT = False 28TIMED_IMPORT = False 29__version__ = '0.1.3' 30"Constant that determines if import statements are echoed to output" 31# The new module load scheme can be for module in DE_API_MODULES.keys() 32# ----------------------------------------------------------------------------- 33DE_API_MODULES = {"asmg_workflow.logs": True, 34 "asmg_workflow.tasks": True, 35 "asmg_workflow.workflows": True, 36 } 37 38"Dictionary that controls the definition of the API, this can be set to leave out any unwanted modules. Also it is" \ 39 "possible to discover all modules by DE_API_MODULES.keys()" 40 41# This makes sure this file is the one loaded 42sys.path.append(os.path.dirname(__file__)) 43# To tune the imported API change the DE_API_MODULES dictionary 44if TIMED_IMPORT: 45 import datetime 46 47 first_timer = datetime.datetime.utcnow() 48 start_timer = datetime.datetime.utcnow() 49for module in sorted(DE_API_MODULES.keys()): 50 try: 51 if DE_API_MODULES[module]: 52 if VERBOSE_IMPORT: 53 print(("Importing {0}".format(module))) 54 exec('from {0} import *'.format(module)) 55 if TIMED_IMPORT: 56 end_timer = datetime.datetime.utcnow() 57 time_difference = end_timer - start_timer 58 print(("It took {0} s to import {1}".format(time_difference.total_seconds(), module))) 59 start_timer = end_timer 60 except: 61 print(f"The {module} failed to import") 62 pass 63if TIMED_IMPORT: 64 end_timer = datetime.datetime.utcnow() 65 time_difference = end_timer - first_timer 66 print(("It took {0} s to import all of the active modules".format(time_difference.total_seconds())))
VERBOSE_IMPORT =
False
TIMED_IMPORT =
False
DE_API_MODULES =
{'asmg_workflow.logs': True, 'asmg_workflow.tasks': True, 'asmg_workflow.workflows': True}
Dictionary that controls the definition of the API, this can be set to leave out any unwanted modules. Also it ispossible to discover all modules by DE_API_MODULES.keys()