def run(self): client = GCSClient() if self.string: client.put_string(contents=self.string, dest_path=self.gs_path, mimetype=self.mime_type) elif self.file_path: client.put(filename=self.file_path, dest_path=self.gs_path, mimetype=self.mime_type) if self.remove_file: os.remove(self.file_path)
def _success_hook(self): success_file = self.get_job_dir().rstrip("/") + "/_SUCCESS" if is_gcs_path(self.get_job_dir()): from luigi.contrib.gcs import GCSClient client = GCSClient() client.put_string("", success_file) else: # assume local filesystem otherwise open(success_file, "a").close()