Skip to content

Commit

Permalink
changed to generic "dropclass" keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
awicenec committed May 7, 2023
1 parent 817bf8e commit ae60b2b
Show file tree
Hide file tree
Showing 68 changed files with 432 additions and 422 deletions.
4 changes: 2 additions & 2 deletions OpenAPI/tests/test.graph
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@
"defaultValue": "",
"description": "",
"keyAttribute": false,
"name": "appclass",
"name": "dropclass",
"options": [],
"positional": false,
"precious": false,
"readonly": false,
"text": "Appclass",
"text": "dropclass",
"type": "Unknown",
"value": "dlg.apps.simple.SleepAndCopyApp"
},
Expand Down
30 changes: 18 additions & 12 deletions daliuge-common/dlg/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,19 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
from enum import Enum
from dataclasses import dataclass, field, asdict
import logging

"""Common utilities used by daliuge packages"""
from .osutils import terminate_or_kill, wait_or_kill
from .network import check_port, connect_to, portIsClosed, portIsOpen, write_to
from .streams import ZlibCompressedStream, JSONStream


class DropType:
"""
Class defining the LG keyword to be used to load the module defining the Drop.
"""

DATACLASS = "dataclass"
APPCLASS = "appclass"
SOCKETCLASS = "socket"
SERVICECLASS = "serviceapp" # App drop that runs continously
CONTAINERCLASS = "container" # Drop that contains other drops
logger = logging.getLogger(__name__)


