A file clearing method, device, storage medium and electronic device

By obtaining configuration files and setting up multi-threaded traversal, clearing intermediate result files that meet the conditions in the simulation system, solving the problem of excessive storage space occupied and improving the execution efficiency of simulation tasks.

CN116339637BActive Publication Date: 2024-12-06INTELLIGENT IMITATION TECHNOLOGY (ZHEJIANG) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310328855.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-22
Publication Date
2024-12-06
Estimated Expiration
2043-03-22

AI Technical Summary

Technical Problem

The prior art is difficult to flexibly clear intermediate result files in the simulation system according to user needs, resulting in excessive storage space occupied and affecting the execution efficiency of simulation tasks.

Method used

By obtaining configuration files, determining file filtering rules and time information, setting up multi-threading parallel traversal intermediate result file directory that meets the conditions, clearing files that meet the rules, and transferring files that do not meet the rules to the archive directory.

Benefits of technology

It realizes the rapid release of storage space, improves the task execution efficiency of the simulation system, and enhances the flexibility and security of file cleaning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116339637B_ABST
    Figure CN116339637B_ABST
Patent Text Reader

Abstract

This specification discloses a method, device, storage medium and electronic device for clearing files. By clearing intermediate result files that meet the requirements of configuration files generated by a simulation system during task execution in a multi-threaded parallel manner, more storage space can be quickly released to improve the task execution efficiency of the simulation system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method, device, storage medium and electronic device for clearing files. Background Art

[0002] With the development of science and technology, people can now build simulation systems to simulate actual work. After that, they only need to modify the parameters in the simulation system. Through continuous simulation of the simulation system, the optimal solution for the work can be determined, which greatly improves people's work efficiency.

[0003] During the simulation process of the simulation system, a large number of intermediate result files will be generated. For example, during circuit simulation, voltage will be simulated. During this simulation process, a large number of intermediate simulation voltage results will be generated as parameters are adjusted, which will take up a lot of storage space. Therefore, these intermediate result files need to be cleared. However, the existing method for clearing intermediate result files cannot clear the intermediate result files of a specified state according to the actual needs of users.

[0004] Therefore, how to more flexibly perform file clearing of intermediate result files in the simulation system to quickly release more storage space to ensure the execution efficiency of subsequent simulation tasks is an urgent problem to be solved. Summary of the invention

[0005] This specification provides a method, device, storage medium and electronic device for clearing files, so as to partially solve the above problems existing in the prior art.

[0006] This manual adopts the following technical solutions:

[0007] This manual provides a method for clearing files, including:

[0008] Get the configuration file;

[0009] Reading the configuration file to determine file screening rules and file time information, wherein the file time information is used to indicate a creation time range corresponding to the files to be cleared;

[0010] Determine the creation date of the file to be deleted according to the file time information;

[0011] Different threads are set for traversing tasks of files with different creation dates, and intermediate result file directories that meet the creation time range corresponding to the file time information are traversed in parallel through the set threads, wherein the intermediate result files in the intermediate result file directory are generated when executing the simulation task;

[0012] Determine the intermediate result files that meet the file screening rule from the intermediate result file directory as files to be cleared;

[0013] The files to be cleared are cleared.

[0014] Optionally, the configuration file includes a target file type, wherein the target file type is used to indicate a file type corresponding to the file to be cleared;

[0015] Determining the intermediate result files that meet the file screening rule from the intermediate result file directory as files to be cleared specifically includes:

[0016] For each intermediate result file in the intermediate result file directory, determining whether the file type of the intermediate result file belongs to the target file type;

[0017] If so, the intermediate result file is treated as a file to be cleared.

[0018] Optionally, determining the intermediate result files that meet the file screening rule from the intermediate result file directory as files to be cleared specifically includes:

[0019] The intermediate result files that meet the file screening rule and whose corresponding task status is the end status are determined from the intermediate result file directory as files to be cleared.

[0020] Optionally, the configuration file includes a file archiving directory;

[0021] The method further comprises:

[0022] Determine from the intermediate result file directory the intermediate result files that do not conform to the file screening rule and whose corresponding task status is the end status as the files to be retained;

[0023] The files to be retained are transferred to the storage space under the archive directory for storage.

