Skip to content

Commit

Permalink
remove duplicate code
Browse files Browse the repository at this point in the history
  • Loading branch information
calgray committed Aug 26, 2021
1 parent 6f3ac04 commit df89922
Showing 1 changed file with 1 addition and 23 deletions.
24 changes: 1 addition & 23 deletions daliuge-engine/dlg/graph_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,28 +329,6 @@ def _createApp(dropSpec, dryRun=False, session=None):
return
return appType(oid, uid, dlg_session=session, **kwargs)

def _createServiceApp(dropSpec, dryRun=False, session=None):
oid, uid = _getIds(dropSpec)
kwargs = _getKwargs(dropSpec)
del kwargs['app']

appName = dropSpec['app']
parts = appName.split('.')

# Support old "dfms..." package names (pre-Oct2017)
if parts[0] == 'dfms':
parts[0] = 'dlg'

try:
module = importlib.import_module('.'.join(parts[:-1]))
appType = getattr(module, parts[-1])
except (ImportError, AttributeError):
raise InvalidGraphException("drop %s specifies non-existent application: %s" % (oid, appName,))

if dryRun:
return
return appType(oid, uid, dlg_session=session, **kwargs)

def _getIds(dropSpec):
# uid is copied from oid if not explicitly given
oid = dropSpec['oid']
Expand All @@ -371,6 +349,6 @@ def _getKwargs(dropSpec):
DropType.PLAIN: _createPlain,
DropType.CONTAINER: _createContainer,
DropType.APP: _createApp,
DropType.SERVICE_APP: _createServiceApp,
DropType.SERVICE_APP: _createApp,
DropType.SOCKET: _createSocket
}

0 comments on commit df89922

Please sign in to comment.