def spawn_output_asset(self): """ Creates a new asset record for the job's output file. Assumes that the output filename will be the second parameter in the output list """ assert self.assets.count() == 1 asset_o = self.assets.all()[0] asset_n = Asset() asset_n.__dict = asset_o.__dict__ asset_n.id = None asset_n.is_original = False asset_n.creator_job = self args = json.loads(self.arguments) asset_n.relative_file_path = args[self.outfile_argument_index].replace(DATA_ROOT,'') assert os.path.exists(asset_n.file_path) asset_n.class_label = self.jobset.output_asset_label or self.jobset.name asset_n.save() asset_n.parents.add(asset_o)
def spawn_output_asset(self): """ Creates a new asset record for the job's output file. Assumes that the output filename will be the second parameter in the output list """ assert self.assets.count() == 1 asset_o = self.assets.all()[0] asset_n = Asset() asset_n.__dict = asset_o.__dict__ asset_n.id = None asset_n.is_original = False asset_n.creator_job = self args = json.loads(self.arguments) asset_n.relative_file_path = args[self.outfile_argument_index].replace( DATA_ROOT, '') assert os.path.exists(asset_n.file_path) asset_n.class_label = self.jobset.output_asset_label or self.jobset.name asset_n.save() asset_n.parents.add(asset_o)