jerryshao commented on code in PR #7531: URL: https://github.com/apache/gravitino/pull/7531#discussion_r2179797044
########## api/src/main/java/org/apache/gravitino/job/SupportsJobs.java: ########## @@ -0,0 +1,94 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.gravitino.job; + +import java.util.List; +import java.util.Map; +import org.apache.gravitino.exceptions.JobTemplateAlreadyExistsException; +import org.apache.gravitino.exceptions.NoSuchJobException; +import org.apache.gravitino.exceptions.NoSuchJobTemplateException; + +/** + * Interface for job management operations. This interface will be mixed with GravitinoClient to + * provide the ability to manage jobs within the Gravitino system. + */ +public interface SupportsJobs { + + /** + * Lists all the registered job templates in Gravitino. + * + * @return a list of job templates + */ + List<JobTemplate> listJobTemplates(); + + /** + * Register a job template with the specified job template to Gravitino. The registered job will + * be maintained in Gravitino, allowing it to be executed later. + * + * @param jobTemplate the template for the job + * @throws JobTemplateAlreadyExistsException if a job template with the same name already exists + */ + void registerJobTemplate(JobTemplate jobTemplate) throws JobTemplateAlreadyExistsException; + + /** + * Retrieves a job template by its name. + * + * @param jobName the name of the job template to retrieve + * @return the job template associated with the specified name + * @throws NoSuchJobTemplateException if no job template with the specified name exists + */ + JobTemplate getJobTemplate(String jobName) throws NoSuchJobTemplateException; + + /** + * Deletes a job template by its name. This will remove the job template from Gravitino, and it + * will no longer be available for execution. + * + * @param jobName the name of the job template to delete + * @throws NoSuchJobTemplateException if no job template with the specified name exists + */ + void deleteJobTemplate(String jobName) throws NoSuchJobTemplateException; + + /** + * run a job with the specified name and configuration. The jobConf is a map of key-value contains + * the variables that will be used to replace the templated parameters in the job template. + * + * @param jobName the name of the job + * @param jobConf the configuration for the job + * @return a handle to the run job + * @throws NoSuchJobTemplateException if no job template with the specified name exists + */ + JobHandle runJob(String jobName, Map<String, String> jobConf) throws NoSuchJobTemplateException; + + /** + * Retrieves a job by its ID. + * + * @param jobId the ID of the job to retrieve + * @return a handle to the job + * @throws NoSuchJobException if the job with the specified ID does not exist + */ + JobHandle getJob(String jobId) throws NoSuchJobException; + + /** + * Cancels a job by its ID. + * + * @param jobId the ID of the job to cancel + * @throws NoSuchJobException if the job with the specified ID does not exist + */ + void cancelJob(String jobId) throws NoSuchJobException; Review Comment: I don't have a strong feeling on this, I need to think about it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
