Skip to content
Snippets Groups Projects

Delivery rework

Merged Daniel Lyons requested to merge delivery-rework into main
7 unresolved threads
5 files
+ 318
148
Compare changes
  • Side-by-side
  • Inline
Files
5
  • e11f3e7c
    Considerable rework here: · e11f3e7c
    Daniel Lyons authored
     - New DestinationTempFile for writing tempfiles into the destination which eventually get added
     - All of the close() methods are now streaming
     - Implemented ChecksumDecorator
     - Implemented FetchFile decorator
@@ -58,7 +58,6 @@ class DeliveryContext(DeliveryContextIF):
"""
raise NotImplementedError
@property
def token(self) -> str:
"""
If a delivery only requires one token, just use this property
@@ -88,15 +87,24 @@ class DeliveryContext(DeliveryContextIF):
def create_destination(self) -> Destination:
builder = DestinationBuilder(self)
# so the layer-cake has to be built in kind of reverse order because it's a stack
# at the bottom we want the physical destination, which is either local or web delivery
# first handle the local destination argument
if self.local_destination:
builder.local(self.local_destination)
else:
# FIXME: this is gross
settings = CapoConfig().settings("edu.nrao.archive.workflow.config.DeliverySettings")
builder.local(pathlib.Path(settings.nraoDownloadDirectory) / "anonymous" / self.token)
builder.web()
# always do a checksum at the end
builder.checksums()
# make a CURL file before that, but only if we're doing a web delivery
if not self.local_destination:
builder.curlfile()
# then handle the tar argument
# tar goes here, so that we generate a checksum for the tar file
# and not for all the files in the tar file
if self.tar:
builder.tar()
@@ -160,7 +168,7 @@ class DeliveryContext(DeliveryContextIF):
return DeliveryContext(
source=ns.source,
tar=ns.tar,
local_destination=ns.local_destination,
local_destination=pathlib.Path(ns.local_destination) if ns.local_destination else None,
use_piperesults=ns.use_piperesults,
rawdata=ns.rawdata,
)
Loading