1414from mokelumne .util .storage import run_dir
1515from mokelumne .util .file_transfer import (
1616 build_file_manifest ,
17+ clean_destination_path ,
1718 copy_files_from_manifest ,
1819 load_json ,
1920 save_json ,
@@ -64,20 +65,11 @@ def validate_source() -> str:
6465
6566 @task
6667 def prepare_destination () -> str :
67- """
68- Prepare the destination directory.
69- TODO: one of the requirements that we got from Lynne is that the destination
70- should be an incoming subdirectory of any directory on PA or DA,
71- e.g. /srv/pa/aerial/ucb/incoming. i don't have a good answer for how to
72- approach this, but i'm curious about how you think we should confirm that 1)
73- we're actually writing to the appropriate incoming subdirectory, and if the
74- incoming directory exists and has files in it, we should fail the job.
75- """
68+ """Prepare the destination directory."""
7669
7770 ctx = get_current_context ()
7871 destination = ctx ["params" ]["destination" ]
79-
80- destination_path = Path (destination )
72+ destination_path = clean_destination_path (Path (destination ))
8173
8274 if not destination_path .exists ():
8375 logger .info ("Creating destination directory: %s" , destination_path )
@@ -89,7 +81,7 @@ def prepare_destination() -> str:
8981 if next (os .scandir (destination_path ), None ) is not None :
9082 raise AirflowFailException (f"Destination directory contains files: { destination_path } " )
9183
92- return destination
84+ return str ( destination_path )
9385
9486 @task
9587 def build_manifest (source : str ) -> str :
0 commit comments