[0024] Optionally, before transferring the to-be-retained files to the archive directory for storage, the method further includes:

[0025] Verify whether the archive directory in the configuration file is a real file directory in a specified system, where the specified system is used to store files generated by executing a simulation task;

[0026] If not, an archive directory is created in the specified system.

[0027] Optionally, the configuration file includes a maximum number of days for saving a file, wherein the maximum number of days for saving a file is used to determine the file time information;

[0028] Determine the creation date of the file to be deleted based on the file time information, including:

[0029] Verify whether the maximum number of days to save the file in the configuration file is a positive number;

[0030] If yes, determine the creation date of the file to be deleted according to the file time information;

[0031] If not, a prompt message is returned to prompt the user to reconfirm the configuration file.

[0032] Optionally, the configuration file includes a file base directory, wherein the file base directory is used to indicate the directory to which the files to be cleared belong;

[0033] Different threads are set for the traversal task of traversing files with different creation dates, and the intermediate result file directory that meets the creation time range corresponding to the file time information is traversed in parallel through the set threads, specifically including:

[0034] Different threads are set for traversing tasks of files with different creation dates, and through the set threads, the intermediate result file directory that meets the creation time range corresponding to the file time information is traversed in parallel from the file basic directory.

[0035] Optionally, before setting different threads for traversing the traversal tasks of files with different creation dates, and traversing the intermediate result file directories that match the creation time range corresponding to the file time information from the file base directory in parallel through the set threads, the method further includes:

[0036] Verify whether the file base directory in the configuration file is a real file directory in a specified system, where the specified system is used to store various files generated by executing the simulation task;

[0037] If not, a prompt message is returned to prompt the user to reconfirm the configuration file.

[0038] This specification provides a device for clearing files, including:

[0039] The acquisition module is used to obtain the configuration file;

[0040] A first determination module, used for reading the configuration file to determine a file screening rule and file time information, wherein the file time information is used for indicating a creation time range corresponding to the files to be cleared;

[0041] A second determination module is used to determine the creation date corresponding to the file to be deleted according to the file time information;

[0042] The third determination module is used to set different threads for traversing the traversal tasks of files with different creation dates, and traverse the intermediate result file directory that meets the creation time range corresponding to the file time information in parallel through the set threads, and the intermediate result files in the intermediate result file directory are generated when executing the simulation task;

[0043] A fourth determination module, used to determine the intermediate result files that meet the file screening rule from the intermediate result file directory as files to be cleared;

[0044] The clearing module is used to clear the files to be cleared.

[0045] Optionally, the configuration file includes a target file type, wherein the target file type is used to indicate a file type corresponding to the file to be cleared;

[0046] The fourth determination module is specifically used to determine, for each intermediate result file in the intermediate result file directory, whether the file type of the intermediate result file belongs to the target file type; if so, treat the intermediate result file as a file to be cleared.

[0047] Optionally, the fourth determination module is specifically used to determine, from the intermediate result file directory, intermediate result files that meet the file screening rule and whose corresponding task status is the end status as files to be cleared.

[0048] Optionally, the configuration file includes a file archiving directory;

[0049] The device also includes:

[0050] The archiving module is used to determine the intermediate result files that do not meet the file screening rules and whose corresponding task status is the end status from the intermediate result file directory as the files to be retained; and transfer the files to be retained to the storage space under the archiving directory for storage.

[0051] Optionally, the device further comprises:

[0052] The first verification module is used to verify whether the archive directory in the configuration file is a real file directory in a specified system before transferring the files to be retained to the archive directory for storage. The specified system is used to store the files generated by executing the simulation task; if not, an archive directory is created in the specified system.

[0053] Optionally, the configuration file includes a maximum number of days for saving a file, wherein the maximum number of days for saving a file is used to determine the file time information;

[0054] The second determination module is specifically used to determine the creation date corresponding to the file to be cleared based on the file time information, specifically including: checking whether the maximum number of days for saving the file in the configuration file is a positive number; if so, determining the creation date corresponding to the file to be cleared based on the file time information; if not, returning a prompt message to prompt reconfirmation of the configuration file.

[0055] Optionally, the configuration file includes a file base directory, wherein the file base directory is used to indicate the directory to which the files to be cleared belong;