class CategoryType:
class CategoryType(str, Enum):
DATA = "Data"
APPLICATION = "Application"
CONSTRUCT = "Construct"
Expand Down Expand Up @@ -78,6 +72,18 @@ class dropdict(dict):
DROPManager.
"""

def __init__(self, init_dict=None):
if init_dict is None:
init_dict = {
"oid": None,
"categoryType": "Unknown",
}

self.update(init_dict)
if "oid" not in self:
self.update({"oid": None})
return super().__init_subclass__()

def _addSomething(self, other, key, name=None):
if key not in self:
self[key] = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
from enum import Enum

from dlg.common.reproducibility.constants import ReproducibilityFlags
from dlg.common import DropType
import logging

logger = logging.getLogger("__name__")
Expand Down Expand Up @@ -167,11 +166,11 @@ def lg_block_fields(
elif category_type == "Variables":
pass
elif category_type == "Branch":
data[DropType.APPCLASS] = FieldOps.STORE
data["dropclass"] = FieldOps.STORE
elif category_type == "PythonApp":
data[DropType.APPCLASS] = FieldOps.STORE
data["dropclass"] = FieldOps.STORE
elif category_type == "Component":
data[DropType.APPCLASS] = FieldOps.STORE
data["dropclass"] = FieldOps.STORE
elif category_type == "BashShellApp":
data["Arg01"] = FieldOps.STORE
elif category_type == "Mpi":
Expand Down
2 changes: 1 addition & 1 deletion daliuge-engine/dlg/apps/archiving.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def store(self, inputDrop):
# @par EAGLE_START
# @param category PythonApp
# @param tag daliuge
# @param appclass Application Class/dlg.apps.archiving.NgasArchivingApp/String/ComponentParameter/readonly//False/False/Application class
# @param dropclass Application Class/dlg.apps.archiving.NgasArchivingApp/String/ComponentParameter/readonly//False/False/Application class
# @param input_parser Input Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Input port parsing technique
# @param output_parser Output Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Output port parsing technique
# @param execution_time Execution Time/5/Float/ComponentParameter/readonly//False/False/Estimated execution time
Expand Down
2 changes: 1 addition & 1 deletion daliuge-engine/dlg/apps/branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# @par EAGLE_START
# @param category Branch
# @param tag template
# @param appclass Application Class/dlg.apps.simple.SimpleBranch/String/ComponentParameter/readonly//False/False/Application class
# @param dropclass Application Class/dlg.apps.simple.SimpleBranch/String/ComponentParameter/readonly//False/False/Application class
# @param input_parser Input Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Input port parsing technique
# @param output_parser Output Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Output port parsing technique
# @param execution_time Execution Time/5/Float/ComponentParameter/readonly//False/False/Estimated execution time
Expand Down
2 changes: 1 addition & 1 deletion daliuge-engine/dlg/apps/crc.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def run(self):
# @par EAGLE_START
# @param category PythonApp
# @param tag daliuge
# @param appclass Application Class/dlg.apps.crc.CRCStreamApp/String/ComponentParameter/readonly//False/False/Application class
# @param dropclass Application Class/dlg.apps.crc.CRCStreamApp/String/ComponentParameter/readonly//False/False/Application class
# @param input_parser Input Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Input port parsing technique
# @param output_parser Output Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Output port parsing technique
# @param execution_time Execution Time/5/Float/ComponentParameter/readonly//False/False/Estimated execution time
Expand Down
2 changes: 1 addition & 1 deletion daliuge-engine/dlg/apps/pyfunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class DropParser(Enum):
# @par EAGLE_START
# @param category PythonApp
# @param tag template
# @param appclass Application Class/dlg.apps.pyfunc.PyFuncApp/String/ComponentParameter/readonly//False/False/Application class
# @param dropclass Application Class/dlg.apps.pyfunc.PyFuncApp/String/ComponentParameter/readonly//False/False/Application class
# @param execution_time Execution Time/5/Float/ComponentParameter/readonly//False/False/Estimated execution time
# @param num_cpus No. of CPUs/1/Integer/ComponentParameter/readonly//False/False/Number of cores used
# @param group_start Group start/False/Boolean/ComponentParameter/readwrite//False/False/Is this node the start of a group?
Expand Down
2 changes: 1 addition & 1 deletion daliuge-engine/dlg/apps/scp.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
# @par EAGLE_START
# @param category PythonApp
# @param tag daliuge
# @param appclass Application Class/dlg.apps.scp.ScpApp/String/ComponentParameter/readonly//False/False/Application class
# @param dropclass Application Class/dlg.apps.scp.ScpApp/String/ComponentParameter/readonly//False/False/Application class
# @param input_parser Input Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Input port parsing technique
# @param output_parser Output Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Output port parsing technique
# @param execution_time Execution Time/5/Float/ComponentParameter/readonly//False/False/Estimated execution time
Expand Down
28 changes: 14 additions & 14 deletions daliuge-engine/dlg/apps/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def run(self):
# @par EAGLE_START
# @param category PythonApp
# @param tag template
# @param appclass Application Class//String/ComponentParameter/readonly//False/False/Application class
# @param dropclass Application Class//String/ComponentParameter/readonly//False/False/Application class
# @param num_cpus No. of CPUs/1/Integer/ComponentParameter/readonly//False/False/Number of cores used
# @param execution_time Execution Time/5/Float/ComponentParameter/readonly//False/False/Estimated execution time
# @param group_start Group start/False/Boolean/ComponentParameter/readwrite//False/False/Is this node the start of a group?
Expand All @@ -96,7 +96,7 @@ class PythonApp(BarrierAppDROP):
# @param category PythonApp
# @param tag daliuge
# @param sleep_time sleep_time/5/Integer/ApplicationArgument/readwrite//False/False/The number of seconds to sleep
# @param appclass appclass/dlg.apps.simple.RandomArrayApp/String/ComponentParameter/readonly//False/False/Application class
# @param dropclass dropclass/dlg.apps.simple.RandomArrayApp/String/ComponentParameter/readonly//False/False/Application class
# @param execution_time execution_time/5/Float/ComponentParameter/readonly//False/False/Estimated execution time
# @param num_cpus num_cpus/1/Integer/ComponentParameter/readonly//False/False/Number of cores used
# @param group_start group_start/False/Boolean/ComponentParameter/readwrite//False/False/Is this node the start of a group?
Expand Down Expand Up @@ -143,7 +143,7 @@ def run(self):
# @param category PythonApp
# @param tag daliuge
# @param bufsize buffer size/65536/Integer/ApplicationArgument/readwrite//False/False/Buffer size
# @param appclass appclass/dlg.apps.simple.RandomArrayApp/String/ComponentParameter/readonly//False/False/Application class
# @param dropclass dropclass/dlg.apps.simple.RandomArrayApp/String/ComponentParameter/readonly//False/False/Application class
# @param execution_time execution_time/5/Float/ComponentParameter/readonly//False/False/Estimated execution time
# @param num_cpus num_cpus/1/Integer/ComponentParameter/readonly//False/False/Number of cores used
# @param group_start group_start/False/Boolean/ComponentParameter/readwrite//False/False/Is this node the start of a group?
Expand Down Expand Up @@ -207,7 +207,7 @@ def copyRecursive(self, inputDrop):
# @param sleep_time sleep_time/5/Integer/ApplicationArgument/readwrite//False/False/The number of seconds to sleep
# @param input_parser Input Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Input port parsing technique
# @param output_parser Output Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Output port parsing technique
# @param appclass appclass/dlg.apps.simple.RandomArrayApp/String/ComponentParameter/readonly//False/False/Application class
# @param dropclass dropclass/dlg.apps.simple.RandomArrayApp/String/ComponentParameter/readonly//False/False/Application class
# @param execution_time execution_time/5/Float/ComponentParameter/readonly//False/False/Estimated execution time
# @param num_cpus num_cpus/1/Integer/ComponentParameter/readonly//False/False/Number of cores used
# @param group_start group_start/False/Boolean/ComponentParameter/readwrite//False/False/Is this node the start of a group?
Expand All @@ -233,7 +233,7 @@ def run(self):
# @param low low/0/Float/ApplicationArgument/readwrite//False/False/Low value of range in array [inclusive]
# @param high high/1/Float/ApplicationArgument/readwrite//False/False/High value of range of array [exclusive]
# @param integer integer/True/Boolean/ApplicationArgument/readwrite//False/False/Generate integer array?
# @param appclass appclass/dlg.apps.simple.RandomArrayApp/String/ComponentParameter/readonly//False/False/Application class
# @param dropclass dropclass/dlg.apps.simple.RandomArrayApp/String/ComponentParameter/readonly//False/False/Application class
# @param input_parser Input Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Input port parsing technique
# @param output_parser Output Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Output port parsing technique
# @param execution_time execution_time/5/Float/ComponentParameter/readonly//False/False/Estimated execution time
Expand Down Expand Up @@ -316,7 +316,7 @@ def _getArray(self):
# @param category PythonApp
# @param tag daliuge
# @param method method/mean/Select/ApplicationArgument/readwrite/mean,median/False/False/The method used for averaging
# @param appclass appclass/dlg.apps.simple.RandomArrayApp/String/ComponentParameter/readonly//False/False/Application class
# @param dropclass dropclass/dlg.apps.simple.RandomArrayApp/String/ComponentParameter/readonly//False/False/Application class
# @param input_parser Input Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Input port parsing technique
# @param output_parser Output Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Output port parsing technique
# @param execution_time execution_time/5/Float/ComponentParameter/readonly//False/False/Estimated execution time
Expand Down Expand Up @@ -415,7 +415,7 @@ def averageArray(self):
# @param construct Gather
# @param tag daliuge
# @param num_of_inputs num_of_inputs/4/Integer/ConstructParameter/readwrite//False/False/The Gather “width”, stating how many inputs each Gather instance will handle
# @param appclass appclass/dlg.apps.simple.RandomArrayApp/String/ComponentParameter/readonly//False/False/Application class
# @param dropclass dropclass/dlg.apps.simple.RandomArrayApp/String/ComponentParameter/readonly//False/False/Application class
# @param input_parser Input Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Input port parsing technique
# @param output_parser Output Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Output port parsing technique
# @param execution_time execution_time/5/Float/ComponentParameter/readonly//False/False/Estimated execution time
Expand Down Expand Up @@ -451,7 +451,7 @@ def run(self):
# @param num_of_inputs num_of_inputs/4/Integer/ConstructParameter/readwrite//False/False/The Gather “width”, stating how many inputs each Gather instance will handle
# @param function function/sum/Select/ApplicationArgument/readwrite/sum,prod,min,max,add,multiply,maximum,minimum/False/False/The function used for gathering
# @param reduce_axes reduce_axes/None/String/ApplicationArgument/readonly//False/False/The ndarray axes to reduce, None reduces all axes for sum, prod, max, min functions
# @param appclass appclass/dlg.apps.simple.RandomArrayApp/String/ComponentParameter/readonly//False/False/Application class
# @param dropclass dropclass/dlg.apps.simple.RandomArrayApp/String/ComponentParameter/readonly//False/False/Application class
# @param input_parser Input Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Input port parsing technique
# @param output_parser Output Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Output port parsing technique
# @param execution_time execution_time/5/Float/ComponentParameter/readonly//False/False/Estimated execution time
Expand Down Expand Up @@ -560,7 +560,7 @@ def gather_inputs(self):
# @param category PythonApp
# @param tag daliuge
# @param greet greet/World/String/ApplicationArgument/readwrite//False/False/What appears after 'Hello '
# @param appclass appclass/dlg.apps.simple.RandomArrayApp/String/ComponentParameter/readonly//False/False/Application class
# @param dropclass dropclass/dlg.apps.simple.RandomArrayApp/String/ComponentParameter/readonly//False/False/Application class
# @param execution_time execution_time/5/Float/ComponentParameter/readonly//False/False/Estimated execution time
# @param input_parser Input Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Input port parsing technique
# @param output_parser Output Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Output port parsing technique
Expand Down Expand Up @@ -623,7 +623,7 @@ def run(self):
# @param category PythonApp
# @param tag daliuge
# @param url url/"https://eagle.icrar.org"/String/ApplicationArgument/readwrite//False/False/The URL to retrieve
# @param appclass appclass/dlg.apps.simple.RandomArrayApp/String/ComponentParameter/readonly//False/False/Application class
# @param dropclass dropclass/dlg.apps.simple.RandomArrayApp/String/ComponentParameter/readonly//False/False/Application class
# @param execution_time execution_time/5/Float/ComponentParameter/readonly//False/False/Estimated execution time
# @param input_parser Input Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Input port parsing technique
# @param output_parser Output Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Output port parsing technique
Expand Down Expand Up @@ -682,7 +682,7 @@ def run(self):
# @param num_of_copies num_of_copies/4/Integer/ConstructParameter/readwrite//False/False/Specifies the number of replications of the content of the scatter construct
# @param group_start group_start/False/Boolean/ComponentParameter/readwrite//False/False/Is this node the start of a group?
# @param n_tries n_tries/1/Integer/ComponentParameter/readwrite//False/False/Specifies the number of times the 'run' method will be executed before finally giving up
# @param appclass appclass/dlg.apps.simple.GenericScatterApp/String/ComponentParameter/readonly//False/False/Application class
# @param dropclass dropclass/dlg.apps.simple.GenericScatterApp/String/ComponentParameter/readonly//False/False/Application class
# @param input_parser Input Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Input port parsing technique
# @param output_parser Output Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Output port parsing technique
# @param execution_time execution_time/5/Float/ComponentParameter/readonly//False/False/Estimated execution time
Expand Down Expand Up @@ -748,7 +748,7 @@ def run(self):
# @param num_of_copies num_of_copies/4/Integer/ConstructParameter/readwrite//False/False/Specifies the number of replications of the content of the scatter construct
# @param scatter_axes scatter_axes//String/ApplicationArgument/readwrite//False/False/The axes to split input ndarrays on, e.g. [0,0,0], length must match the number of input ports
# @param group_start group_start/False/Boolean/ComponentParameter/readwrite//False/False/Is this node the start of a group?
# @param appclass appclass/dlg.apps.simple.GenericNpyScatterApp/String/ComponentParameter/readonly//False/False/Application class
# @param dropclass dropclass/dlg.apps.simple.GenericNpyScatterApp/String/ComponentParameter/readonly//False/False/Application class
# @param input_parser Input Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Input port parsing technique
# @param output_parser Output Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Output port parsing technique
# @param execution_time execution_time/5/Float/ComponentParameter/readonly//False/False/Estimated execution time
Expand Down Expand Up @@ -827,7 +827,7 @@ def condition(self):
# @par EAGLE_START
# @param category PythonApp
# @param tag daliuge
# @param appclass appclass/dlg.apps.simple.RandomArrayApp/String/ComponentParameter/readonly//False/False/Application class
# @param dropclass dropclass/dlg.apps.simple.RandomArrayApp/String/ComponentParameter/readonly//False/False/Application class
# @param input_parser Input Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Input port parsing technique
# @param output_parser Output Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Output port parsing technique
# @param execution_time execution_time/5/Float/ComponentParameter/readonly//False/False/Estimated execution time
Expand Down Expand Up @@ -892,7 +892,7 @@ def run(self):
# @param category PythonApp
# @param tag daliuge
# @param size size/100/Integer/ApplicationArgument/readwrite//False/False/the size of the array
# @param appclass appclass/dlg.apps.simple.RandomArrayApp/String/ComponentParameter/readonly//False/False/Application class
# @param dropclass dropclass/dlg.apps.simple.RandomArrayApp/String/ComponentParameter/readonly//False/False/Application class
# @param input_parser Input Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Input port parsing technique
# @param output_parser Output Parser/pickle/Select/ApplicationArgument/readwrite/raw,pickle,eval,npy,path,dataurl/False/False/Output port parsing technique
# @param execution_time execution_time/5/Float/ComponentParameter/readonly//False/False/Estimated execution time
Expand Down
Loading

0 comments on commit ae60b2b

Please sign in to comment.