Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Liu 349 #226

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8138a4d
added a few more properties
awicenec Apr 17, 2023
a1a2ac7
Removed "nm", using "name" instead
awicenec Apr 17, 2023
325d9cb
Fixed environmentvars tests
awicenec Apr 17, 2023
c4b0a58
Fixed pg_gen test, removed comment lines
awicenec Apr 17, 2023
ab34e25
Changed loop_cxt to loop_ctx
awicenec Apr 17, 2023
e77e76e
Changed from "nm" to "name" on the node level
awicenec Apr 17, 2023
98507b0
replaced tw and dw with weight
awicenec Apr 17, 2023
e64bdfb
changed to drop_type and size from dt and sz
awicenec Apr 17, 2023
ad710e0
Changed from node.text to node.name everywhere
awicenec Apr 18, 2023
6768032
Fixed loop context
awicenec Apr 18, 2023
0773f4e
Fixed display of node name in DIM
awicenec Apr 18, 2023
1de826e
adjusting doxygen strings
awicenec Apr 18, 2023
8e109c7
Got node name and port names working
awicenec Apr 19, 2023
8fd50ed
Minor modifications
awicenec Apr 19, 2023
a3897e9
Adjusted tests
awicenec Apr 19, 2023
f7cba58
Fix python version
awicenec Apr 20, 2023
cce875d
More options to support key field names
awicenec Apr 20, 2023
01dc80f
name string for sankey; S3DROP; fix python version for tests
awicenec Apr 20, 2023
97399e7
name string for sankey; S3DROP; fix python version for tests
awicenec Apr 20, 2023
defb95c
Fixed issues with some example graphs
awicenec Apr 21, 2023
2acc47c
Cleanup of function args treatment
awicenec Apr 27, 2023
0b7368d
Fixed issues with named ports resolution
awicenec Apr 28, 2023
fc22834
Fixed test failures
awicenec Apr 28, 2023
6005d0a
added missing dependency.
awicenec May 1, 2023
f890125
Added netifaces to dependencies
awicenec May 1, 2023
0b05efd
Changed sequence for updating arguments
awicenec May 1, 2023
35a58a9
Calling correct prepareUsers function
awicenec May 1, 2023
3cf790c
Merge branch 'liu-348' into liu-349
awicenec May 2, 2023
412496b
Removed stray debug message
awicenec May 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions .github/workflows/run-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,23 @@ name: Run unit tests
on: [push, pull_request]

jobs:

run_tests:
name: Run unit tests with python ${{matrix.python-version}} - ${{ matrix.desc }}
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- python-version: '3.8'
- python-version: "3.8.10"
test_number: 0
engine: no
translator: yes
desc: "no engine"
- python-version: '3.8'
- python-version: "3.8.10"
test_number: 1
desc: "no translator"
engine: yes
translator: no
- python-version: '3.9'
- python-version: "3.9"
test_number: 2
desc: "full package"
engine: yes
Expand Down Expand Up @@ -81,8 +80,8 @@ jobs:
needs: run_tests
runs-on: ubuntu-20.04
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
6 changes: 6 additions & 0 deletions daliuge-common/dlg/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class DropType:
class CategoryType:
DATA = "Data"
APPLICATION = "Application"
CONSTRUCT = "Construct"
GROUP = "Group"
UNKNOWN = "Unknown"
SERVICE = "Service"
Expand Down Expand Up @@ -81,7 +82,12 @@ def _addSomething(self, other, key, IdText=None):
if key not in self:
self[key] = []
if other["oid"] not in self[key]:
# TODO: Returning just the other drop OID instead of the named
# port list is not a good solution. Required for the dask
# tests.
append = {other["oid"]: IdText} if IdText else other["oid"]
# if IdText is None:
# raise ValueError
self[key].append(append)

