Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions compute_worker/compute_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,14 @@ def _get_host_path(self, *paths):

return path

async def _run_program_directory(self, program_dir, kind, can_be_output=False):
async def _run_program_directory(self, program_dir, kind):
"""
Function responsible for running program directory

Args:
- program_dir : can be either ingestion program or program/submission
- kind : either `program` or `ingestion`
"""
# If the directory doesn't even exist, move on
if not os.path.exists(program_dir):
logger.info(f"{program_dir} not found, no program to execute")
Expand All @@ -597,13 +604,11 @@ async def _run_program_directory(self, program_dir, kind, can_be_output=False):
elif os.path.exists(os.path.join(program_dir, "metadata")):
metadata_path = 'metadata'
else:
if can_be_output:
# Display a warning in logs when there is no metadata file in submission/program dir
if kind == "program":
logger.info(
"Program directory missing metadata, assuming it's going to be handled by ingestion "
"program so move it to output"
"Program directory missing metadata, assuming it's going to be handled by ingestion"
)
# Copying so that we don't move a code submission w/out a metadata command
shutil.copytree(program_dir, self.output_dir)
return
else:
raise SubmissionException("Program directory missing 'metadata.yaml/metadata'")
Expand Down Expand Up @@ -815,7 +820,7 @@ def start(self):
logger.info("Running scoring program, and then ingestion program")
loop = asyncio.new_event_loop()
gathered_tasks = asyncio.gather(
self._run_program_directory(program_dir, kind='program', can_be_output=True),
self._run_program_directory(program_dir, kind='program'),
self._run_program_directory(ingestion_program_dir, kind='ingestion'),
self.watch_detailed_results(),
loop=loop,
Expand Down