[0056] The third determination module is specifically used to set different threads for traversing tasks of files with different creation dates, and through the set threads, traverse the intermediate result file directory that meets the creation time range corresponding to the file time information from the file base directory in parallel.

[0057] Optionally, the device further comprises:

[0058] The second verification module is used to set different threads for the traversal task of traversing files with different creation dates, and before traversing the intermediate result file directory that matches the creation time range corresponding to the file time information in parallel from the file base directory through the set threads, verify whether the file base directory in the configuration file is a real file directory in the specified system, and the specified system is used to store the files generated by executing the simulation task; if not, a prompt message is returned to prompt the configuration file to be reconfirmed.

[0059] This specification provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned file clearing method is implemented.

[0060] This specification provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned file clearing method when executing the program.

[0061] At least one of the above technical solutions adopted in this specification can achieve the following beneficial effects:

[0062] The file clearing method provided in the present specification obtains a configuration file, reads the configuration file to determine file screening rules and file time information, the file time information is used to indicate the creation time range corresponding to the files to be cleared, determines the creation date corresponding to the files to be cleared based on the file time information, sets different threads for traversal tasks of files with different creation dates, and traverses in parallel an intermediate result file directory that meets the creation time range corresponding to the file time information through the set threads, the intermediate result files in the intermediate result file directory are generated when executing simulation tasks, and determines the intermediate result files that meet the file screening rules from the intermediate result file directory as files to be cleared, and clears the files to be cleared.

[0063] It can be seen from the above method that when clearing files, the intermediate result files generated by the simulation system during task execution that meet the requirements of the configuration file can be cleared in parallel through multi-threading, thereby quickly freeing up more storage space and improving the task execution efficiency of the simulation system. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] The drawings described herein are used to provide a further understanding of this specification and constitute a part of this specification. The illustrative embodiments and descriptions of this specification are used to explain this specification and do not constitute an improper limitation on this specification. In the drawings:

[0065] Figure 1 A flowchart of a method for clearing files provided in this specification;

[0066] Figure 2 A schematic diagram of a file clearing device structure provided in this specification;

[0067] Figure 3 The corresponding Figure 1 Schematic diagram of the structure of an electronic device. DETAILED DESCRIPTION

[0068] In order to make the purpose, technical solutions and advantages of this specification more clear, the technical solutions of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this specification.

[0069] The technical solutions provided by the embodiments of this specification are described in detail below in conjunction with the accompanying drawings.

[0070] Figure 1A flowchart of a method for clearing files provided in this specification includes the following steps:

[0071] S101: Obtain a configuration file.

[0072] The execution subject of the file clearing method involved in this specification can be a terminal device such as a desktop computer, a laptop computer, or a server. The following only takes the terminal device as an example of the execution subject to illustrate the file clearing method in the embodiment of this specification.

[0073] In fact, in the process of executing simulation tasks through the simulation system, some intermediate result files may be generated. If these intermediate result files are not cleared in time, these intermediate result files will take up too much storage space, which may cause the execution efficiency of subsequent simulation tasks to be reduced. Therefore, the terminal device needs to clear these intermediate result files in time.

[0074] During the specific file clearing process, a configuration file can be input into the simulation system. The configuration file actually specifies the directory corresponding to the files to be cleared, the file types of the files to be cleared, and the time information of the files to be cleared, etc., which can be used as the basis for file clearing. Subsequently, the terminal device can obtain and read the configuration file to determine the content of the configuration file, and clear the above-mentioned intermediate result files according to the rules specified in the content.

[0075] In the specific implementation of this specification, the terminal device may first obtain a configuration file, and then, based on the configuration file, the terminal device may filter out files that meet the configuration file requirements from the storage space of the simulation system and clear the filtered files.

[0076] In this specification, the configuration file may specifically include the following contents: maximum number of days to save a file, target file type, file base directory, archive directory, etc.

[0077] The maximum number of days for file retention here can be used to determine the creation time range corresponding to the files to be cleared by the terminal device. The target file type can be used to indicate the file type corresponding to the files to be cleared by the terminal device. The file base directory can be used to indicate the directory corresponding to the files to be cleared by the terminal device in the specified system. The specified system here is used to store the files generated by executing simulation tasks, and the archive directory can be used to store files whose file types are not the target file types and whose status is unfinished.

