Пример #1
0
 def do_publish(
     self,
     model_manager: ModelManager,
     training_output: RLTrainingOutput,
     setup_data: Optional[Dict[str, bytes]],
     recurring_workflow_ids: ModuleNameToEntityId,
     child_workflow_id: int,
     recurring_period: Optional[RecurringPeriod],
 ) -> NoPublishingResults:
     for module_name, path in training_output.output_paths.items():
         assert os.path.exists(
             path), f"Given path {path} doesn't exist."
         Model = Query()
         # find if there's already been something stored
         key = f"{module_name}_{str(model_manager)}"
         # pyre-fixme[16]: `FileSystemPublisher` has no attribute `db`.
         results = self.db.search(Model[KEY_FIELD] == key)
         if len(results) == 0:
             # this is a first
             self.db.insert({KEY_FIELD: key, VALUE_FIELD: path})
         else:
             # replace it
             if len(results) > 1:
                 raise RuntimeError(
                     f"Got {len(results)} results for model_manager. {results}"
                 )
             self.db.update({VALUE_FIELD: path},
                            Model[KEY_FIELD] == key)
     return NoPublishingResults(success=True)
Пример #2
0
 def do_publish(
     self,
     model_manager: ModelManager,
     training_output: RLTrainingOutput,
     recurring_workflow_ids: ModuleNameToEntityId,
     child_workflow_id: int,
     recurring_period: Optional[RecurringPeriod],
 ) -> NoPublishingResults:
     return NoPublishingResults(success=True)