Operation method and device based on operation plug-in, equipment, storage medium and program product
Through dynamic update and grayscale operation mechanisms, the task interruption and version error problems during job plug-in updates are solved, ensuring the continuity and accuracy of job tasks.
Patent Information
- Application Number
- CN202411161270.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-22
- Publication Date
- 2024-12-27
AI Technical Summary
Existing job plug-ins need to restart the job execution service component when updated, resulting in task continuity interruption and may use the wrong plug-in version, affecting the accuracy and reliability of the job.
By receiving update information from the job plug-in, determine the target update plug-in, clear the initial class information in local memory, obtain and load the class information in the target plug-in directory, query the plug-in type and grayscale identity of the job instance, and dynamically select the grayscale plug-in to execute Job instance, ensure that plugin updates do not affect task continuity and use the correct version.
It realizes dynamic updates and grayscale operation of the job plug-in, ensures the continuity and accuracy of job tasks, and avoids interrupts and wrong versions caused by restarts.
Smart Images

Figure CN119201160A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data technology, and in particular to a job method, device, equipment, storage medium and program product based on a job plug-in. Background Art
[0002] At present, in the field of big data job scheduling, different types of job running support are generally provided in the form of plug-ins to facilitate functional expansion. In order to support upper-level business needs, job plug-ins need to be frequently changed, and job execution service components also need to have the ability to run in grayscale (that is, to allow different versions of the same plug-in to run jobs).
[0003] When an existing job plug-in is updated, the job execution service component needs to be restarted synchronously in order for the job plug-in to take effect, which affects the continuity of the job task; in addition, it is also easy to use the wrong plug-in version to perform the job; therefore, the existing job plug-in operation method cannot efficiently execute the job task through the job plug-in. Summary of the invention
[0004] The present application provides a job method, device, equipment, storage medium and program product based on a job plug-in, which is used to solve the problem in the prior art that job tasks cannot be efficiently executed through job plug-ins.
[0005] In a first aspect, the present application provides a job method based on a job plug-in, comprising:
[0006] In response to receiving update information of the job plug-in, determining a target updated job plug-in based on the update information of the job plug-in;
[0007] Clearing the initial class information of the target update job plug-in in the local memory based on the target update job plug-in;
[0008] In response to the initial class information of the target update job plug-in being cleared, obtaining the target class information of the target update job plug-in in the target plug-in directory, and loading the target class information into the local memory;
[0009] In response to determining that the target class information is loaded and the target update job plug-in is updated successfully, obtaining a job instance sent by the job dispatching server;
[0010] Based on the job instance, query the target database for the plug-in type corresponding to the job instance and whether there is a plug-in grayscale identifier;
[0011] In response to determining that the job instance has the plug-in grayscale identifier, determining a target grayscale plug-in based on the plug-in type and the plug-in grayscale identifier;
[0012] The job instance is executed based on the target grayscale plug-in.
[0013] In a possible design, the update information of the job plug-in includes plug-in type information and plug-in grayscale information;
[0014] The step of determining a target updated job plug-in based on the update information of the job plug-in includes:
[0015] Determine the plug-in type of the target update job plug-in based on the plug-in type information;
[0016] Based on the plug-in grayscale information, it is determined whether the target update job plug-in is a grayscale plug-in.
[0017] In a possible design, the target plug-in directory includes a grayscale version plug-in directory and a non-grayscale version plug-in directory;
[0018] The step of obtaining the target class information of the target update job plug-in in the target plug-in directory includes:
[0019] In response to determining that the target update job plug-in is a grayscale plug-in, acquiring target class information of the target update job plug-in from the grayscale version plug-in directory;
[0020] In response to determining that the target update job plug-in is a non-grayscale plug-in, the target class information of the target update job plug-in is obtained from the non-grayscale version plug-in directory.
[0021] In a possible design, the target database includes a job instance ID, a plug-in type, and a plug-in grayscale identifier;
[0022] The querying the target database based on the job instance to determine the plug-in type corresponding to the job instance and whether the plug-in grayscale identifier is present includes:
[0023] Based on the job instance ID of the job instance, the plug-in type corresponding to the job instance ID and whether there is a corresponding plug-in grayscale identifier are queried in the target database.
[0024] In a possible design, executing the job instance based on the target grayscale plug-in includes:
[0025] Determine whether the class information of the target grayscale plug-in is cached in the local memory;
[0026] In response to the class information of the target grayscale plug-in not being cached in the local memory, the class information of the target grayscale plug-in is loaded from the target plug-in directory.
[0027] In one possible design, it also includes:
[0028] In response to determining that the target update job plug-in fails to update, clearing the target class information loaded into the local memory;
[0029] Re-acquire the target class information of the target update job plug-in in the target plug-in directory, and load the target class information into the local memory.
[0030] In one possible design, it also includes:
[0031] In response to determining that the job instance does not have the plug-in grayscale identifier, determining a target non-grayscale plug-in based on the plug-in type;
[0032] The job instance is executed based on the target non-grayscale plug-in.
[0033] In a second aspect, the present application provides a job device based on a job plug-in, comprising:
[0034] An update plug-in determination module, configured to determine a target update job plug-in based on the update information of the job plug-in in response to receiving the update information of the job plug-in;
[0035] A clearing module, used for clearing the initial class information of the target update job plug-in in the local memory based on the target update job plug-in;
[0036] A class information acquisition module, configured to acquire target class information of the target update job plug-in in a target plug-in directory in response to the initial class information of the target update job plug-in being cleared, and load the target class information into a local memory;
[0037] A job instance acquisition module, configured to acquire a job instance sent by a job dispatching server in response to determining that the target class information has been loaded and the target update job plug-in has been updated successfully;
[0038] A query module, used for querying the plug-in type corresponding to the job instance and whether there is a plug-in grayscale identifier in the target database based on the job instance;
[0039] A job plug-in determination module, configured to determine a target grayscale plug-in based on the plug-in type and the plug-in grayscale identifier in response to determining that the job instance has the plug-in grayscale identifier;
[0040] An execution module is used to execute the job instance based on the target grayscale plug-in.
[0041] In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor;
[0042] The memory stores computer-executable instructions;
[0043] The processor executes the computer-executable instructions stored in the memory to implement the method as described in any one of the first aspects.
[0044] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method as described in any one of the first aspects.
[0045] In a fifth aspect, the present application provides a computer program product, including a computer program, which implements the method described in any one of the first aspects when executed by a processor.
[0046] The job method, apparatus, device, storage medium and program product based on job plug-in provided in the present application determine the target update job plug-in based on the update information of the job plug-in in response to receiving the update information of the job plug-in; clear the initial class information of the target update job plug-in in the local memory based on the target update job plug-in; in response to the initial class information of the target update job plug-in being cleared, obtain the target class information of the target update job plug-in in the target plug-in directory, and load the target class information into the local memory; in response to determining that the target class information has been loaded and the target update job plug-in has been successfully updated, obtain the job instance sent by the job dispatching server; based on the job instance, query the target database for the plug-in type corresponding to the job instance and whether it has a plug-in grayscale identifier; in response to determining that the job instance has a plug-in grayscale identifier, determine the target grayscale plug-in based on the plug-in type and the plug-in grayscale identifier; and execute the job instance based on the target grayscale plug-in. By determining the target update job plug-in through the update information of the job plug-in, clearing the class information of the target update job plug-in in the local memory, and obtaining the target class information from the target plug-in directory and loading it into the local memory, the job plug-in can be dynamically updated to ensure the continuity of the job task. By querying the plug-in type of the job instance and whether it has a plug-in grayscale identification in the target database, the target grayscale plug-in can be determined and the job instance can be executed through the target grayscale plug-in. This can ensure that the correct job plug-in version is used to execute the job task, thereby ensuring the accuracy of the job task execution. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0048] Figure 1 An application scenario diagram corresponding to a job method based on a job plug-in provided in an embodiment of the present application;
[0049] Figure 2A flowchart of a job method based on a job plug-in provided in an embodiment of the present application;
[0050] Figure 3 A flowchart of a job method based on a job plug-in provided in yet another embodiment of the present application;
[0051] Figure 4 A flowchart of a job method based on a job plug-in provided in yet another embodiment of the present application;
[0052] Figure 5 A flowchart of a job method based on a job plug-in provided in yet another embodiment of the present application;
[0053] Figure 6 A schematic diagram of the structure of a job device based on a job plug-in provided in one embodiment of the present application;
[0054] Figure 7 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application.
[0055] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0056] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0057] In the technical solution of this application, the collection, storage, use, processing, transmission, provision and disclosure of information such as financial data or user data involved shall comply with the provisions of relevant laws and regulations and shall not violate public order and good morals.
[0058] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0059] Terminology explanation:
[0060] Job: It is the basic configuration unit of the scheduling system, that is, the logical unit defined by the user to complete a certain task, which includes the executed program and its parameters. In task scheduling, the job (or task) is the smallest execution unit.
[0061] Job plugin: A software component that can be added to the main program to extend its functionality. It can be written in any programming language, including scripting languages such as shell, perl, python, or more complex programs such as instances of data processing frameworks such as SparkSQL and Flink.
[0062] A grayscale plugin is a tool used in the software development and deployment process. It allows developers or operators to test a new version of an application or service on a subset of users or traffic before launching it to evaluate the stability and performance of the new version. This gradual deployment method is called grayscale release or canary release, which aims to reduce the risks of launching a new version directly in full.
[0063] In order to clearly understand the technical solution of the present application, the solution of the prior art is first introduced in detail.
[0064] In the field of big data job scheduling, job plug-ins usually provide different types of job running support in the form of plug-ins (such as Shell, Perl, Python, SparkSQL, Flink, etc.). This plug-in design is not only convenient for functional expansion, but also can flexibly respond to diverse business needs. However, with the continuous changes in upper-level business needs, job plug-ins need to be frequently updated and changed, which puts higher requirements on job execution service components. In the prior art, the update of job plug-ins usually requires the job execution service component to be restarted synchronously to make the new plug-in version effective. This method of job plug-in update has obvious defects: first, restarting the job execution service component will interrupt the currently running job tasks and affect the continuity of the business; second, frequent restart operations increase the instability and maintenance cost of the system. In addition, when multiple versions coexist, it is easy to use the wrong plug-in version for the job, which further affects the accuracy and reliability of the job. Therefore, the existing job plug-in-based job method cannot efficiently execute job tasks through job plug-ins.
[0065] Therefore, in the face of technical problems in the prior art, in order to enable the job plug-in to efficiently and accurately execute the job task during the job. First, the job execution service component needs to have the ability to hot update the plug-in, that is, to dynamically load and update the plug-in without restarting the service component, so as to ensure the continuity of the job task; at the same time, it must also have the ability to grayscale run the plug-in, and can accurately use different versions of the plug-in for the job, ensuring that the new version of the plug-in is fully effective when the logic is accurate, thereby ensuring the reliability of the job plug-in.
[0066] Figure 1 An application scenario diagram corresponding to the job method based on the job plug-in provided in an embodiment of the present application, such as Figure 1 As shown, the job method based on the job plug-in provided in this embodiment corresponds to the job system based on the role plug-in, which includes: a message sending device 11, a job execution device 12, a plug-in directory library 13, a job dispatching device 14 and a database 15. Specifically, whenever a job plug-in needs to be updated, the update information of the job plug-in is sent to the job execution device 12 through the message sending device 11. The job execution device 12 determines the target update plug-in based on the update information of the job plug-in. When the target update plug-in is determined, the initial class information of the target update plug-in in the local memory is cleared. After that, the job execution device 12 sends a download request to the plug-in directory library 13 that stores the target class information of the target update plug-in. The plug-in directory library 13 sends the target class information to the job execution device 12. The job execution device 12 loads the target class information into the target update plug-in directory in the local memory. When the target update plug-in is updated, the job execution device 12 sends a request to obtain the job instance to the job dispatching device 14. Based on the job instance sent by the job dispatching device 14, the job execution device 12 sends a query request to the database 15. The database 15 sends the plug-in type and grayscale identification information corresponding to the job instance to the job execution device 12. After determining that the job instance has a plug-in grayscale identification, the job execution device 12 determines the target grayscale plug-in based on the plug-in type and the plug-in grayscale identification, and finally executes the job instance based on the target grayscale plug-in.
[0067] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0068] Figure 2 A flowchart of a job method based on a job plug-in provided in an embodiment of the present application, such as Figure 2As shown, the execution subject of this embodiment is a job plug-in-based operation device, which can be implemented by a computer program or a medium storing relevant computer programs, such as a USB flash drive and / or a CD, etc.; or, it can also be implemented by a physical device integrated or installed with relevant computer programs, such as a chip, an electronic device, etc. The electronic device can be a computer or a server, etc. The operation method based on the job plug-in provided in this embodiment includes the following steps:
[0069] Step S201 : in response to receiving update information of a job plug-in, determining a target updated job plug-in based on the update information of the job plug-in.
[0070] Specifically, after the update information of the job plug-in is received, the update information of the job plug-in is parsed, so that the target update job plug-in to be updated can be determined according to the update information.
[0071] The target updated job plug-in is a job plug-in that needs to be updated.
[0072] Optionally, the update information of the job plug-in includes but is not limited to the name, version number, plug-in type, and grayscale information of the plug-in, etc. The target update job plug-in to be updated can be determined based on the above information.
[0073] Optionally, before determining the target update job plug-in based on the update information of the job plug-in, the validity of the update information of the job plug-in is first checked, and it is determined based on the update information whether the plug-in to be updated exists in the operating system and whether the version number is higher than the current version, etc., so as to ensure that the target update job plug-in can be updated correctly.
[0074] Optionally, job plugin updates can be automatically triggered through the Jenkins pipeline, for example, when a new version of a job plugin is uploaded to the code repository, or when a staff member learns of a job plugin update and manually triggers it through the Jenkins interface.
[0075] Optionally, after the job plugin update is triggered, the new version of the job plugin is downloaded through Jenkins or other automation tools, and the job plugin is placed in a specified job plugin directory. The job plugin directory may contain the binary file of the plugin and a version information file for recording metadata such as the version number, type, and release date of the plugin.
[0076] Optionally, after the job plugin directory is updated, the version update script is called through Jenkins, and the version update script reads the version information file in the job plugin directory, extracts the plugin type (such as shell, python, perl) and grayscale identifier, and encapsulates this information into a message and sends it to the specified topic of RocketMQ, where the topic is pre-defined and used to transmit job plugin update messages. Each job device based on the job plugin will subscribe to this topic, and each job device based on the job plugin will have an independent consumer group, ensuring that all job devices based on the job plugin will receive the job plugin update information, ensuring the distribution efficiency and reliability of the update message.
[0077] Step S202: clearing the initial class information of the target update job plug-in in the local memory based on the target update job plug-in.
[0078] Specifically, after the target update job plug-in is determined, the initial class information of the target update job plug-in in the local memory is cleared to facilitate subsequent loading of updated class information.
[0079] The initial class information is the class information of the target update job plug-in before updating. The class information mainly refers to the information set of various attributes and features related to the plug-in, including but not limited to class name, class attributes, class methods and metadata, etc.
[0080] Optionally, the initial class information of the target update job plug-in in the local memory is cleared by a class information clearing tool. In this embodiment, the above class information clearing tool is not limited as long as the purpose of clearing the initial class information can be achieved.
[0081] Optionally, before clearing the initial class information of the target update job plug-in, the initial class information is backed up first, thereby ensuring that the initial class information can be restored when needed to prevent data loss or system instability caused by unexpected situations during the update or clearing process.
[0082] Step S203, in response to the initial class information of the target update job plug-in being cleared, the target class information of the target update job plug-in in the target plug-in directory is obtained, and the target class information is loaded into the local memory.
[0083] Specifically, after the initial class information is cleared, the target class information is obtained from the target plug-in directory and loaded into the local memory, thereby completing the update of the class information of the target update job plug-in.
[0084] The target plug-in directory refers to a predetermined file system path, under which the target class information of the target update job plug-in is stored; the target class information is updated class information that matches the target update job plug-in.
[0085] Optionally, the target class information is loaded into the local memory through a preset class loader, wherein the preset class loader is preset and customized by the user, and by creating a customized class loader specifically responsible for loading the target class information in the target plug-in directory into the local memory, conflicts with class information of other programs can be avoided.
[0086] Optionally, in this embodiment, the target plug-in directory may be set as a single directory, or may include a grayscale plug-in directory and a non-grayscale plug-in directory. The form of the target plug-in directory is not limited herein.
[0087] Step S204, in response to determining that the target class information is loaded and the target update job plug-in is updated successfully, obtaining the job instance sent by the job dispatching server.
[0088] Specifically, when the target class information is loaded and the target update job plug-in is updated successfully, at this time, the target update job plug-in has been updated and can execute the job task, so the job instance sent by the job dispatching server is obtained.
[0089] Optionally, when the target update job plug-in is updated successfully, the update result and version information of the target update job plug-in are uploaded to the database, so that the front end can regularly poll the database to receive the latest job plug-in information and display the version number and other information of the job plug-in to the user.
[0090] Optionally, there are multiple ways to determine whether the target update job plug-in is updated successfully, including version checking, loading status confirmation, and function verification.
[0091] Optionally, the job instance is obtained by sending a job request to the job dispatching server. Further, after the job instance is obtained, the validity of the job instance is checked, including whether the format and data of the job instance meet the requirements.
[0092] Optionally, the job instance includes but is not limited to a job ID, a job type, a job description, execution parameters, dependencies, execution results, and log information.
[0093] Optionally, when sending a job instance, the job dispatching server may communicate with the job plug-in-based job device of this embodiment through an API (Application Programming Interface) interface or a message queue. After the job is completed, the job plug-in-based job device will return the execution results and status information to the job dispatching server or store it in a designated location for subsequent query and processing.
[0094] Step S205 , based on the job instance, query the target database for the plug-in type corresponding to the job instance and whether it has a plug-in grayscale identifier.
[0095] Specifically, after obtaining the job instance, a query is performed in the target database according to the job instance to obtain the plug-in type applied to execute the job instance and whether there is a plug-in grayscale identifier to determine the job plug-in that executes the job instance.
[0096] The target database is a database storing a large amount of job instance information, including whether the job plug-in required by the job instance has a plug-in grayscale mark.
[0097] Optionally, the target database can be obtained in the following manner: specifically, the front-end pages are distinguished into grayscale publishing pages and non-grayscale publishing pages, and the actions and tasks performed by the job plug-ins of the grayscale pages are added with grayscale identifiers through the scheduling interface server, while the operations of the job plug-ins of the non-grayscale pages are not added by the scheduling interface server, thereby being able to obtain job instances with grayscale identifiers and job instances without grayscale identifiers, and integrating a large number of job instances into the target database.
[0098] Optionally, a query may be performed in the target database based on a job keyword, semantic query, or ID of the job instance.
[0099] Optionally, the query operation may be performed by a specific SQL statement, an API call, or file system path navigation, and the specific query method depends on the type of the target database.
[0100] Optionally, the plug-in grayscale identifier may be a specific keyword, such as gray, or a Boolean value, such as true or false. The specific form of the plug-in grayscale identifier is not limited in this embodiment.
[0101] Step S206 , in response to determining that the job instance has a plug-in grayscale identifier, determining a target grayscale plug-in based on the plug-in type and the plug-in grayscale identifier.
[0102] Specifically, when it is determined that the job instance has a plug-in grayscale identifier, a target grayscale plug-in for executing the job instance task can be determined through the queried plug-in type and the plug-in grayscale identifier.
[0103] The target grayscale plug-in is a grayscale version of a job plug-in that executes the job instance.
[0104] Optionally, the version numbers of the grayscale plug-in and the non-grayscale plug-in are distinguished, so as to facilitate the determination and distinction of the grayscale version plug-in and the non-grayscale version plug-in.
[0105] Step S207: executing the job instance based on the target grayscale plug-in.
[0106] Specifically, after the target grayscale plug-in is determined, the job instance task is executed through the target grayscale plug-in.
[0107] Optionally, when the target grayscale plug-in executes the job instance, performance indicators of the target grayscale plug-in, such as response time, resource utilization, etc., are monitored.
[0108] Optionally, log information of the target grayscale plug-in executing the job instance is recorded, including debug logs, error logs, and normal execution logs, etc., to facilitate subsequent troubleshooting.
[0109] Optionally, if the target grayscale plug-in performs well in executing the job instance, the target grayscale plug-in can be updated to a non-grayscale official version plug-in. If the target grayscale plug-in has an error or anomaly in executing the job instance, the target grayscale plug-in is repaired based on the error and anomaly and updated through the above update method.
[0110] The job method based on job plug-in provided in the present embodiment determines the target update job plug-in based on the update information of the job plug-in in response to receiving the update information of the job plug-in; clears the initial class information of the target update job plug-in in the local memory based on the target update job plug-in; in response to the initial class information of the target update job plug-in being cleared, obtains the target class information of the target update job plug-in in the target plug-in directory, and loads the target class information into the local memory; in response to determining that the target class information has been loaded and the target update job plug-in has been successfully updated, obtains the job instance sent by the job dispatching server; based on the job instance, queries the plug-in type corresponding to the job instance and whether it has a plug-in grayscale identifier in the target database; in response to determining that the job instance has a plug-in grayscale identifier, determines the target grayscale plug-in based on the plug-in type and the plug-in grayscale identifier; and executes the job instance based on the target grayscale plug-in. The method of this embodiment determines the target update job plug-in through the update information of the job plug-in, clears the class information of the target update job plug-in in the local memory, and obtains the target class information from the target plug-in directory and loads it into the local memory. This can realize the dynamic update of the job plug-in and ensure the continuity of the job task. By querying the plug-in type of the job instance and whether it has a plug-in grayscale identification in the target database, the target grayscale plug-in is determined and the job instance is executed through the target grayscale plug-in. This can ensure that the correct job plug-in version is used to execute the job task, thereby ensuring the certainty of the job task execution.
[0111] As an optional implementation, based on any of the above embodiments, the update information of the job plug-in includes plug-in type information and plug-in grayscale information; determining a target updated job plug-in based on the update information of the job plug-in includes:
[0112] Determine the plug-in type of the target update job plug-in based on the plug-in type information;
[0113] Determine whether the target update job plug-in is a grayscale plug-in based on the plug-in grayscale information.
[0114] Specifically, when determining the target update job plug-in based on the update information of the job plug-in, the plug-in type of the target update job plug-in is determined by the plug-in type information, and whether the target update job plug-in is a grayscale plug-in is determined by the plug-in grayscale information.
[0115] Optionally, the plug-in type information may be a name or an identifier of the job plug-in, and the name or the identifier of the job plug-in may be used to query whether there is a record of the job plug-in in the local memory, thereby ensuring that there is a job plug-in to be updated.
[0116] Optionally, the plug-in grayscale information may be a grayscale keyword, such as gray; or may be a Boolean value, such as true or false. When the gray keyword exists in the update information or the plug-in grayscale is true, it indicates that the target update job plug-in is a grayscale version plug-in.
[0117] In the job method based on job plug-ins provided in this embodiment, the update information of the job plug-in includes plug-in type information and plug-in grayscale information; determining the target update job plug-in based on the update information of the job plug-in includes: determining the plug-in type of the target update job plug-in based on the plug-in type information; determining whether the target update job plug-in is a grayscale plug-in based on the plug-in grayscale information. The method of this embodiment can accurately determine the target update job plug-in through the plug-in type information and the plug-in grayscale information, ensuring that the target update job plug-in is effectively updated later.
[0118] As an optional implementation, based on any of the above embodiments, the target plug-in directory includes a grayscale version plug-in directory and a non-grayscale version plug-in directory; obtaining target class information of the target update job plug-in in the target plug-in directory includes:
[0119] In response to determining that the target update job plug-in is a grayscale plug-in, obtaining target class information of the target update job plug-in from the grayscale version plug-in directory;
[0120] In response to determining that the target update job plug-in is a non-grayscale plug-in, the target class information of the target update job plug-in is obtained from the non-grayscale version plug-in directory.
[0121] Specifically, when obtaining the target class information of the target update job plug-in in the target plug-in directory, when it is determined that the target update job plug-in is a grayscale plug-in, the target class information is obtained from the grayscale version plug-in directory; when it is determined that the target update job plug-in is a non-grayscale plug-in, the target class information is obtained from the non-grayscale version plug-in directory.
[0122] Optionally, the paths of the grayscale version plug-in directory and the non-grayscale version plug-in directory are set separately. This setting can facilitate the management of different versions of job plug-ins. When the job plug-in needs to be updated, the developer updates the class information in the grayscale version plug-in directory and the non-grayscale version plug-in directory based on the updated job plug-in grayscale type, which can reduce the risk of class information update errors.
[0123] Optionally, in order to further improve the efficiency of obtaining target class information in the target plug-in directory, the target plug-in directory may be indexed.
[0124] The job method based on job plug-ins provided in this embodiment, the target plug-in directory includes a grayscale version plug-in directory and a non-grayscale version plug-in directory; obtaining the target class information of the target update job plug-in in the target plug-in directory includes: in response to determining that the target update job plug-in is a grayscale plug-in, obtaining the target class information of the target update job plug-in from the grayscale version plug-in directory; in response to determining that the target update job plug-in is a non-grayscale plug-in, obtaining the target class information of the target update job plug-in from the non-grayscale version plug-in directory. The method of this embodiment, by distinguishing the target plug-in directory into a grayscale version plug-in directory and a non-grayscale version plug-in directory, obtains the target class information from the corresponding plug-in directory according to the grayscale type of the target update job plug-in when applied, and can quickly and accurately obtain the target class information of the target update job plug-in.
[0125] As an optional implementation, based on any of the above embodiments, the target database includes a job instance ID, a plug-in type, and a plug-in grayscale identifier; querying the plug-in type corresponding to the job instance and whether there is a plug-in grayscale identifier in the target database based on the job instance includes:
[0126] Based on the job instance ID of the job instance, the plug-in type corresponding to the job instance ID and whether there is a corresponding plug-in grayscale identifier are queried in the target database.
[0127] Specifically, when querying the plug-in type corresponding to the job instance and whether it has a plug-in grayscale identification in the target database based on the job instance, the job instance ID is used to query in the target database to obtain the plug-in type corresponding to the job instance ID and whether it has a plug-in grayscale identification.
[0128] It should be noted that in the target database, the job instance ID corresponds to the job instance one by one. In addition, one job instance can correspond to one or more plug-in types.
[0129] Optionally, you can also search the target database by the name, keywords, and content description of the job instance.
[0130] Optionally, the plug-in type corresponding to the job instance ID and whether there is a plug-in grayscale mark are queried in the target database through a query instruction.
[0131] In the job method based on job plug-in provided in this embodiment, the target database includes the job instance ID, the plug-in type and the plug-in grayscale mark; based on the job instance, querying the plug-in type corresponding to the job instance and whether it has the plug-in grayscale mark in the target database includes: querying the plug-in type corresponding to the job instance ID and whether it has the corresponding plug-in grayscale mark in the target database based on the job instance ID of the job instance. The method of this embodiment can quickly and accurately query the plug-in type required by the job instance and whether it has the plug-in grayscale mark in the target database through the job instance ID.
[0132] Figure 3 A flowchart of a job method based on a job plug-in is provided for another embodiment of the present application, such as Figure 3 As shown in , the job method based on the job plug-in provided in this embodiment, when executing the job instance based on the target grayscale plug-in, specifically includes:
[0133] Step S2071, determining whether class information of the target grayscale plug-in is cached in the local memory.
[0134] Step S2072: In response to the class information of the target grayscale plug-in not being cached in the local memory, the class information of the target grayscale plug-in is loaded from the target plug-in directory.
[0135] Specifically, when executing a job instance based on the target grayscale plug-in, first determine whether the class information of the target grayscale plug-in is cached in the local memory. When it is determined that the class information of the target grayscale plug-in is not cached in the local memory, it means that this is the first time that this type of plug-in is called. At this time, obtain the class information of the target grayscale plug-in from the target plug-in directory and load it into the local memory.
[0136] It should also be noted that when it is determined that the target grayscale plug-in is cached in the local memory, the target grayscale plug-in cached in the local memory is directly called to execute the job instance task. The local memory cache method can avoid unnecessary disk I / O operations and class loading time, and improve the efficiency of the job plug-in in executing job tasks.
[0137] Optionally, class information in the target plugin directory is loaded through a class loader.
[0138] The job method based on the job plug-in provided in this embodiment executes the job instance based on the target grayscale plug-in, including: judging whether the class information of the target grayscale plug-in is cached in the local memory; in response to the class information of the target grayscale plug-in not being cached in the local memory, loading the class information of the target grayscale plug-in from the target plug-in directory. The method of this embodiment avoids repeated loading of the class information of the same job plug-in through the class information caching mechanism, and can improve the efficiency of the job plug-in in executing the job task.
[0139] Figure 4 A flowchart of a job method based on a job plug-in is provided for another embodiment of the present application, such as Figure 4 As shown in , the job method based on the job plug-in provided in this embodiment also includes:
[0140] Step S2041, in response to determining that the target update job plug-in fails to update, clear the target class information loaded into the local memory.
[0141] Step S2042, reacquire the target class information of the target update job plug-in in the target plug-in directory, and load the target class information into the local memory.
[0142] Specifically, when the target update job plug-in fails to update, the target class information loaded into the local memory is first cleared to avoid subsequent class information duplication, and then the target class information is re-acquired from the target plug-in directory and loaded into the local memory.
[0143] It should be noted that, in this embodiment, when the target update job plug-in fails to update, the target class information loaded into the local memory is first cleared to avoid using old or possibly damaged or no longer compatible class information to execute the job instance. Of course, in other embodiments, the target class information can be directly obtained from the target plug-in directory and overwritten to the class information in the local memory.
[0144] Optionally, through the message automatic retry mechanism provided by RocketMQ, after the target update job plug-in fails to update, the class information is automatically triggered to be reloaded.
[0145] Optionally, when the target update job plug-in fails to update after multiple attempts, an update failure warning message may be sent to the front end so that the user can know the update failure message of the target update job plug-in and check the reason for the update failure of the target update job plug-in.
[0146] The job method based on the job plug-in provided in this embodiment also includes: in response to determining that the target update job plug-in fails to update, clearing the target class information loaded into the local memory; re-obtaining the target class information of the target update job plug-in in the target plug-in directory, and loading the target class information into the local memory. The method of this embodiment can make another update attempt by reloading the target class information after the target update job plug-in fails to update, which can avoid update failures caused by file corruption and other problems, ensure the update efficiency of the target update job plug-in, and also avoid human intervention due to an update failure, ensuring the continuity of the job task.
[0147] Figure 5 A flowchart of a job method based on a job plug-in is provided for another embodiment of the present application, such as Figure 5 As shown in , the job method based on the job plug-in provided in this embodiment also includes:
[0148] Step S2061 , in response to determining that the job instance does not have a plug-in grayscale identifier, determining a target non-grayscale plug-in based on the plug-in type.
[0149] Step S2062: Execute the job instance based on the target non-grayscale plug-in.
[0150] Specifically, when it is determined that there is no grayscale plug-in identifier in the job instance, the target non-grayscale plug-in can be determined only by the plug-in type, and the job instance task is executed by the determined target non-grayscale plug-in.
[0151] Optionally, before executing the job instance through the target non-grayscale plug-in, determine whether the class information of the target non-grayscale plug-in is cached in the local memory. If the class information of the target non-grayscale plug-in is not cached, load the class information from the target plug-in directory to the local memory. If the class information of the target non-grayscale plug-in is cached, directly call the cached class information of the target non-grayscale plug-in to execute the job instance task.
[0152] The job method based on job plug-ins provided in this embodiment further includes: in response to determining that the job instance does not have a plug-in grayscale identifier, determining a target non-grayscale plug-in based on the plug-in type; and executing the job instance based on the target non-grayscale plug-in. The method of this embodiment can automatically select a non-grayscale plug-in to execute the job instance task when there is no grayscale requirement for the job instance, thereby ensuring job efficiency.
[0153] Figure 6 This is a schematic diagram of the structure of a job device based on a job plug-in provided in an embodiment of the present application. Figure 6As shown, the operation device based on the operation plug-in provided in this embodiment is located in the electronic device. The operation device based on the operation plug-in provided in this embodiment includes: a determination update plug-in module 31, a clearing module 32, a class information acquisition module 33, a job instance acquisition module 34, a query module 35, a determination job plug-in module 36 and an execution module 37.
[0154] Among them, the determination update plug-in module 31 is used to determine the target update job plug-in based on the update information of the job plug-in in response to receiving the update information of the job plug-in; the clearing module 32 is used to clear the initial class information of the target update job plug-in in the local memory based on the target update job plug-in; the acquisition class information module 33 is used to obtain the target class information of the target update job plug-in in the target plug-in directory in response to the initial class information of the target update job plug-in being cleared, and load the target class information into the local memory; the acquisition job instance module 34 is used to obtain the job instance sent by the job dispatching server in response to determining that the target class information is loaded and the target update job plug-in is updated successfully; the query module 35 is used to query the plug-in type corresponding to the job instance and whether it has a plug-in grayscale identifier in the target database based on the job instance; the determination job plug-in module 36 is used to determine the target grayscale plug-in based on the plug-in type and the plug-in grayscale identifier in response to determining that the job instance has a plug-in grayscale identifier; the execution module 37 is used to execute the job instance based on the target grayscale plug-in.
[0155] The operation device based on the operation plug-in provided in the embodiment of the present application can be used to execute the technical solution of the operation method based on the operation plug-in in the above-mentioned embodiment. Its implementation principle and technical effect are similar and will not be repeated here.
[0156] Optionally, the update information of the job plug-in includes plug-in type information and plug-in grayscale information.
[0157] Accordingly, when determining the target update job plug-in based on the update information of the job plug-in, the update plug-in determination module 31 is specifically used to: determine the plug-in type of the target update job plug-in based on the plug-in type information; and determine whether the target update job plug-in is a grayscale plug-in based on the plug-in grayscale information.
[0158] Optionally, the target plug-in directory includes a grayscale version plug-in directory and a non-grayscale version plug-in directory.
[0159] Correspondingly, when acquiring the target class information of the target update job plug-in in the target plug-in directory, the class information acquisition module 33 is specifically used to: in response to determining that the target update job plug-in is a grayscale plug-in, acquire the target class information of the target update job plug-in from the grayscale version plug-in directory; in response to determining that the target update job plug-in is a non-grayscale plug-in, acquire the target class information of the target update job plug-in from the non-grayscale version plug-in directory.
[0160] Optionally, the target database includes a job instance ID, a plug-in type, and a plug-in grayscale identifier.
[0161] Correspondingly, when querying the target database for the plug-in type corresponding to the job instance and whether it has a plug-in grayscale identification based on the job instance, the query module 35 is specifically used to: query the target database for the plug-in type corresponding to the job instance ID and whether it has a corresponding plug-in grayscale identification based on the job instance ID of the job instance.
[0162] Optionally, when executing a job instance based on a target grayscale plug-in, the execution module 37 is specifically used to: determine whether class information of the target grayscale plug-in is cached in the local memory; in response to the class information of the target grayscale plug-in not being cached in the local memory, load the class information of the target grayscale plug-in from the target plug-in directory.
[0163] Optionally, the clearing module 32 is also used to clear the target class information loaded into the local memory in response to determining that the target update job plug-in has failed to update; the class information acquisition module 33 is also used to re-acquire the target class information of the target update job plug-in in the target plug-in directory and load the target class information into the local memory.
[0164] Optionally, the job plug-in determination module 36 is further configured to determine a target non-grayscale plug-in based on the plug-in type in response to determining that the job instance has no plug-in grayscale identification; and the execution module 37 is further configured to execute the job instance based on the target non-grayscale plug-in.
[0165] Figure 7 A schematic diagram of the structure of an electronic device is provided for one embodiment of the present application. Figure 7 As shown in , the electronic device 40 provided in this embodiment includes: a processor 41, and a memory 42 which is communicatively connected to the processor.
[0166] The memory 42 stores computer-executable instructions, and the processor 41 executes the computer-executable instructions stored in the memory 42 to implement the job plug-in-based job method provided in any one of the above-mentioned embodiments.
[0167] The program may include program codes, and the program codes include computer-executable instructions. The memory 42 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0168] In this embodiment, the memory 42 is connected to the processor 41 via a bus 43. The bus 43 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. The bus 43 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 The fact that only one straight line is used in the diagram does not mean that there is only one bus or only one type of bus.
[0169] An embodiment of the present application also provides a computer-readable storage medium, including a computer-readable storage medium storing computer execution instructions, which, when executed by a processor, are used to implement a job method based on a job plug-in provided in any of the above embodiments.
[0170] An embodiment of the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the job plug-in-based job method provided in any one of the above embodiments.
[0171] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules is only a logical function division, and there may be other division methods in actual implementation, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.
[0172] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to implement the solution of this embodiment.
[0173] In addition, each functional module in each embodiment of the present application can be integrated into one processing unit, or each module can exist physically separately, or two or more modules can be integrated into one unit. The above-mentioned module-composed unit can be implemented in the form of hardware or in the form of hardware plus software functional units.
[0174] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the methods of various embodiments of the present application.
[0175] It should be understood that the above processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the invention can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor.
[0176] The memory may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk, etc.
[0177] The above storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The storage medium can be any available medium that can be accessed by a general or special purpose computer.
[0178] An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the storage medium can also exist as discrete components in an electronic control unit or a main control device.
[0179] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0180] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A job method based on a job plug-in, characterized in that: include: In response to receiving update information of the job plug-in, determining a target updated job plug-in based on the update information of the job plug-in; Clearing the initial class information of the target update job plug-in in the local memory based on the target update job plug-in; In response to the initial class information of the target update job plug-in being cleared, obtaining the target class information of the target update job plug-in in the target plug-in directory, and loading the target class information into the local memory; In response to determining that the target class information is loaded and the target update job plug-in is updated successfully, obtaining a job instance sent by the job dispatching server; Based on the job instance, query the target database for the plug-in type corresponding to the job instance and whether there is a plug-in grayscale identifier; In response to determining that the job instance has the plug-in grayscale identifier, determining a target grayscale plug-in based on the plug-in type and the plug-in grayscale identifier; The job instance is executed based on the target grayscale plug-in.
2. The method according to claim 1, characterized in that: The update information of the job plug-in includes plug-in type information and plug-in grayscale information; The step of determining a target updated job plug-in based on the update information of the job plug-in includes: Determine the plug-in type of the target update job plug-in based on the plug-in type information; Based on the plug-in grayscale information, it is determined whether the target update job plug-in is a grayscale plug-in.
3. The method according to claim 2, characterized in that The target plug-in directory includes a grayscale version plug-in directory and a non-grayscale version plug-in directory; The step of obtaining the target class information of the target update job plug-in in the target plug-in directory includes: In response to determining that the target update job plug-in is a grayscale plug-in, acquiring target class information of the target update job plug-in from the grayscale version plug-in directory; In response to determining that the target update job plug-in is a non-grayscale plug-in, the target class information of the target update job plug-in is obtained from the non-grayscale version plug-in directory.
4. The method according to claim 1, characterized in that The target database includes the job instance ID, plug-in type and plug-in grayscale identification; The querying the target database based on the job instance to determine the plug-in type corresponding to the job instance and whether the plug-in grayscale identifier is present includes: Based on the job instance ID of the job instance, the plug-in type corresponding to the job instance ID and whether there is a corresponding plug-in grayscale identifier are queried in the target database.
5. The method according to claim 1, characterized in that The executing the job instance based on the target grayscale plug-in includes: Determine whether the class information of the target grayscale plug-in is cached in the local memory; In response to the class information of the target grayscale plug-in not being cached in the local memory, the class information of the target grayscale plug-in is loaded from the target plug-in directory.
6. The method according to any one of claims 1 to 5, characterized in that Also includes: In response to determining that the target update job plug-in fails to update, clearing the target class information loaded into the local memory; Re-acquire the target class information of the target update job plug-in in the target plug-in directory, and load the target class information into the local memory.
7. The method according to any one of claims 1 to 5, characterized in that Also includes: In response to determining that the job instance does not have the plug-in grayscale identifier, determining a target non-grayscale plug-in based on the plug-in type; The job instance is executed based on the target non-grayscale plug-in.
8. A job device based on a job plug-in, characterized in that: include: An update plug-in determination module, configured to determine a target update job plug-in based on the update information of the job plug-in in response to receiving the update information of the job plug-in; A clearing module, used for clearing the initial class information of the target update job plug-in in the local memory based on the target update job plug-in; A class information acquisition module, configured to acquire target class information of the target update job plug-in in a target plug-in directory in response to the initial class information of the target update job plug-in being cleared, and load the target class information into a local memory; A job instance acquisition module, configured to acquire a job instance sent by a job dispatching server in response to determining that the target class information has been loaded and the target update job plug-in has been updated successfully; A query module, used for querying the plug-in type corresponding to the job instance and whether there is a plug-in grayscale identifier in the target database based on the job instance; A job plug-in determination module, configured to determine a target grayscale plug-in based on the plug-in type and the plug-in grayscale identifier in response to determining that the job instance has the plug-in grayscale identifier; An execution module is used to execute the job instance based on the target grayscale plug-in.
9. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.
11. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 7 when being executed by a processor.