Method and device for executing job and electronic equipment
By obtaining the source file list at preset times and sending alarm information, the system ensures that the source files are ready, thus solving the problem of low success rate and efficiency caused by missing source files during job execution and achieving high efficiency and continuity of job execution.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TRAVELSKY TECHNOLOGY LIMITED
- Filing Date
- 2025-12-31
- Publication Date
- 2026-04-21
AI Technical Summary
During job execution, the lack of source files results in a low success rate and efficiency of job execution, a problem that existing technologies have not been able to effectively solve.
By obtaining the list of source files in the associated directory of the job to be executed at a preset time, determining whether there is data under the source file identifier, sending alarm information to the data source of the abnormal source file identifier, and confirming the existence of data at the execution time, the job is executed only after all source file data is ready.
It improves the success rate and efficiency of job execution, avoids job failures caused by missing source files, and enhances the continuity and accuracy of job execution.
Smart Images

Figure CN121900906A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of big data, and more specifically, to a method, apparatus, and electronic device for performing a task. Background Technology
[0002] Many business processes involve numerous scheduled tasks, the successful execution of which hinges on the timely provision of specific source files. However, during task execution, situations often arise where the required source files are missing, leading to task failure. This necessitates manually retrieving the missing files and re-executing the task, impacting the continuity of the business process and efficiency. For instance, in civil aviation data processing, daily report generation relies on source data files from multiple departments. If any department fails to submit its file on time, the report generation task will fail, consequently affecting subsequent data analysis and decision-making.
[0003] There is currently no effective solution to the problem of low success rate and efficiency of job execution due to missing source files in related technologies. Summary of the Invention
[0004] The main objective of this application is to provide a method, apparatus, and electronic device for executing a job, in order to solve the problem that the success rate and efficiency of job execution are low due to the presence of missing source files in related technologies.
[0005] To achieve the above objectives, according to one aspect of this application, a method for executing a job is provided. The method includes: obtaining the execution time of the job to be executed, and obtaining a list of source files under the associated directory of the job to be executed at a preset time, wherein the preset time is earlier than the execution time; determining whether source file data exists under each source file identifier in the source file list; if source file data exists under all source file identifiers, executing the job to be executed at the execution time; if no source file data exists under at least one abnormal source file identifier, determining a first data source of the source file data under the abnormal source file identifier, and sending an alarm message to the first data source, wherein the alarm message is used to instruct the first data source to send the source file data; and upon reaching the execution time, determining whether source file data exists under the abnormal source file identifier, and determining the execution result of the job to be executed based on the determination result.
[0006] Optionally, determining the execution result of the job to be executed based on the judgment result includes: if source file data exists under the abnormal source file identifier, determining the execution result of the job to be executed as normal execution; if source file data does not exist under the abnormal source file identifier, determining the execution result of the job to be executed as cancellation.
[0007] Optionally, determining the first data source of source file data under the abnormal source file identifier and sending alarm information to the first data source includes: obtaining a preset lookup table containing abnormal source file identifiers, wherein the preset lookup table includes multiple abnormal source file identifiers and the data source to which the source file data under each abnormal source file identifier belongs; obtaining the data source corresponding to the abnormal source file identifier in the preset lookup table to obtain the first data source; generating alarm information based on the abnormal source file identifier and the attribute information of the job to be executed, and determining the interface of the first data source and the information transmission method; and sending the alarm information to the interface of the first data source according to the information transmission method.
[0008] Optionally, after determining the first data source of the source file data under the abnormal source file identifier, the method further includes: obtaining the historical data sending records of the first data source, and determining the historical number of times the abnormal source file identifier appears in the first data source based on the historical data sending records; canceling the step of sending alarm information to the first data source if the historical number is less than a first threshold; and executing the step of sending alarm information to the first data source if the historical number is greater than or equal to the first threshold.
[0009] Optionally, the method further includes: for any source file identifier in the source file list, obtaining the actual reception time of the source file data under the source file identifier, and obtaining the preset reception time of the source file data; determining whether the preset reception time is earlier than the actual reception time; if the preset reception time is earlier than the actual reception time, determining that the source file data is timed-out reception data, and incrementing the timed-out reception count of the source file identifier by 1 to obtain the updated timed-out reception count; if the timed-out reception count of the source file identifier is greater than a second threshold, determining that the second data source to which the source file data under the source file identifier belongs is abnormal, and sending a prompt message to the second data source.
[0010] Optionally, determining whether source file data exists under each source file identifier in the source file list includes: for any source file identifier, obtaining the data format and data generation date of the source file data under the source file identifier; determining whether the data format is a preset data format, and determining whether the data generation date is the same as the execution date of the job to be executed; if the data format is a preset data format and the data generation date is the execution date, determining that the source file data is accurate, and determining that source file data exists under the source file identifier; if the data format is not a preset data format, and / or the data generation date is not the execution date, determining that the source file data is inaccurate, and determining that source file data does not exist under the source file identifier.
[0011] Optionally, obtaining the list of source files under the associated directory of the job to be executed includes: obtaining the associated directory of the job to be executed in a preset database; querying the list of source files in the preset database according to the associated directory, and determining the list status of the source file list; if the list status is changed, waiting for the source file list to perform a change operation until the list status is unchanged; if the list status is unchanged, obtaining the list of source files.
[0012] To achieve the above objectives, according to another aspect of this application, a job execution apparatus is provided. The apparatus includes: a first acquisition unit, configured to acquire the execution time of the job to be executed and acquire a list of source files in the associated directory of the job to be executed at a preset time, wherein the preset time is earlier than the execution time; a first judgment unit, configured to determine whether source file data exists under each source file identifier in the source file list; a first execution unit, configured to execute the job to be executed at the execution time if source file data exists under all source file identifiers; a first determination unit, configured to determine a first data source of source file data under an abnormal source file identifier if no source file data exists under at least one abnormal source file identifier, and send an alarm message to the first data source, wherein the alarm message instructs the first data source to send the source file data; and a second judgment unit, configured to determine whether source file data exists under an abnormal source file identifier when the execution time arrives, and determine the execution result of the job to be executed based on the judgment result.
[0013] To achieve the above objectives, according to another aspect of this application, an electronic device is provided, the electronic device including a memory storing an executable program; and a processor for running the program, wherein the program executes the above-described method for performing the task during runtime.
[0014] To achieve the above objectives, according to another aspect of this application, a computer program product is provided, including computer instructions that, when executed by a processor, implement the steps of the above-described operation execution method.
[0015] In this embodiment, the execution time of the job to be executed is obtained, and a list of source files in the associated directory of the job to be executed is obtained at a preset time, wherein the preset time is earlier than the execution time; it is determined whether source file data exists under each source file identifier in the source file list; if source file data exists under each source file identifier, the job to be executed is executed at the execution time; if no source file data exists under at least one abnormal source file identifier, a first data source of the source file data under the abnormal source file identifier is determined, and an alarm message is sent to the first data source, wherein the alarm message is used to instruct the first data source to send source file data; when the execution time is reached, it is determined whether there is a source file under the abnormal source file identifier. This method involves analyzing file data and determining the execution result of the job to be executed based on the judgment result. Before the execution time arrives, the source file data is checked to determine whether there are source file identifiers with missing source file data. If so, an alarm message is sent based on the source file identifier, prompting the data source to provide the missing source file data. As a result, at the execution time, each source file identifier in the source file list contains source file data, thus avoiding the phenomenon of missing source file data. This achieves the technical effect of improving the success rate and efficiency of job execution, and solves the technical problem of low success rate and efficiency of job execution due to the presence of missing source files in related technologies. Attached Figure Description
[0016] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:
[0017] Figure 1 A hardware structure block diagram of a computer terminal for implementing a job execution method is shown.
[0018] Figure 2 This is a flowchart of the method for executing a job according to Embodiment 1 of this application;
[0019] Figure 3 This is a flowchart of an optional operation execution method provided according to Embodiment 1 of this application;
[0020] Figure 4 This is a schematic diagram of the work execution device provided according to Embodiment 2 of this application;
[0021] Figure 5 This is a structural block diagram of an electronic device according to an embodiment of this application. Detailed Implementation
[0022] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0023] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0024] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0025] It should be noted that the operation execution methods, apparatuses, and electronic devices defined in this disclosure can be used in the field of big data, or in any field other than big data. The application fields of the operation execution methods, apparatuses, and electronic devices defined in this disclosure are not limited.
[0026] The embodiments or examples disclosed herein are not exhaustive, but merely illustrative of some embodiments or examples, and are not intended to limit the scope of protection of this disclosure. Unless otherwise specified, each step in a particular embodiment or example can be implemented as an independent embodiment, and the steps can be arbitrarily combined. For example, a solution after removing some steps in a particular embodiment or example can also be implemented as an independent embodiment, and the order of the steps in a particular embodiment or example can be arbitrarily interchanged. Furthermore, optional methods or examples in a particular embodiment or example can be arbitrarily combined; moreover, embodiments or examples can be arbitrarily combined. For example, some or all steps of different embodiments or examples can be arbitrarily combined, and a particular embodiment or example can be arbitrarily combined with optional methods or examples of other embodiments or examples.
[0027] Example 1
[0028] According to an embodiment of this application, an embodiment of a method for executing a job is also provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0029] The method embodiment provided in Embodiment 1 of this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1 A hardware block diagram of a computer terminal for implementing a job execution method is shown. Figure 1 As shown, the computer terminal 10 (or mobile device) may include one or more processors 102 (shown as 102a, 102b, ..., 102n in the figure) 102 (processor 102 may include, but is not limited to, processing devices such as microprocessors or programmable logic devices), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface, a universal serial bus port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0030] It should be noted that the aforementioned one or more processors 102 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10 (or mobile device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).
[0031] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the job execution method in the embodiments of this application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby implementing the aforementioned job execution method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0032] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0033] The display may be, for example, a touchscreen LCD display that allows the user to interact with the user interface of the computer terminal 10 (or mobile device).
[0034] Under the aforementioned operating environment, this application provides the following: Figure 2 The method for executing the task is shown. Figure 2 This is a flowchart of the job execution method provided in Embodiment 1 of this application, as follows: Figure 2 As shown, the method includes:
[0035] Step S201: Obtain the execution time of the job to be executed, and obtain the list of source files in the associated directory of the job to be executed at a preset time, wherein the preset time is earlier than the execution time.
[0036] It should be noted that the execution entity in this embodiment can be the job execution system. When the job execution time arrives, the system can call the source file and execute the job to be executed according to the source file.
[0037] It should be noted that "jobs to be executed" refers to tasks set in the system that need to run automatically at a specific time. The execution time is the pre-set start time for the job. The preset time is a point in time before the job's execution time, used to check in advance whether the required source files for the job are available. The associated directory is the directory location in the database where the source files required for the jobs to be executed are stored. The source file list contains information such as the filenames and creation times of all source files in the associated directory.
[0038] For example, for each pending job in the job execution system, the system needs to determine the job configuration file of each pending job in the job execution queue and obtain the execution time of all pending jobs from it. For each pending job, the system can set a preset time in advance (e.g., 15 minutes before job execution) based on its execution time, and start a check task when the preset time is reached. By calling the API (Application Programming Interface) of the file storage database or using database operation commands, the system queries the list of source files in the directory associated with the pending job. This allows the system to verify in advance whether the source files required by the job have arrived on time, promptly detect missing files, allow time for subsequent exception handling, and improve the success rate of job execution.
[0039] It should be noted that the database can store directories for each job, which contain a list of source files for executing the job. The list of source files includes multiple source file identifiers, as well as the source file data and attribute information corresponding to each source file identifier.
[0040] It should be noted that each data source can update the contents of the source file list in the directory of each job in the database at specified times, so that the source file data in the directory is the latest and most accurate data.
[0041] Step S202: Determine whether source file data exists under each source file identifier in the source file list.
[0042] It should be noted that the source file identifier is information used in the system to uniquely identify the source file, typically consisting of the filename, business category ID (Identification), etc. Source file data refers to the specific content of the source file, including but not limited to text and data records.
[0043] For example, after obtaining the list of source files, the system can check, one by one, whether a corresponding data file exists under each source file identifier. During the check, the system can verify the existence of the file by comparing the source file identifier with the content of the actual source file data in the associated directory. If the source file identifier matches the actual source file data, the source file data is determined to exist; otherwise, the source file data is considered missing.
[0044] Step S203: If source file data exists under each source file identifier, execute the job to be executed at the execution time.
[0045] For example, once the system confirms that all source file data under all source file identifiers exist, the system will automatically trigger the job execution process at the time of job execution. The job execution process may include steps such as calling the job script, data processing, and result output, so that the job can run normally based on complete source data.
[0046] Step S204: If there is no source file data under at least one abnormal source file identifier, determine the first data source of the source file data under the abnormal source file identifier, and send an alarm message to the first data source, wherein the alarm message is used to instruct the first data source to send the source file data.
[0047] For example, if missing source file data is detected, the system will query the source file information database for the primary source data source, i.e., the department or individual responsible for providing the data, based on the source file identifier. Subsequently, the system can immediately send an alarm message based on the contact information of the primary source data source. The alarm message must include key information such as the job name, execution time, and source file identifier, clearly instructing the primary source data source to urgently provide the missing source file data.
[0048] Step S205: When the execution time is reached, determine whether there is source file data under the abnormal source file identifier, and determine the execution result of the job to be executed based on the determination result.
[0049] For example, after the job execution time arrives, the system checks again whether the source file data under the abnormal source file identifier has been provided. If all abnormal source file data is available at this time, the system will execute the job normally; if there is still source file data that is not provided, the job execution is determined to have failed, and the reason for failure is recorded. The system can feed back the final execution result of the job (success or failure) and the reason for failure to the business monitoring platform for subsequent troubleshooting and processing.
[0050] This embodiment effectively curbs job execution failures and quickly resolves data loss issues by obtaining source file status in advance, locating responsible personnel and sending timely alerts, and providing final confirmation at the time of job execution. This improves the success rate and efficiency of the job execution process. For example, in a civil aviation data processing scenario, the system enables daily scheduled report generation jobs to execute smoothly based on the timely provision of all required source data files. If a file is found to be missing, the system can quickly notify the responsible department, avoiding job interruptions due to data problems and improving the continuity and accuracy of job execution.
[0051] The job execution method provided in this application embodiment involves: obtaining the execution time of the job to be executed and obtaining a list of source files under the associated directory of the job to be executed at a preset time, wherein the preset time is earlier than the execution time; determining whether source file data exists under each source file identifier in the source file list; if source file data exists under each source file identifier, executing the job to be executed at the execution time; if no source file data exists under at least one abnormal source file identifier, determining a first data source of the source file data under the abnormal source file identifier and sending alarm information to the first data source, wherein the alarm information is used to instruct the first data source to send source file data; and upon reaching the execution time, determining the source file data under the abnormal source file identifier... The method of determining the execution result of a job based on the existence of source file data involves detecting the source file data before the execution time to identify source file identifiers with missing data. If a missing source file identifier is found, an alarm is sent, prompting the data source to provide the missing source file data. Consequently, at the execution time, all source file identifiers in the source file list contain source file data, thus avoiding the occurrence of missing source file data. This achieves the technical effect of improving the success rate and efficiency of job execution, and solves the technical problem of low success rate and efficiency of job execution due to the presence of missing source files in related technologies.
[0052] To accurately determine the execution result, optionally, in the job execution method provided in this application embodiment, determining the execution result of the job to be executed based on the judgment result includes: if source file data exists under the abnormal source file identifier, determining the execution result of the job to be executed as normal execution; if source file data does not exist under the abnormal source file identifier, determining the execution result of the job to be executed as cancellation.
[0053] It should be noted that the abnormal source file identifier refers to the source file that is marked by the system as not providing source file data during the preset time check. The existence of source file data indicates that at the actual execution time of the job, the source file has been uploaded to the specified location, meeting the conditions for job execution.
[0054] For example, upon reaching the job execution time, the system will re-verify whether the source file data under the previously marked abnormal source file identifiers has been successfully retrieved. This process involves directly accessing the file storage database, retrieving the file list under the associated directory, and comparing the file identifiers to confirm the existence status of the files. If the source file data under all abnormal identifiers exists, it indicates that this data has been replenished at some point after the preset time, satisfying the preconditions for job execution, and the system will automatically execute the job according to the established process.
[0055] For example, if an anomaly is detected where source file data is still missing, the system will automatically determine the job's execution status as "cancelled." After making the cancellation decision, the system will record the job status and detailed reasons (i.e., which source file data is missing) in the system log and send the recorded anomaly information to the corresponding data source via a message queue. This anomaly information includes, but is not limited to, missing source file information, job name, expected execution time, and suggested remedial measures. Furthermore, the system should also record the cancellation status of this job execution for subsequent data analysis and problem tracking.
[0056] This embodiment uses secondary verification to ensure that even if missing source file data is found at a preset check time, it can be supplemented in time before the job is officially executed, avoiding unnecessary job cancellations, improving the job execution success rate, and providing secondary protection for data integrity. It also prevents the system from executing invalid jobs when key inputs are missing, reducing potential errors and resource waste in the data processing process. At the same time, alarm notifications promptly inform the data source of job status changes, promoting the data source's rapid response and resolution of problems, and enhancing system stability.
[0057] To accurately send alarm information, optionally, in the job execution method provided in this application embodiment, determining the first data source of source file data under the abnormal source file identifier and sending alarm information to the first data source includes: obtaining a preset lookup table containing abnormal source file identifiers, wherein the preset lookup table includes multiple abnormal source file identifiers and the data source to which the source file data under each abnormal source file identifier belongs; obtaining the data source corresponding to the abnormal source file identifier in the preset lookup table to obtain the first data source; generating alarm information based on the abnormal source file identifier and the attribute information of the job to be executed, and determining the interface of the first data source and the information transmission method; and sending the alarm information to the interface of the first data source according to the information transmission method.
[0058] It should be noted that the default lookup table is a database table in the system used to store the mapping relationship between abnormal source file identifiers and data sources. It contains information on all possible abnormal source file identifiers and their respective data sources.
[0059] For example, when determining the primary data source for source file data under an abnormal source file identifier, the system first loads a pre-defined lookup table from the source file information database. This table records in detail the abnormal identifiers of the source files required for each job and their corresponding data sources. The pre-defined lookup table is constructed based on job configuration information and the source file information database and is maintained in advance by the system administrator or operations personnel. Each record in the lookup table includes the abnormal source file identifier, data source type, data source ID, and source file attribute information.
[0060] Furthermore, after the preset lookup table is determined, when the system detects that the source file data under the abnormal source file identifier is missing, it can use a query statement to query the preset lookup table for records that match the abnormal source file identifier, and extract the corresponding data source information to determine the first data source.
[0061] Furthermore, after identifying the primary data source, alarm information can be generated based on the anomaly source file identifier and the attribute information of the job to be executed (such as job name, execution time, etc.). The alarm information includes, but is not limited to, the reason for job failure, the anomaly source file identifier, the job name, the expected execution time, and suggested remedial measures. Simultaneously, the most suitable interface and information transmission method need to be determined based on the type and attributes of the primary data source.
[0062] For example, if the primary data source is a file server, alarm information may be sent through the file server's management interface; if the primary data source is a database, alarms may be sent through the database's management tools or API interface. The system should support diverse information transmission methods, including but not limited to email, SMS, and instant message push, to adapt to the management and response needs of different data sources.
[0063] Finally, after determining the information transmission method and the primary data source interface, alarm information can be sent to the primary data source through the corresponding protocol or API interface based on the information transmission method. Before sending, the system will encrypt the alarm information to ensure secure transmission. After successful transmission, the system also needs to record the alarm sending time, status, and the primary data source's response to facilitate subsequent alarm management, statistical analysis, and problem tracking.
[0064] This embodiment achieves automated, accurate, and efficient alarm notification in the event of abnormal operations by constructing a preset lookup table, accurately matching the abnormal source file identifier with the data source, generating and customizing alarm information, and transmitting information through the most suitable interface. This helps to quickly resolve data loss issues and improve the continuity and accuracy of job execution.
[0065] Optionally, in the job execution method provided in the embodiments of this application, after determining the first data source of the source file data under the abnormal source file identifier, the method further includes: obtaining the historical data sending records of the first data source, and determining the historical number of times the abnormal source file identifier appears in the first data source based on the historical data sending records; canceling the step of sending alarm information to the first data source if the historical number is less than a first threshold; and executing the step of sending alarm information to the first data source if the historical number is greater than or equal to the first threshold.
[0066] It should be noted that historical data transmission records are system-maintained records of past data transmission activities from the primary data source, including but not limited to transmission time, file identifier, and transmission status. Historical counts refer to the number of times data with the same file identifier as the current anomaly source file has experienced anomalies (such as failure to be transmitted on time) in the historical data transmission records, used to assess the reliability of the data source.
[0067] For example, after determining the first data source corresponding to the abnormal source file identifier, the historical data sending records of the data source can be queried from the system's operation and maintenance log database, and all records containing the current abnormal source file identifier can be filtered out, and the number of times data sending anomalies (such as files not arriving on time or being missing) are counted.
[0068] Furthermore, assuming the system sets a first threshold of 3 times, if the first data source experiences fewer than 3 data transmission anomalies within a certain period (e.g., the last 30 days), the current anomaly is considered an isolated event, and the system will not send an alarm to that data source. After determining that the historical number is below the first threshold, the system will cancel the alarm sending process and only record this anomaly for subsequent statistical analysis and problem trend prediction.
[0069] If the historical number of occurrences reaches or exceeds the first threshold, the system will consider that the primary data source has a persistent data transmission problem, which may require further intervention and improvement. At this time, the system will immediately execute the alarm sending process, sending detailed alarm information to the relevant personnel of the primary data source, including but not limited to the reason for the job failure, the identifier of the abnormal source file, the job name, the expected execution time, and the statistics of historical anomalies. The alarm information is sent through pre-configured contact methods (such as telephone and email) so that the data source can receive it in a timely manner and take measures.
[0070] This embodiment achieves intelligent and accurate alarm information transmission by introducing the analysis of historical data transmission records and a threshold-based alarm decision mechanism, thus avoiding invalid or redundant alarm information.
[0071] Optionally, in the job execution method provided in the embodiments of this application, the method further includes: for any source file identifier in the source file list, obtaining the actual reception time of the source file data under the source file identifier, and obtaining the preset reception time of the source file data; determining whether the preset reception time is earlier than the actual reception time; if the preset reception time is earlier than the actual reception time, determining that the source file data is timed-out reception data, and incrementing the timed-out reception count of the source file identifier by 1 to obtain the updated timed-out reception count; if the timed-out reception count of the source file identifier is greater than a second threshold, determining that the second data source to which the source file data under the source file identifier belongs is abnormal, and sending a prompt message to the second data source.
[0072] It should be noted that the actual reception time refers to the point in time when the system detects the source file data actually appearing in the file storage directory. The preset reception time is the expected or latest arrival time set for the source file data based on business process requirements.
[0073] For example, at a preset check time point before job execution, the system obtains the actual reception time of the source file data under each source file identifier in the source file list by calling the file storage system's API or using system commands. Simultaneously, it reads the preset reception time corresponding to each source file identifier from the job configuration file.
[0074] Furthermore, the system compares the actual reception time of the source file data under the source file identifier with the preset reception time. If the preset reception time is earlier than the actual reception time, the system marks the source file data as timed-out reception data and updates the timed-out reception count corresponding to the source file identifier of the source file data. This update is usually performed in the source file information database by creating or adding a timed-out reception count field for each source file identifier. Whenever a timed-out reception is detected, this field is incremented to record the timed-out reception status of the source file identifier.
[0075] When the number of timeouts reaches or exceeds the second threshold (e.g., 5 times), the system will determine the second data source to which the source file data belongs and send a prompt message to it. The prompt message includes details of the timeout (such as the number of timeouts, the specific time of the most recent timeout, etc.), the source file identifier, the business category to which it belongs, and possible suggestions for improvement measures.
[0076] This embodiment achieves monitoring and early warning of source file data reception timeouts by comparing the reception time of source file data, recording the number of timeout receptions, and setting a second threshold. The system can not only determine in real time whether source file data arrives on time, but also accurately identify data sources with frequent timeouts and promptly notify the data source to take improvement measures. This not only enhances the monitoring capability of data preparation before job execution but also promotes the self-optimization of data sources and reduces job interruptions caused by data delays.
[0077] Optionally, in the job execution method provided in this application embodiment, determining whether source file data exists under each source file identifier in the source file list includes: for any source file identifier, obtaining the data format and data generation date of the source file data under the source file identifier; determining whether the data format is a preset data format, and determining whether the data generation date is the same as the execution date of the job to be executed; if the data format is a preset data format and the data generation date is the execution date, determining that the source file data is accurate, and determining that source file data exists under the source file identifier; if the data format is not a preset data format, and / or the data generation date is not the execution date, determining that the source file data is inaccurate, and determining that source file data does not exist under the source file identifier.
[0078] For example, when determining whether source file data exists under each source file identifier in the source file list, for each source file identifier in the list, the system first obtains the data format and data generation date of the source file data through file attribute access or metadata reading, and then compares the data format and data generation date of the source file data according to a pre-defined standard. The preset standard for the data format is stored in the job configuration file, which specifies the correct data format corresponding to each source file identifier. The comparison of the data date is based on the job execution date, ensuring that the data is up-to-date or corresponds to the job execution time. If the data format does not conform to the preset standard or the data generation date does not match the job execution date, the system will mark the source file data under that source file identifier as inaccurate.
[0079] When the source file data format matches the preset format and the data generation date matches the job execution date, the source file data is confirmed to be accurate, and the data under the source file identifier is marked as "existent". This confirmation process is achieved through precise matching of data format and date, ensuring that the data used for job execution is the correct and up-to-date source file data.
[0080] If the system determines that the source file data format does not conform to the preset standard, or that the data generation date does not match the job execution date, the system will judge the source file data as inaccurate and mark that there is no valid source file data under the source file identifier.
[0081] This embodiment achieves the technical effect of accurately determining whether source file data exists by verifying both the data format and the data generation date of the source file data.
[0082] Optionally, in the job execution method provided in this application embodiment, obtaining the source file list under the associated directory of the job to be executed includes: obtaining the associated directory of the job to be executed in a preset database; querying the source file list in the preset database according to the associated directory, and determining the list status of the source file list; if the list status is a changed status, waiting for the source file list to perform a change operation until the list status is a non-changed status; if the list status is a non-changed status, obtaining the source file list.
[0083] For example, when retrieving the source file list, the system first retrieves the associated directory of the job to be executed from the preset database based on the job ID, and then obtains the source file list under the associated directory by calling the file storage system's API or using file system commands. Simultaneously, the system also needs to check the list status of the source files to determine if it is in a changed state. The list status can be checked by listening to file system event notifications, such as file creation, deletion, or modification events, to determine if the source file list is changing. If the list status is changed, it means the file list is being updated, and the obtained file list may be incomplete or inaccurate at this time.
[0084] When the system detects that the source file list is in a changed state, it will enter a waiting mode, pausing the acquisition of the source file list until the file system sends a "list change complete" signal, or until a preset waiting time (e.g., 30 seconds) is elapsed before rechecking the list status. During the waiting period, the system will continuously listen for file system events. Once the list status changes to a non-changed state, indicating that the file list update is complete, the system will immediately resume the acquisition of the source file list.
[0085] Once the status of the source file list is confirmed to be unchanged, indicating that the file list update is complete, the source file list retrieval operation is performed. This allows the source file list to be retrieved when the file list status is stable, thus improving the accuracy of the retrieved source file list.
[0086] This embodiment improves the accuracy of the obtained source file list by determining whether to perform the list retrieval operation based on the list status when obtaining the source file list.
[0087] Figure 3 This is a flowchart of an optional operation execution method provided in Embodiment 1 of this application, as shown below. Figure 3As shown, upon reaching a preset time, the system retrieves a list of source files in the associated directory of the job to be executed and determines whether there are any abnormal source file identifiers indicating missing source file data. If an abnormal source file identifier exists, an alarm message is sent to the first data source associated with that identifier, and the system waits until the execution time. Upon reaching the execution time, it checks whether source file data exists under the abnormal source file identifier. If it does, the job to be executed is performed; otherwise, the job execution result is determined to be a failure. By detecting the source file data before reaching the execution time, the system determines whether there are any source file identifiers indicating missing source file data and sends an alarm message based on the identifier if such an identifier exists, prompting the data source to provide the missing source file data. Consequently, upon reaching the execution time, all source file identifiers in the source file list contain source file data, thus avoiding the phenomenon of missing source file data. This achieves the technical effect of improving the success rate and efficiency of job execution, thereby solving the technical problem in related technologies where the existence of missing source files leads to low success rate and efficiency of job execution.
[0088] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0089] Example 2
[0090] This application also provides a job execution device. It should be noted that the job execution device of this application can be used to execute the job execution method provided in the above embodiments. The job execution device provided in this application will be described below.
[0091] According to an embodiment of this application, an apparatus for implementing the above-described operation execution method is also provided. Figure 4 This is a schematic diagram of the work execution device according to Embodiment 2 of this application, as shown below. Figure 4 As shown, the device includes:
[0092] The first acquisition unit 41 is used to acquire the execution time of the job to be executed and to acquire the list of source files in the associated directory of the job to be executed at a preset time, wherein the preset time is earlier than the execution time.
[0093] The first judgment unit 42 is used to determine whether there is source file data under each source file identifier in the source file list.
[0094] The first execution unit 43 is used to execute the job to be executed at the execution time when source file data exists under each source file identifier.
[0095] The first determining unit 44 is used to determine the first data source of the source file data under the abnormal source file identifier when there is no source file data under at least one abnormal source file identifier, and send alarm information to the first data source, wherein the alarm information is used to instruct the first data source to send the source file data.
[0096] The second judgment unit 45 is used to determine whether there is source file data under the abnormal source file identifier when the execution time is reached, and to determine the execution result of the job to be executed based on the judgment result.
[0097] The job execution device provided in this application embodiment acquires the execution time of the job to be executed through a first acquisition unit 41, and acquires a list of source files under the associated directory of the job to be executed at a preset time, wherein the preset time is earlier than the execution time; a first judgment unit 42 judges whether there is source file data under each source file identifier in the source file list; a first execution unit 43 executes the job to be executed at the execution time if there is source file data under each source file identifier; a first determination unit 44 determines the first data source of the source file data under the abnormal source file identifier if there is no source file data under at least one abnormal source file identifier, and sends an alarm message to the first data source, wherein the alarm message is used to instruct the first data source to send source file data; a second judgment unit 45 judges whether there is source file data under the abnormal source file identifier when the execution time is reached, and determines the execution result of the job to be executed based on the judgment result. By detecting source file data before the execution time, it can determine whether there are source file identifiers with missing source file data. If so, an alarm message is sent based on the source file identifier, causing the data source to provide the missing source file data. As a result, at the execution time, each source file identifier in the source file list contains source file data, thus avoiding the phenomenon of missing source file data. This achieves the technical effect of improving the success rate and efficiency of job execution, and solves the technical problem of low success rate and efficiency of job execution due to the presence of missing source files in related technologies.
[0098] Optionally, in the job execution device provided in the embodiments of this application, the second determination unit 45 includes: a first determination module, used to determine that the execution result of the job to be executed is normal execution when source file data exists under the abnormal source file identifier; and a second determination module, used to determine that the execution result of the job to be executed is cancellation execution when source file data does not exist under the abnormal source file identifier.
[0099] Optionally, in the job execution device provided in this application embodiment, the first determining unit 44 includes: a first obtaining module, used to obtain a preset lookup table containing abnormal source file identifiers, wherein the preset lookup table includes multiple abnormal source file identifiers and the data source to which the source file data under each abnormal source file identifier belongs; a second obtaining module, used to obtain the data source corresponding to the abnormal source file identifier in the preset lookup table to obtain a first data source; a generating module, used to generate alarm information according to the abnormal source file identifier and the attribute information of the job to be executed, and determine the interface of the first data source and the information transmission method; and a sending module, used to send the alarm information to the interface of the first data source according to the information transmission method.
[0100] Optionally, in the job execution apparatus provided in the embodiments of this application, the apparatus further includes: a second acquisition unit, configured to acquire historical data transmission records of the first data source, and determine the historical number of times an abnormal source file identifier appears in the first data source based on the historical data transmission records; a cancellation unit, configured to cancel the step of sending alarm information to the first data source if the historical number is less than a first threshold; and a second execution unit, configured to execute the step of sending alarm information to the first data source if the historical number is greater than or equal to the first threshold.
[0101] Optionally, in the job execution apparatus provided in the embodiments of this application, the apparatus further includes: a third acquisition unit, configured to acquire, for any source file identifier in the source file list, the actual reception time of the source file data under the source file identifier, and acquire the preset reception time of the source file data; a third judgment unit, configured to determine whether the preset reception time is earlier than the actual reception time; a second determination unit, configured to determine that the source file data is timed-out reception data when the preset reception time is earlier than the actual reception time, and increment the timed-out reception count of the source file identifier by 1 to obtain the updated timed-out reception count; and a third determination unit, configured to determine that the second data source to which the source file data under the source file identifier belongs is abnormal when the timed-out reception count of the source file identifier is greater than a second threshold, and send a prompt message to the second data source.
[0102] Optionally, in the job execution device provided in this application embodiment, the first judgment unit 42 includes: a third acquisition module, used to acquire the data format and data generation date of the source file data under any source file identifier; a first judgment module, used to determine whether the data format is a preset data format and whether the data generation date is the same as the execution date of the job to be executed; a third determination module, used to determine that the source file data is accurate and that source file data exists under the source file identifier when the data format is a preset data format and the data generation date is the execution date; and a fourth determination module, used to determine that the source file data is inaccurate and that source file data does not exist under the source file identifier when the data format is not a preset data format and / or the data generation date is not the execution date.
[0103] Optionally, in the job execution device provided in the embodiments of this application, the first acquisition unit 41 includes: a fourth acquisition module, used to acquire the associated directory of the job to be executed in a preset database; a second judgment module, used to query the source file list in the preset database according to the associated directory and judge the list status of the source file list; a waiting module, used to wait for the source file list to perform a change operation when the list status is a changed state, until the list status is a non-changed state; and a fifth acquisition module, used to acquire the source file list when the list status is a non-changed state.
[0104] It should be noted that the first acquisition unit 41, the first judgment unit 42, the first execution unit 43, the first determination unit 44, and the second judgment unit 45 mentioned above correspond to steps S201 to S205 in Embodiment 1. The instances and application scenarios implemented by each of the above units and the corresponding steps are the same, but are not limited to the content disclosed in Embodiment 1. It should be noted that the above modules or units can be hardware components or software components stored in memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n). The above modules can also be part of a device and can run in the computer terminal 10 provided in Embodiment 1.
[0105] Example 3
[0106] Embodiments of this application may provide an electronic device. Figure 5 This is a structural block diagram of an electronic device according to an embodiment of this application. Figure 5 As shown, the electronic device may include: one or more ( Figure 5 (Only one is shown) processor 1002, memory 1004, memory controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.
[0107] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the methods and apparatus in the embodiments of this application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby implementing the above-described methods. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0108] Those skilled in the art will understand that Figure 5 The structure shown is for illustrative purposes only. Electronic devices can also be smartphones, tablets, handheld computers, mobile internet devices (MIDs), PADs, and other terminal devices. Figure 5 This does not limit the structure of the aforementioned electronic device. For example, electronic devices may also include components that are more... Figure 5 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same Figure 5 The different configurations shown.
[0109] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0110] Example 4
[0111] Embodiments of this application also provide a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the job execution method provided in Embodiment 1.
[0112] Optionally, in this embodiment, the storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.
[0113] Embodiments of this application also provide a computer program product, which, when executed on a data processing device, is a program adapted to perform the steps of an execution method for a job.
[0114] Embodiments of this application also provide a computer-readable storage medium, which includes a stored executable program, wherein, when the executable program is running, the execution method controls the device where the computer-readable storage medium is located to perform the above-described operation.
[0115] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0116] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0117] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0118] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0119] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0120] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0121] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method for executing a task, characterized in that, include: Obtain the execution time of the job to be executed, and obtain the list of source files in the associated directory of the job to be executed at a preset time, wherein the preset time is earlier than the execution time; Determine whether source file data exists under each source file identifier in the source file list; If the source file data exists under each source file identifier, the job to be executed is executed at the execution time. If the source file data does not exist under at least one abnormal source file identifier, a first data source of the source file data under the abnormal source file identifier is determined, and an alarm message is sent to the first data source, wherein the alarm message is used to instruct the first data source to send the source file data; When the execution time is reached, it is determined whether the source file data exists under the abnormal source file identifier, and the execution result of the job to be executed is determined based on the determination result.
2. The method according to claim 1, characterized in that, The execution result of the task to be executed is determined based on the judgment result, including: If the source file data exists under the abnormal source file identifier, the execution result of the job to be executed is determined to be normal execution; If the source file data does not exist under the abnormal source file identifier, the execution result of the job to be executed is determined to be cancelled.
3. The method according to claim 1, characterized in that, Determining the first data source of the source file data under the abnormal source file identifier and sending alarm information to the first data source includes: Obtain a preset lookup table containing the abnormal source file identifiers, wherein the preset lookup table includes multiple abnormal source file identifiers and the data source to which the source file data under each abnormal source file identifier belongs; The first data source is obtained by retrieving the data source corresponding to the abnormal source file identifier from the preset lookup table. The alarm information is generated based on the abnormal source file identifier and the attribute information of the job to be executed, and the interface of the first data source and the information transmission method are determined. The alarm information is sent to the interface of the first data source according to the information transmission method.
4. The method according to claim 1, characterized in that, After determining the first data source of the source file data under the abnormal source file identifier, the method further includes: Obtain historical data transmission records from the first data source, and determine the historical number of times the abnormal source file identifier appears in the first data source based on the historical data transmission records; If the number of historical occurrences is less than a first threshold, the step of sending alarm information to the first data source will be cancelled. If the number of historical occurrences is greater than or equal to the first threshold, the step of sending alarm information to the first data source is executed.
5. The method according to claim 1, characterized in that, The method further includes: For any source file identifier in the source file list, obtain the actual reception time of the source file data under the source file identifier, and obtain the preset reception time of the source file data; Determine whether the preset reception time is earlier than the actual reception time; If the preset reception time is earlier than the actual reception time, the source file data is determined to be timed-out reception data, and the timed-out reception count of the source file identifier is incremented by 1 to obtain the updated timed-out reception count; If the number of timeouts for receiving the source file identifier exceeds a second threshold, it is determined that the second data source to which the source file data under the source file identifier belongs is abnormal, and a prompt message is sent to the second data source.
6. The method according to claim 1, characterized in that, Determining whether source file data exists under each source file identifier in the source file list includes: For any source file identifier, obtain the data format and data generation date of the source file data under the source file identifier; Determine whether the data format is a preset data format, and determine whether the data generation date is the same as the execution date of the job to be executed; If the data format is the preset data format and the data generation date is the execution date, it is determined that the source file data is accurate, and it is determined that the source file data exists under the source file identifier; If the data format is not the preset data format, and / or the data generation date is not the execution date, it is determined that the source file data is inaccurate, and it is determined that the source file data does not exist under the source file identifier.
7. The method according to claim 1, characterized in that, Obtaining the list of source files in the associated directory of the job to be executed includes: Obtain the associated directory of the job to be executed in the preset database; Based on the associated directory, the source file list is queried in the preset database, and the list status of the source file list is determined; If the list status is changed, wait for the source file list to perform a change operation until the list status is changed to non-change. If the list status is in the non-changed state, obtain the source file list.
8. A work execution device, characterized in that, include: The first acquisition unit is used to acquire the execution time of the job to be executed, and to acquire a list of source files in the associated directory of the job to be executed at a preset time, wherein the preset time is earlier than the execution time; The first judgment unit is used to determine whether there is source file data under each source file identifier in the source file list; The first execution unit is configured to execute the job to be executed at the execution time when the source file data exists under each source file identifier. The first determining unit is configured to determine a first data source of the source file data under the abnormal source file identifier when the source file data does not exist under at least one abnormal source file identifier, and send an alarm message to the first data source, wherein the alarm message is used to instruct the first data source to send the source file data; The second judgment unit is used to determine whether the source file data exists under the abnormal source file identifier when the execution time is reached, and to determine the execution result of the job to be executed based on the judgment result.
9. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the steps of the job execution method according to any one of claims 1 to 7.
10. An electronic device, characterized in that, include: Memory, which stores executable programs; A processor for running the program, wherein the program, when running, executes the method for executing the job according to any one of claims 1 to 7.