Skip to content

Commit

Permalink
Adjusts engine tests for new reprodata access pattern.
Browse files Browse the repository at this point in the history
  • Loading branch information
pritchardn committed Oct 11, 2022
1 parent 810097c commit 1f93cef
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 42 deletions.
12 changes: 8 additions & 4 deletions daliuge-engine/test/deploy/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,19 @@

default_repro = {
"rmode": "1",
"lg_blockhash": "x",
"pgt_blockhash": "y",
"pg_blockhash": "z",
"RERUN":{
"lg_blockhash": "x",
"pgt_blockhash": "y",
"pg_blockhash": "z",
}
}
default_graph_repro = {
"rmode": "1",
"meta_data": {"repro_protocol": 0.1, "hashing_alg": "_sha3.sha3_256"},
"merkleroot": "a",
"signature": "b",
"RERUN": {
"signature": "b",
}
}


Expand Down
27 changes: 14 additions & 13 deletions daliuge-engine/test/manager/test_dim.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
from asyncio.log import logger
import codecs
import json
import os
import time
import unittest
from asyncio.log import logger

import pkg_resources

from dlg import runtime
from dlg import droputils
from dlg import utils
from dlg.common import tool, Categories
Expand All @@ -38,21 +37,23 @@
from dlg.testutils import ManagerStarter
from test.manager import testutils


hostname = "localhost"


default_repro = {
"rmode": "1",
"lg_blockhash": "x",
"pgt_blockhash": "y",
"pg_blockhash": "z",
"RERUN": {
"lg_blockhash": "x",
"pgt_blockhash": "y",
"pg_blockhash": "z",
}
}
default_graph_repro = {
"rmode": "1",
"meta_data": {"repro_protocol": 0.1, "hashing_alg": "_sha3.sha3_256"},
"merkleroot": "a",
"signature": "b",
"RERUN": {
"signature": "b",
}
}


Expand Down Expand Up @@ -384,7 +385,7 @@ def test_fullRound(self):
# we need to add it manually before submitting -- otherwise it will
# get rejected by the DIM.
with pkg_resources.resource_stream(
"test", "graphs/complex.js"
"test", "graphs/complex.js"
) as f: # @UndefinedVariable
complexGraphSpec = json.load(codecs.getreader("utf-8")(f))
logger.debug(f"Loaded graph: {f}")
Expand Down Expand Up @@ -425,10 +426,10 @@ def test_fullRound(self):
# Wait until the graph has finished its execution. We'll know
# it finished by polling the status of the session
while (
SessionStates.RUNNING
in testutils.get(
self, "/sessions/%s/status" % (sessionId), restPort
).values()
SessionStates.RUNNING
in testutils.get(
self, "/sessions/%s/status" % (sessionId), restPort
).values()
):
time.sleep(0.2)

Expand Down
12 changes: 8 additions & 4 deletions daliuge-engine/test/manager/test_dm.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,19 @@
hostname = "localhost"
default_repro = {
"rmode": "1",
"lg_blockhash": "x",
"pgt_blockhash": "y",
"pg_blockhash": "z",
"RERUN":{
"lg_blockhash": "x",
"pgt_blockhash": "y",
"pg_blockhash": "z",
}
}
default_graph_repro = {
"rmode": "1",
"meta_data": {"repro_protocol": 0.1, "hashing_alg": "_sha3.sha3_256"},
"merkleroot": "a",
"signature": "b",
"RERUN":{
"signature": "b",
}
}


Expand Down
12 changes: 8 additions & 4 deletions daliuge-engine/test/manager/test_mm.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,19 @@

default_repro = {
"rmode": "1",
"lg_blockhash": "x",
"pgt_blockhash": "y",
"pg_blockhash": "z",
"RERUN": {
"lg_blockhash": "x",
"pgt_blockhash": "y",
"pg_blockhash": "z",
}
}
default_graph_repro = {
"rmode": "1",
"meta_data": {"repro_protocol": 0.1, "hashing_alg": "_sha3.sha3_256"},
"merkleroot": "a",
"signature": "b",
"RERUN": {
"signature": "b",
}
}


Expand Down
14 changes: 9 additions & 5 deletions daliuge-engine/test/manager/test_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,19 @@

default_repro = {
"rmode": "1",
"lg_blockhash": "x",
"pgt_blockhash": "y",
"pg_blockhash": "z",
"RERUN": {
"lg_blockhash": "x",
"pgt_blockhash": "y",
"pg_blockhash": "z",
}
}
default_graph_repro = {
"rmode": "1",
"meta_data": {"repro_protocol": 0.1, "hashing_alg": "_sha3.sha3_256"},
"merkleroot": "a",
"signature": "b",
"RERUN": {
"signature": "b",
}
}


Expand Down Expand Up @@ -221,7 +225,7 @@ def test_reprodata_get(self):
c.addGraphSpec(sid, graph_spec)
c.deploySession(sid, completed_uids=["a"])
response = c.session_repro_data(sid)
self.assertIsNotNone(response["graph"]["a"]["reprodata"]["rg_blockhash"])
self.assertIsNotNone(response["graph"]["a"]["reprodata"]["RERUN"]["rg_blockhash"])
self.assertIsNotNone(response["reprodata"])
c.destroySession(sid)
# Test without reprodata
Expand Down
12 changes: 8 additions & 4 deletions daliuge-engine/test/manager/test_scalability.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,19 @@

default_repro = {
"rmode": "1",
"lg_blockhash": "x",
"pgt_blockhash": "y",
"pg_blockhash": "z",
"RERUN": {
"lg_blockhash": "x",
"pgt_blockhash": "y",
"pg_blockhash": "z",
}
}
default_graph_repro = {
"rmode": "1",
"meta_data": {"repro_protocol": 0.1, "hashing_alg": "_sha3.sha3_256"},
"merkleroot": "a",
"signature": "b",
"RERUN": {
"signature": "b",
}
}


Expand Down
20 changes: 12 additions & 8 deletions daliuge-engine/test/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,32 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
import unittest
import json
import unittest

import pkg_resources

from dlg import runtime, graph_loader
from dlg.common import Categories
from dlg.ddap_protocol import DROPLinkType, DROPStates, AppDROPStates
from dlg.droputils import DROPWaiterCtx
from dlg.exceptions import InvalidGraphException
from dlg.manager.session import SessionStates, Session
from dlg.common import Categories

default_repro = {
"rmode": "1",
"lg_blockhash": "x",
"pgt_blockhash": "y",
"pg_blockhash": "z",
"RERUN": {
"lg_blockhash": "x",
"pgt_blockhash": "y",
"pg_blockhash": "z",
}
}
default_graph_repro = {
"rmode": "1",
"meta_data": {"repro_protocol": 0.1, "hashing_alg": "_sha3.sha3_256"},
"merkleroot": "a",
"signature": "b",
"RERUN": {
"signature": "b",
}
}


Expand Down Expand Up @@ -125,7 +129,7 @@ def test_addGraphSpec(self):

def test_addGraphSpec_namedPorts(self):
with pkg_resources.resource_stream(
"test", "graphs/funcTestPG_namedPorts.graph"
"test", "graphs/funcTestPG_namedPorts.graph"
) as f: # @UndefinedVariable
graphSpec = json.load(f)
# dropSpecs = graph_loader.loadDropSpecs(graphSpec)
Expand Down

0 comments on commit 1f93cef

Please sign in to comment.