[0078] For example, the content of the configuration file here can be shown in the following table.

[0079] Parameters Parameter Value Maximum number of days to save files 3 Base directory for intermediate file storage / home / simart / temp Archive Directory / home / simart / final Target file type (file suffix format) nl、cct

[0080] Table 1

[0081] It can be seen that the 3 days in the maximum file storage days in Table 1 indicates that the files to be cleared by the terminal device are files created 3 days ago, the nl and cct corresponding to the target file types indicate that the file types corresponding to the files to be cleared by the terminal device are nl and cct, / home / simart / temp is the file base directory, which is used to indicate the directory corresponding to the files to be cleared by the terminal device in the specified system, and the archive directory / home / simart / final indicates that when the terminal device clears files, it will move the files whose file types are not the target file types and whose task status is the end status to the storage location.

[0082] S102: Read the configuration file to determine file screening rules and file time information, where the file time information is used to indicate a creation time range corresponding to the files to be cleared.

[0083] S103: Determine the creation date corresponding to the file to be deleted according to the file time information.

[0084] In this specification, once the terminal device obtains the above configuration file, it can parse the configuration file and read the content in the configuration file.

[0085] In order to ensure the smooth execution of subsequent file clearing services, the terminal device can verify the content in the configuration file, specifically, the maximum number of days for file retention in the configuration file can be verified, that is, the terminal device can verify whether the maximum number of days for file retention in the configuration file is a positive number. If so, the creation date corresponding to the file to be cleared is determined based on the file time information. If not, a prompt message is returned to prompt the user to reconfirm the configuration file.

[0086] Afterwards, if the maximum number of days to save in the configuration file is a positive number, the terminal device can determine the file screening rule according to the target file type in the configuration file. Subsequently, the terminal device can perform file clearing according to the file type specified in the file screening rule, that is, the file type of the file to be cleared by the terminal device should belong to the file type specified in the file screening rule. While determining the file screening rule, the terminal device can also determine the creation time range corresponding to the files to be cleared according to the maximum number of days to save in the configuration file.

[0087] It should be noted that in the actual process, when determining the creation time range corresponding to the files that need to be cleared, in addition to determining it based on the maximum number of days the files are saved, the maximum execution time of the files in the system can also be considered. The maximum execution time of the files here can be used to indicate the longest time required for the simulation system to execute the simulation task. For a file, if the time from the creation time of the file to the current time has exceeded the maximum execution time of the file, it means that the simulation task corresponding to the file has been executed, and the file status corresponding to the file should be the end status and can be cleared.

[0088] Specifically, in order to improve the efficiency of file clearing, the terminal device will no longer clear the files that have been completed and cleared. Therefore, the terminal device can determine the end time of the creation time range corresponding to the files to be cleared based on the current date and the maximum number of days the files are kept. The terminal device can then determine the start time of the creation time range corresponding to the files to be cleared based on the end time and the maximum execution time of the above files. In this way, the terminal device can determine the creation time range corresponding to the files to be cleared based on the start time and the end time.

[0089] Continuing with the above example: the current date is November 14, 2022, 14:20, the maximum number of days for file storage is 3 days, 3 is a positive number, and the maximum execution time of the file is 7 days. When determining the creation time range corresponding to the files to be cleared, the terminal device can first determine that the end time of the creation time range is November 11, 2022 based on the current date, November 14, 2022, and the maximum number of days for file storage is 3 days. After that, the terminal device can determine that the start time of the creation time range is November 05, 2022 based on the end time and the maximum execution time of the file is 7 days. Then, based on the above start time and end time, the terminal device can determine the creation time range corresponding to the files to be cleared, that is, the creation date corresponding to the files to be cleared is November 05, 2022 to November 11, 2022.

[0090] In this way, the terminal device can flexibly clear files of a specified date and a specified file type during the file clearing process, which greatly enhances the flexibility of file clearing.

[0091] S104: different threads are set for traversal tasks of files with different creation dates, and intermediate result file directories that match the creation time range corresponding to the file time information are traversed in parallel through the set threads, wherein the intermediate result files in the intermediate result file directory are generated when executing the simulation task.

[0092] The terminal device can determine the creation date of the file to be deleted according to the creation time range determined above, and delete the file by traversing the files of each creation date.

[0093] In order to improve the efficiency of file clearing, the terminal device may set a thread for the traversal task of traversing files of each creation date, and subsequently, the terminal device may perform file clearing in parallel with multiple threads.

[0094] In addition, the terminal device can also verify the file base directory in the configuration file to ensure the smooth execution of subsequent file clearing services, that is, the terminal device can verify whether the file base directory in the configuration file is the real file directory in the specified system. If not, a prompt message is returned to prompt the configuration file to be reconfirmed.

[0095] If the terminal device can determine that the file base directory in the configuration file is the real file directory in the specified system, the terminal device can set different threads for the traversal task of traversing files with different creation dates, and through the set threads, traverse the intermediate result file directory that matches the creation time range corresponding to the file time information from the file base directory in parallel.

[0096] Continuing with the above example, whether the file base directory in the configuration file is the real file directory in the specified system, and the creation date corresponding to the files to be cleared is from November 5, 2022 to November 11, 2022, then the terminal device can set different threads for the traversal task of traversing files with a creation date of 20221105, the traversal task of traversing files with a creation date of November 6, 2022, and so on, and traverse the files with a creation date of November 5, 2022, and through the set threads, traverse in parallel to obtain the intermediate result file directory that meets the creation time range corresponding to each thread. For one of the traversal tasks, in the traversal task of the file created on November 5, 2022, it can be determined that the intermediate result file directory is / home / simart / temp / 20221105, and the intermediate result files in the intermediate result file directory include: task0001.json, task0001.json.nl, task0001.json.cct, task0002.json, task0002.json.nl, task0002.cct.

[0097] S105: Determine the intermediate result files that meet the file screening rule from the intermediate result file directory as files to be cleared.

[0098] S106: Clear the files to be cleared.

[0099] Specifically, the terminal device may determine, for each intermediate result file in the intermediate result file directory, whether the file type of the intermediate result file belongs to the target file type, and if so, the intermediate result file is treated as a file to be cleared.

[0100] However, in the actual file clearing process, in order to ensure the normal execution of the simulation task being executed, the files being executed cannot be cleared. Therefore, the terminal device needs to ensure that the task status corresponding to the file to be cleared is the end status. Therefore, the terminal device needs to determine from the intermediate result file directory the intermediate result file that meets the file screening rules (that is, the file type belongs to the target file type) and the corresponding task status is the end status as the file to be cleared.

[0101] After determining the files to be cleared, the terminal device can clear the files to be cleared.

[0102] In addition, the terminal device may also verify whether the archive directory in the configuration file is a real file directory in the specified system, and if not, create the archive directory in the specified system.

[0103] Afterwards, the terminal device can determine from the intermediate result file directory the intermediate result files that do not meet the file screening rules (i.e., the file type does not belong to the target file type) and whose corresponding task status is the end status as files to be retained, and transfer the files to be retained to the storage space under the archive directory for storage.

[0104] Continuing with the above example, the intermediate result files include: task0001.json, task0001.json.nl, task0001.json.cct, task0002.json, task0002.json.nl, task0002.cct. The archive directory in the configuration file is the real file directory in the specified system, and the file type, file creation time, number of days the file has been retained, and task status of these intermediate result files are shown in the following table:

[0105] The contents of the configuration file here can be shown in the following table.

[0106]

[0107] Table 2

[0108]

[0109] Table 3

[0110] It can be seen that for the intermediate result file task0001.json.nl, the file type is nl. Obviously, the file type nl meets the file screening rule (that is, the file type nl belongs to the target file type: nl, cct), and the task status is ended, then the intermediate result file task0001.json.nl can be used as a file to be cleared. Similarly, task0001.json.cct can also be used as a file to be cleared, and the terminal device can clear the file to be cleared.

[0111] Although the file types of task0002.json.nl and task0002.cct meet the file screening rules, the task status of these two files is solving rather than ending, so these two files cannot be used as files to be cleared.

[0112] Furthermore, since the file types of task0001.json and task0002.json are json, the file types of these two files do not meet the file screening rules (that is, the file type of json does not belong to the target file type: nl, cct), so these two files cannot be used as files to be cleared.

