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

Ngas lite mods #27

Merged
merged 7 commits into from
May 6, 2021
Merged

Ngas lite mods #27

merged 7 commits into from
May 6, 2021

Conversation

awicenec
Copy link
Contributor

@awicenec awicenec commented Apr 9, 2021

Mostly fixes to NgasLiteIO, but also some other small changes.

@awicenec awicenec requested a review from rtobar April 9, 2021 07:28
@coveralls
Copy link

coveralls commented Apr 9, 2021

Coverage Status

Coverage decreased (-9.5%) to 67.902% when pulling 7dcfc90 on ngasLite_mods into ea54ebb on master.

Copy link
Contributor

@rtobar rtobar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found some inconsistencies in the handling of the MIME type, although I might be missing some context. There are also some seemingly unrelated changes around ray, but if you are happy with including them that's fine.

daliuge-engine/dlg/apps/archiving.py Show resolved Hide resolved
daliuge-engine/dlg/apps/archiving.py Outdated Show resolved Hide resolved
daliuge-engine/dlg/drop.py Outdated Show resolved Hide resolved
daliuge-engine/dlg/io.py Outdated Show resolved Hide resolved
daliuge-engine/dlg/io.py Outdated Show resolved Hide resolved
daliuge-engine/dlg/io.py Outdated Show resolved Hide resolved
Copy link
Contributor

@rtobar rtobar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking better, but there are still a few things that need cleaning before going on. In particular the unit tests are failing most probably because of the change in the working directory, which is a change seemingly unrelated to the NGAS modifications.

buf = read(desc, bufsize)
logger.debug("Read %d bytes from %r" % (len(buf), source))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These extra logger.debug calls for each read/write operation might end up flooding the logfiles. Maybe leaving the initial "Copying from ..." message could be enough?

def _read(self, count, **kwargs):
self._desc.read(count)
def _read(self, count=4096, **kwargs):
return self._desc.read(count)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmmmm, it looks like this missing return was what was causing the odd behavior we saw the other day....

Returns the location of the directory used by the DALiuGE framework to store
its logs. If `createIfMissing` is True, the directory will be created if it
currently doesn't exist
"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this directory intended for? The docstring seems like a copy from the function above. From what I see this is meant to be the default working directory (but can still be overridden in the command line).

@@ -135,6 +135,22 @@ def test_helloworldapp(self):
h.execute()
self.assertEqual(six.b(h.greeting), droputils.allDropContents(b))

def test_ngasio(self):
nd_in = NgasDROP('HelloWorld.txt', 'HelloWorld.txt')
nd_in.ngasSrv = 'ngas.ddns.net'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is fine for now, but if possible it'd be better to remove this dependency on an external service, as it can cause sporadic test failures. A better alternative would be to run the test against a local NGAS installation, but only if one exists (using @unittest.skipIf or similar).

value = int(value)
elif isinstance(obj, dlg_string_param):
value = kwargs.get(attr_name, obj.default_value)
if value is not None:
if value is not None and value is not '':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an empty string is a valid string, so maybe in this case it's fine to let it go

@@ -300,19 +300,19 @@ def getmembers(object, predicate=None):
for attr_name, obj in getmembers(self, lambda a: not(inspect.isfunction(a) or isinstance(a, property))):
if isinstance(obj, dlg_float_param):
value = kwargs.get(attr_name, obj.default_value)
if value is not None:
if value is not None and value is not '':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and value != '', otherwise it's an identity comparison. Likewise for the rest below.

@@ -89,7 +89,7 @@ def addCommonOptions(parser, defaultPort):
parser.add_option( "--cwd", action="store_true",
dest="cwd", help="Short for '-w .'", default=False)
parser.add_option("-w", "--work-dir",
help="Working directory, defaults to '/' in daemon mode, '.' in interactive mode", default=None)
help="Working directory, defaults to '/' in daemon mode, '.' in interactive mode", default=utils.getDlgWorkDir())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the default gets picked, we need to ensure it actually exists; otherwise the NM fails to start. This is probably what's causing the unit tests failures in Travis.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would thus rewrite this: I'd keep the None as the default value, and then react to this value being None to actually create the directory and change to it.

@@ -0,0 +1,594 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed to the wrong branch? This file doesn't belong here I think.

@awicenec awicenec merged commit 7dcfc90 into master May 6, 2021
@rtobar rtobar deleted the ngasLite_mods branch July 7, 2021 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants