Skip to content

Commit

Permalink
Merge 9c05412 into 30bc92a
Browse files Browse the repository at this point in the history
  • Loading branch information
pritchardn committed Sep 13, 2022
2 parents 30bc92a + 9c05412 commit 666e0ba
Show file tree
Hide file tree
Showing 10 changed files with 1,204 additions and 64 deletions.
1 change: 1 addition & 0 deletions daliuge-translator/dlg/dropmake/web/graph_init.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function graphInit(graphType){
success: function(data) {
// get node count
var nodeCount = 0;
data = JSON.parse(data);
data.nodeDataArray.forEach(element => {
nodeCount++
});
Expand Down
55 changes: 2 additions & 53 deletions daliuge-translator/dlg/dropmake/web/lg_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,14 @@
from dlg.dropmake.pg_manager import PGManager
from dlg.dropmake.scheduler import SchedulerException
from jsonschema import validate, ValidationError
from translator_utils import lg_path, lg_exists, pgt_path, pgt_exists, lg_repo_contents, \
pgt_repo_contents, file_as_string, prepare_lgt

logger = logging.getLogger(__name__)

# Patched to be larger to accomodate large config drops
bottle.BaseRequest.MEMFILE_MAX = 1024 * 512


def file_as_string(fname, package=__name__, enc="utf8"):
b = pkg_resources.resource_string(package, fname) # @UndefinedVariable
return common.b2s(b, enc)


# lg_dir = None
post_sem = threading.Semaphore(1)
gen_pgt_sem = threading.Semaphore(1)
Expand All @@ -98,49 +94,6 @@ def file_as_string(fname, package=__name__, enc="utf8"):
LG_SCHEMA = json.loads(file_as_string("lg.graph.schema", package="dlg.dropmake"))


def lg_path(lg_name):
return "{0}/{1}".format(lg_dir, lg_name)


def lg_exists(lg_name):
return os.path.exists(lg_path(lg_name))


def pgt_path(pgt_name):
return "{0}/{1}".format(pgt_dir, pgt_name)


def pgt_exists(pgt_name):
return os.path.exists(pgt_path(pgt_name))


def lg_repo_contents():
return _repo_contents(lg_dir)


def pgt_repo_contents():
return _repo_contents(pgt_dir)


def _repo_contents(root_dir):
# We currently allow only one depth level
b = os.path.basename
contents = {}
for dirpath, dirnames, fnames in os.walk(root_dir):
if ".git" in dirnames:
dirnames.remove(".git")
if dirpath == root_dir:
continue

# Not great yet -- we should do a full second step pruning branches
# of the tree that are empty
files = [f for f in fnames if f.endswith(".graph")]
if files:
contents[b(dirpath)] = files

return contents


@route("/static/<filepath:path>")
def server_static(filepath):
staticRoot = pkg_resources.resource_filename(
Expand Down Expand Up @@ -503,10 +456,6 @@ def gen_pg_spec():
return "Fail to generate pg_spec: {0}".format(ex)


def prepare_lgt(filename, rmode: str):
return init_lg_repro_data(init_lgt_repro_data(load_lg(filename), rmode))


@get("/gen_pgt")
def gen_pgt():
"""
Expand Down
Loading

0 comments on commit 666e0ba

Please sign in to comment.