[0113] However, because the task status of task0001.json is ended and the file type does not meet the file screening rule, the terminal device can use the intermediate result file task0001.json as a file to be retained, and transfer the file to be retained to the storage space under the archive directory for storage.

[0114] It should be noted that in this specification, the terminal device can verify all contents in the configuration file when reading the configuration file. Only after determining that the configuration file has passed the verification, the terminal device will determine the file screening rules and file time information according to the contents in the read configuration file, and execute the subsequent remaining file clearing steps.

[0115] Specifically, after obtaining the configuration file, the terminal device may first verify the configuration file, wherein the configuration file may be verified at the following levels:

[0116] The terminal device needs to verify the maximum number of days to save and the file base directory in the configuration file. Only when the maximum number of days to save is a positive number and the file base directory is the real file directory in the specified system, the terminal device will continue to perform the subsequent file clearing business. Otherwise, the terminal device will return a prompt message to prompt reconfirmation of the configuration file. In addition, the terminal device can also verify the archive directory. When the archive directory is not the real file directory in the specified system, the terminal device needs to create the archive directory in the specified system.

[0117] It can be seen from the above method that in addition to specifying the file type of the file to be cleared, the configuration file also specifies the status of the file to be cleared. This means that during the file clearing process, in addition to clearing files of the specified file type, the status of the files to be cleared will be guaranteed to be the end state, so that the files being executed will not be cleared by mistake, which enhances the security of the file clearing process. Moreover, by clearing the intermediate result files that meet the requirements of the configuration file generated by the simulation system during the task execution process in a multi-threaded parallel manner, more storage space can be released more quickly, thereby improving the task execution efficiency of the simulation system.

[0118] The above are one or more implementation methods of this specification. Based on the same idea, this specification also provides a corresponding file clearing device, such as Figure 2 shown.

[0119] Figure 2 A schematic diagram of a file clearing device provided in this specification includes:

[0120] An acquisition module 201 is used to acquire a configuration file;

[0121] A first determination module 202, configured to read the configuration file to determine a file screening rule and file time information, wherein the file time information is used to indicate a creation time range corresponding to the files to be cleared;

[0122] The second determination module 203 is used to determine the creation date corresponding to the file to be deleted according to the file time information;

[0123] The third determination module 204 is used to set different threads for traversing the traversal tasks of files with different creation dates, and traverse the intermediate result file directory that meets the creation time range corresponding to the file time information in parallel through the set threads, and the intermediate result files in the intermediate result file directory are generated when executing the simulation task;

[0124] The fourth determining module 205 is used to determine the intermediate result files that meet the file screening rule from the intermediate result file directory as files to be cleared;

[0125] The clearing module 206 is used to clear the files to be cleared.

[0126] Optionally, the configuration file includes a target file type, wherein the target file type is used to indicate the file type corresponding to the file to be cleared; the fourth determination module 205 is specifically used to determine, for each intermediate result file in the intermediate result file directory, whether the file type of the intermediate result file belongs to the target file type; if so, the intermediate result file is treated as a file to be cleared.

[0127] Optionally, the fourth determining module 205 is specifically configured to determine, from the intermediate result file directory, intermediate result files that meet the file screening rule and whose corresponding task status is the end status as files to be cleared.

[0128] Optionally, the configuration file includes a file archiving directory;

[0129] The device also includes:

[0130] The archiving module 207 is used to determine the intermediate result files that do not meet the file screening rules and whose corresponding task status is the end status from the intermediate result file directory as the files to be retained; and transfer the files to be retained to the storage space under the archiving directory for storage.

[0131] Optionally, the device further comprises:

[0132] The first verification module 208 is used to verify whether the archive directory in the configuration file is a real file directory in a specified system before transferring the files to be retained to the archive directory for storage. The specified system is used to store the files generated by executing the simulation task; if not, an archive directory is created in the specified system.

[0133] Optionally, the configuration file includes a maximum number of days for file retention, wherein the maximum number of days for file retention is used to determine the file time information; the second determination module 203 is specifically used to verify whether the maximum number of days for file retention in the configuration file is a positive number; if so, determine the creation date corresponding to the file to be cleared based on the file time information; if not, return a prompt message to prompt reconfirmation of the configuration file.