def addConsumer(self, other, IdText=None):
Expand Down
29 changes: 20 additions & 9 deletions daliuge-engine/dlg/utils.py → daliuge-common/dlg/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ def timed_import(module_name):
"""Imports `module_name` and log how long it took to import it"""
start = time.time()
module = importlib.import_module(module_name)
logger.info("Imported %s in %.3f seconds", module_name, time.time() - start)
logger.info(
"Imported %s in %.3f seconds", module_name, time.time() - start
)
return module


Expand All @@ -61,7 +63,9 @@ def get_local_ip_addr():
PROTO = netifaces.AF_INET
ifaces = netifaces.interfaces()
if_addrs = [(netifaces.ifaddresses(iface), iface) for iface in ifaces]
if_inet_addrs = [(tup[0][PROTO], tup[1]) for tup in if_addrs if PROTO in tup[0]]
if_inet_addrs = [
(tup[0][PROTO], tup[1]) for tup in if_addrs if PROTO in tup[0]
]
iface_addrs = [
(s["addr"], tup[1])
for tup in if_inet_addrs
Expand All @@ -84,7 +88,9 @@ def get_all_ipv4_addresses():
]


def register_service(zc, service_type_name, service_name, ipaddr, port, protocol="tcp"):
def register_service(
zc, service_type_name, service_name, ipaddr, port, protocol="tcp"
):
"""
ZeroConf: Register service type, protocol, ipaddr and port

Expand Down Expand Up @@ -349,6 +355,8 @@ def _wrapper(*args, **kwargs):

setattr(current_object, name, args[0])
try:
if "self" in kwargs:
kwargs.pop("self")
return f(*args, **kwargs)
finally:
setattr(current_object, name, previous)
Expand Down Expand Up @@ -380,7 +388,6 @@ def __init__(self, content):
self.buflen = 0

def readall(self):

if not self.decompressor:
return b""

Expand All @@ -397,14 +404,15 @@ def readall(self):
if not decompressed:
break
response.write(decompressed)
to_decompress = decompressor.unconsumed_tail + content.read(blocksize)
to_decompress = decompressor.unconsumed_tail + content.read(
blocksize
)

response.write(decompressor.flush())
self.decompressor = None
return response.getvalue()

def read(self, n=-1):

if n == -1:
return self.readall()

Expand All @@ -431,7 +439,6 @@ def read(self, n=-1):
return b"".join(response)

while True:

# We hope that reading n compressed bytes will yield n uncompressed
# bytes at least; we loop anyway until we read n uncompressed bytes
compressed = self.content.read(n)
Expand Down Expand Up @@ -511,13 +518,17 @@ def prepareUser(DLG_ROOT=getDlgDir()):
gr = grp.getgrgid(pw.pw_gid)
dgr = grp.getgrnam("docker")
with open(os.path.join(workdir, "passwd"), "wt") as file:
file.write(open(os.path.join(template_dir, "passwd.template"), "rt").read())
file.write(
open(os.path.join(template_dir, "passwd.template"), "rt").read()
)
file.write(
f"{pw.pw_name}:x:{pw.pw_uid}:{pw.pw_gid}:{pw.pw_gecos}:{DLG_ROOT}:/bin/bash\n"
)
logger.debug(f"passwd file written {file.name}")
with open(os.path.join(workdir, "group"), "wt") as file:
file.write(open(os.path.join(template_dir, "group.template"), "rt").read())
file.write(
open(os.path.join(template_dir, "group.template"), "rt").read()
)
file.write(f"{gr.gr_name}:x:{gr.gr_gid}:\n")
file.write(f"docker:x:{dgr.gr_gid}\n")
logger.debug(f"Group file written {file.name}")
Expand Down
2 changes: 1 addition & 1 deletion daliuge-engine/dlg/apps/app_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ def execute(self, _send_notifications=True):
return
tries += 1
logger.exception(
"Error while executing %r (try %d/%d)",
"Error while executing %r (try %s/%s)",
self,
tries,
self.n_tries,
Expand Down
Loading