Class Job

java.lang.Object
mindsdb.models.Job
All Implemented Interfaces:
AutoCloseable

public class Job extends Object implements AutoCloseable
The Job class represents a job with various attributes such as project, name, query string, data, queries, start and end timestamps, next run timestamp, schedule string, and create callback. It provides constructors for creating a job instance and methods for updating the job, refreshing the job, adding a query to the job, getting the job history, and exiting the job.

Attributes:

  • project: The project associated with the job.
  • name: The name of the job.
  • queryString: The query string associated with the job.
  • data: Additional data for the job in JSON format.
  • queries: A list of queries associated with the job.
  • startAt: The timestamp when the job starts.
  • endAt: The timestamp when the job ends.
  • nextRunAt: The timestamp when the job runs next.
  • scheduleStr: The schedule string for the job.
  • createCallback: The callback function for creating the job.

Methods:

  • Job(Project project, String name, Map<String, String> data, CreateJobCallback createCallback): Constructs a new Job instance with the specified attributes.
  • Job(Project project, String name, CreateJobCallback createCallback): Constructs a new Job instance with the specified attributes, without data.
  • Job(Project project, String name): Constructs a new Job instance with the specified attributes, without data and create callback.
  • String toString(): Returns a string representation of the job.
  • void exit(): Exits the job.
  • void close(): Closes the job.
  • void refresh(): Refreshes the job.
  • void addQuery(Query query): Adds a query to the job.
  • void addQuery(String query): Adds a query to the job.
  • Table getHistory(): Gets the job history.
  • Constructor Details

    • Job

      public Job(Project project, String name, Map<String,String> data, CreateJobCallback createCallback)
      Constructs a new Job instance with the specified attributes.
      Parameters:
      project - - the project associated with the job
      name - - the name of the job
      data - - additional data for the job in JSON format
      createCallback - - the callback function for creating the job
    • Job

      public Job(Project project, String name, CreateJobCallback createCallback)
      Constructs a new Job instance with the specified attributes, without data.
      Parameters:
      project - - the project associated with the job
      name - - the name of the job
      createCallback - - the callback function for creating the job
    • Job

      public Job(Project project, String name)
      Constructs a new Job instance with the specified attributes, without data and create callback.
      Parameters:
      project - - the project associated with the job
      name - - the name of the job
  • Method Details

    • addQuery

      public void addQuery(Query query)
      Adds a query to the job.
      Parameters:
      query - The query to be added.
    • addQuery

      public void addQuery(String sql)
      Adds a query to the job.
      Parameters:
      sql - The SQL query string to be added.
    • getHistory

      public tech.tablesaw.api.Table getHistory()
      Gets the history of the job.
      Returns:
      The history of the job as a Table.
    • refresh

      public void refresh()
      Refreshes the job by updating its data from the project.
    • exit

      public void exit()
      Exits the job by executing the create callback with the queries.
    • close

      public void close()
      Closes the job by executing the create callback with the queries.
      Specified by:
      close in interface AutoCloseable
    • toString

      public String toString()
      Overrides:
      toString in class Object