[0134] Optionally, the configuration file includes a file base directory, wherein the file base directory is used to indicate the directory to which the files to be cleared belong; the third determination module 204 is specifically used to set different threads for traversal tasks of files with different creation dates, and through the set threads, traverse the intermediate result file directory that matches the creation time range corresponding to the file time information in parallel from the file base directory.

[0135] Optionally, the device further comprises:

[0136] The second verification module 209 is used to set different threads for the traversal task of traversing files with different creation dates, and before traversing the intermediate result file directory that matches the creation time range corresponding to the file time information in parallel from the file base directory through the set threads, verify whether the file base directory in the configuration file is a real file directory in the specified system, and the specified system is used to store the files generated by executing the simulation task; if not, a prompt message is returned to prompt to reconfirm the configuration file.

[0137] This specification also provides a computer-readable storage medium, which stores a computer program, which can be used to execute the above Figure 1 Provides a method for clearing files.

[0138] This manual also provides Figure 3 The one shown corresponds to Figure 1 A schematic diagram of the electronic device. Figure 3 As shown, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 1 The method of clearing the files.

[0139] Of course, in addition to software implementation, this specification does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the executor of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0140] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.

[0141] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.

[0142] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0143] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0144] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0145] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0146] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0147] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0148] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0149] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0150] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0151] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0152] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0153] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0154] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0155] The above description is only an embodiment of the present specification and is not intended to limit the present specification. For those skilled in the art, the present specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification shall be included in the scope of the claims of the present specification.

Claims

1. A method for clearing files, characterized in that: The method comprises: Get the configuration file; Read the configuration file to determine the file screening rule, and determine the file time information according to the maximum number of days for saving the file, the maximum execution time of the file and the current time contained in the configuration file, wherein the file time information is used to indicate the creation time range corresponding to the file to be cleared, wherein the end time of the creation time range is determined according to the current time and the maximum number of days for saving the file, and the start time of the creation time range is determined according to the current time and the maximum execution time of the file, and the creation time range is determined according to the start time and the end time; Determine the creation date of the file to be deleted according to the file time information; Different threads are set for traversing tasks of files with different creation dates, and intermediate result file directories that meet the creation time range corresponding to the file time information are traversed in parallel through the set threads, wherein the intermediate result files in the intermediate result file directory are generated when executing the simulation task; Determine the intermediate result files that meet the file screening rule from the intermediate result file directory as files to be cleared; The files to be cleared are cleared.

2. The method according to claim 1, characterized in that The configuration file includes a target file type, wherein the target file type is used to indicate the file type corresponding to the file to be cleared; Determining the intermediate result files that meet the file screening rule from the intermediate result file directory as files to be cleared specifically includes: For each intermediate result file in the intermediate result file directory, determining whether the file type of the intermediate result file belongs to the target file type; If so, the intermediate result file is treated as a file to be cleared.

3. The method according to claim 2, characterized in that Determining the intermediate result files that meet the file screening rule from the intermediate result file directory as files to be cleared specifically includes: The intermediate result files that meet the file screening rule and whose corresponding task status is the end status are determined from the intermediate result file directory as files to be cleared.

4. The method according to claim 3, characterized in that The configuration file includes a file archiving directory; The method further comprises: Determine from the intermediate result file directory the intermediate result files that do not conform to the file screening rule and whose corresponding task status is the end status as the files to be retained; The files to be retained are transferred to the storage space under the archive directory for storage.

5. The method according to claim 4, characterized in that Before transferring the to-be-retained files to the archive directory for storage, the method further includes: Verify whether the archive directory in the configuration file is a real file directory in a specified system, where the specified system is used to store files generated by executing a simulation task; If not, an archive directory is created in the specified system.

6. The method according to claim 1, characterized in that The configuration file includes the maximum number of days for saving the file, wherein the maximum number of days for saving the file is used to determine the time information of the file; Determine the creation date of the file to be deleted based on the file time information, including: Verify whether the maximum number of days to save the file in the configuration file is a positive number; If yes, determine the creation date of the file to be deleted according to the file time information; If not, a prompt message is returned to prompt the user to reconfirm the configuration file.

