Skip to content

Commit

Permalink
Update orthancremote
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolphpienaar committed Jun 26, 2023
1 parent e6a8fb0 commit 6625ce3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 34 deletions.
3 changes: 2 additions & 1 deletion control/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,8 @@ def computeFlow_build(self) -> dict:
'pftelDB' : self.options.pftelDB,
'orthancUrl' : self.env.orthanc('url'),
'username' : self.env.orthanc('username'),
'password' : self.env.orthanc('password')
'password' : self.env.orthanc('password'),
'pushToRemote' : self.env.orthanc('remote')
}
}
)
Expand Down
43 changes: 10 additions & 33 deletions dylld.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python

from collections.abc import Iterator
from pathlib import Path
from argparse import ArgumentParser, Namespace, ArgumentDefaultsHelpFormatter

Expand Down Expand Up @@ -42,11 +42,11 @@
logger.remove()
logger.add(sys.stderr, format=logger_format)

pluginInputDir:Path = None
pluginOutputDir:Path = None
pluginInputDir:Path
pluginOutputDir:Path
ld_forestResult:list = []

__version__ = '4.4.28'
__version__ = '4.4.34'

DISPLAY_TITLE = r"""
_ _ _ _ _
Expand Down Expand Up @@ -198,6 +198,7 @@ def Env_setup( options : Namespace,
Env.orthanc.set(url = str(options.orthancURL))
Env.orthanc.set(username = str(options.orthancuser))
Env.orthanc.set(password = str(options.orthancpassword))
Env.orthanc.set(remote = str(options.orthancremote))
Env.set(inputdir = inputdir)
Env.set(outputdir = outputdir)
Env.debug_setup( debug = options.debug,
Expand Down Expand Up @@ -360,30 +361,6 @@ def treeGrowth_savelog(outputdir : Path) -> None:
f.write(json.dumps(ld_forestResult, indent=4))
f.close()

def epilogue(options:Namespace, dt_start:datetime = None) -> None:
"""
Some epilogue cleanup -- basically determine a delta time
between passed epoch and current, and if indicated in CLI
pflog this.
Args:
options (Namespace): option space
dt_start (datetime): optional start date
"""
tagger:pftag.Pftag = pftag.Pftag({})
dt_end:datetime = pftag.timestamp_dt(tagger(r'%timestamp')['result'])
ft:float = 0.0
if dt_start:
ft = (dt_end - dt_start).total_seconds()
if options.pftelDB:
options.pftelDB = '/'.join(options.pftelDB.split('/')[:-1] + ['dylld'])
d_log:dict = pflog.pfprint(
options.pftelDB,
f"Shutting down after {ft} seconds.",
appName = 'pl-dylld',
execTime = ft
)

# documentation: https://fnndsc.github.io/chris_plugin/chris_plugin.html#chris_plugin
@chris_plugin(
parser = parser,
Expand Down Expand Up @@ -411,28 +388,28 @@ def main(options: Namespace, inputdir: Path, outputdir: Path):

options.pftelDB = preamble(options)

output: None = None
output:Path
if not options.inNode:
mapper = PathMapper.file_mapper(
mapper:PathMapper = PathMapper.file_mapper(
inputdir,
outputdir,
glob = options.pattern
)
else:
mapper = PathMapper.dir_mapper_deep(
mapper:PathMapper = PathMapper.dir_mapper_deep(
inputdir,
outputdir
)
if int(options.thread):
with ThreadPoolExecutor(max_workers=len(os.sched_getaffinity(0))) as pool:
results = pool.map(lambda t: tree_grow(options, *t), mapper)
results:Iterator = pool.map(lambda t: tree_grow(options, *t), mapper)

# raise any Exceptions which happened in threads
for _ in results:
pass
else:
for input, output in mapper:
results: dict = tree_grow(options, input, output)
d_results:dict = tree_grow(options, input, output)

LOG("Ending growth cycle...")
treeGrowth_savelog(outputdir)
Expand Down

0 comments on commit 6625ce3

Please sign in to comment.