7. The method according to claim 1, characterized in that The configuration file includes a file base directory, wherein the file base directory is used to indicate the directory to which the files to be cleared belong; Different threads are set for the traversal task of traversing files with different creation dates, and the intermediate result file directory that meets the creation time range corresponding to the file time information is traversed in parallel through the set threads, specifically including: Different threads are set for traversing tasks of files with different creation dates, and through the set threads, the intermediate result file directory that meets the creation time range corresponding to the file time information is traversed in parallel from the file basic directory.

8. The method according to claim 7, characterized in that Before setting different threads for traversing files with different creation dates, and traversing the intermediate result file directories that match the creation time range corresponding to the file time information from the file base directory in parallel through the set threads, the method further includes: Verify whether the file base directory in the configuration file is a real file directory in a specified system, where the specified system is used to store various files generated by executing the simulation task; If not, a prompt message is returned to prompt the user to reconfirm the configuration file.

9. A device for clearing files, characterized in that: include: The acquisition module is used to obtain the configuration file; A first determination module is used to read the configuration file to determine the file screening rules, and determine the file time information according to the maximum number of days for saving the file, the maximum execution time of the file and the current time contained in the configuration file, wherein the file time information is used to indicate the creation time range corresponding to the file to be cleared, wherein the end time of the creation time range is determined according to the current time and the maximum number of days for saving the file, and the start time of the creation time range is determined according to the current time and the maximum execution time of the file, and the creation time range is determined according to the start time and the end time; A second determination module is used to determine the creation date corresponding to the file to be deleted according to the file time information; The third determination module is used to set different threads for traversing the traversal tasks of files with different creation dates, and traverse the intermediate result file directory that meets the creation time range corresponding to the file time information in parallel through the set threads, and the intermediate result files in the intermediate result file directory are generated when executing the simulation task; A fourth determining module, used to determine the intermediate result files that meet the file screening rule from the intermediate result file directory as files to be cleared; The clearing module is used to clear the files to be cleared.

10. The device according to claim 9, characterized in that The configuration file includes a target file type, wherein the target file type is used to indicate the file type corresponding to the file to be cleared; The fourth determination module is specifically used to determine, for each intermediate result file in the intermediate result file directory, whether the file type of the intermediate result file belongs to the target file type; if so, treat the intermediate result file as a file to be cleared.

11. The device according to claim 10, characterized in that The fourth determination module is specifically used to determine, from the intermediate result file directory, intermediate result files that meet the file screening rule and whose corresponding task status is the end status as files to be cleared.

12. The device according to claim 11, characterized in that The configuration file includes a file archiving directory; The device also includes: The archiving module is used to determine the intermediate result files that do not meet the file screening rules and whose corresponding task status is the end status from the intermediate result file directory as the files to be retained; and transfer the files to be retained to the storage space under the archiving directory for storage.

13. The device according to claim 12, characterized in that The device also includes: The first verification module is used to verify whether the archive directory in the configuration file is a real file directory in a specified system before transferring the files to be retained to the archive directory for storage. The specified system is used to store the files generated by executing the simulation task; if not, an archive directory is created in the specified system.

14. The device according to claim 9, characterized in that The configuration file includes the maximum number of days for saving the file, wherein the maximum number of days for saving the file is used to determine the time information of the file; The second determination module is specifically used to determine the creation date corresponding to the file to be cleared based on the file time information, specifically including: checking whether the maximum number of days for saving the file in the configuration file is a positive number; if so, determining the creation date corresponding to the file to be cleared based on the file time information; if not, returning a prompt message to prompt reconfirmation of the configuration file.

15. The device according to claim 9, characterized in that The configuration file includes a file base directory, wherein the file base directory is used to indicate the directory to which the files to be cleared belong; The third determination module is specifically used to set different threads for traversing tasks of files with different creation dates, and through the set threads, traverse the intermediate result file directory that meets the creation time range corresponding to the file time information from the file base directory in parallel.

16. The device according to claim 15, characterized in that The device also includes: The second verification module is used to set different threads for the traversal task of traversing files with different creation dates, and before traversing the intermediate result file directory that matches the creation time range corresponding to the file time information in parallel from the file base directory through the set threads, verify whether the file base directory in the configuration file is a real file directory in the specified system, and the specified system is used to store the files generated by executing the simulation task; if not, a prompt message is returned to prompt the configuration file to be reconfirmed.

17. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.

18. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 8 is implemented.