Storage method, device, electronic device and storage medium for different vehicle-side data
By dividing directories and distributing data based on the recording time of vehicle-side data, the problem of low storage efficiency of cloud platforms is solved, and efficient data storage and fast query are achieved.
Patent Information
- Application Number
- CN202411268467.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2024-12-10
- Estimated Expiration
- 2044-09-11
AI Technical Summary
When storing data from different vehicle ends, existing cloud platforms directly partition storage according to the frame number, resulting in large consumption of storage resources, reduced response speed and low efficiency.
Determine the initial directory file based on the recording time of the vehicle end data, divide the time interval by preset intervals, store the data of the same vehicle identity identification on the same initial directory file, and distribute it to the target directory file, reduce the number of files and improve query efficiency .
It achieves the efficiency of data storage, reduces the number of file writes, improves the response speed, and facilitates the quick query of vehicle side data corresponding to vehicle identity identification.
Smart Images

Figure CN118796785B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of vehicle technology, specifically to a method, device, electronic device, and storage medium for storing different vehicle-side data. Background Technology
[0002] Currently, to facilitate the querying of data from different vehicles, cloud platforms store data in real-time by partitioning based on the vehicle identification number (VIN). This means that data from vehicles with the same VIN is written to the same file. This storage method consumes a lot of storage resources. If there is data from multiple vehicles with different VINs, multiple files need to be opened simultaneously for data writing. When the file handle data reaches a certain value, it will affect the response speed of the storage process, resulting in reduced data storage efficiency. Summary of the Invention
[0003] In view of the above problems, this application provides a method, apparatus, electronic device and storage medium for storing different vehicle-side data, for classifying and storing data from different vehicle-side devices, so as to improve the efficiency of data storage.
[0004] According to one aspect of this application, a method for storing different vehicle-end data is provided. The storage method includes: determining an initial directory file for storing each vehicle-end data based on the recording time of each vehicle-end data; wherein the initial first-level directory to which the initial directory file belongs is the data recording date, and the initial second-level directory to which it belongs is a specified time interval, the initial second-level directory being a directory corresponding to a time interval divided for a single day according to a preset interval duration; storing each vehicle-end data into the corresponding initial directory file, so that each initial directory file stores vehicle-end data corresponding to different vehicle identifiers within the corresponding specified time interval; wherein vehicle-end data corresponding to the same vehicle identifier is stored in the same initial directory file; distributing the vehicle-end data corresponding to the same vehicle identifier in each initial directory file to corresponding target directory files, so that each target directory file stores vehicle-end data corresponding to the same vehicle identifier with the same data recording date; wherein the first-level directory to which the target directory file belongs is the data recording date, and the second-level directory to which it belongs is the vehicle identifier.
[0005] In one optional approach, distributing vehicle-end data corresponding to the same vehicle identity in each initial directory file to the corresponding target directory file further includes: merging the vehicle-end data corresponding to the same vehicle identity in each initial directory file to obtain multiple merged vehicle-end data; determining corresponding distribution threads based on the vehicle identity corresponding to each merged vehicle-end data, and distributing the multiple merged vehicle-end data to the corresponding target directory files based on their respective distribution threads; wherein different distribution threads correspond to different target directory files.
[0006] In one optional approach, merging vehicle-end data corresponding to the same vehicle identifier in each initial directory file to obtain multiple merged vehicle-end data further includes: traversing each piece of vehicle-end data in each initial directory file and using the traversed vehicle-end data as target vehicle-end data; if the vehicle identifier corresponding to the target vehicle-end data is a historical vehicle identifier, then merging the target vehicle-end data into the historical vehicle-end data corresponding to the historical vehicle identifier; wherein, the historical vehicle identifier is the vehicle identifier corresponding to the traversed vehicle-end data; if the vehicle identifier corresponding to the target vehicle-end data is not the historical vehicle identifier, then using the target vehicle-end data as new historical vehicle-end data for merging vehicle-end data corresponding to the same vehicle identifier.
[0007] In one optional approach, determining the corresponding distribution thread based on the vehicle identity identifier corresponding to each merged vehicle data, and distributing the multiple merged vehicle data to the corresponding target directory file based on their respective distribution threads, further includes: generating a corresponding number of distribution threads based on the number of different vehicle identity identifiers corresponding to the multiple merged vehicle data; and distributing each merged vehicle data to the corresponding target directory file through the corresponding number of distribution threads.
[0008] In one optional approach, determining the corresponding distribution thread based on the vehicle identifier corresponding to each merged vehicle data, and distributing the multiple merged vehicle data to the corresponding target directory file based on their respective distribution threads, further includes: determining the number of vehicle identifiers corresponding to each distribution thread based on the number of different vehicle identifiers corresponding to the multiple merged vehicle data and a preset number of distribution threads; distributing the vehicle data corresponding to their respective number of vehicle identifiers to the corresponding target directory file through each distribution thread; wherein, the vehicle identifiers corresponding to each distribution thread are different.
[0009] In one optional approach, the recording time includes the recording date and the recording time; determining the initial directory file for storing each vehicle-end data based on the recording time of each vehicle-end data further includes: matching the recording date of each vehicle-end data with the preset data recording date corresponding to the initial first-level directory to obtain the preset data recording date that is successfully matched; and determining the initial directory file for storing each vehicle-end data in the initial second-level directory under the preset data recording date that is successfully matched, based on the recording time of each vehicle-end data.
[0010] In one alternative approach, the storage method further includes: dividing the duration of a single day by a preset interval duration, and constructing a corresponding number of initial second-level directories based on the calculated quotient, so that the number of initial second-level directories under each initial first-level directory is the same.
[0011] According to another aspect of this application, a storage device for different vehicle-end data is provided. The storage device includes: a determining module, configured to determine an initial directory file for storing each vehicle-end data based on the recording time of each vehicle-end data; wherein the initial first-level directory to which the initial directory file belongs is the data recording date, and the initial second-level directory to which it belongs is a specified time interval, the initial second-level directory being a directory corresponding to a time interval divided for a single day according to a preset interval duration; an initial storage module, configured to store each vehicle-end data into a corresponding initial directory file, so that each initial directory file stores vehicle-end data corresponding to different vehicle identifiers within a corresponding specified time interval; wherein vehicle-end data corresponding to the same vehicle identifier is stored in the same initial directory file; and a target storage module, configured to distribute vehicle-end data corresponding to the same vehicle identifier in each initial directory file to corresponding target directory files, so that each target directory file stores vehicle-end data corresponding to the same vehicle identifier with the same data recording date; wherein the first-level directory to which the target directory file belongs is the data recording date, and the second-level directory to which it belongs is the vehicle identifier.
[0012] According to one aspect of this application, an electronic device is provided, comprising: a controller; and a memory for storing one or more programs, which, when executed by the controller, perform the storage method described above.
[0013] According to one aspect of this application, a computer-readable storage medium is also provided, on which computer-readable instructions are stored, which, when executed by a computer's processor, cause the computer to perform the storage method described above.
[0014] According to one aspect of this application, a computer program product or computer program is also provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the storage method described above.
[0015] This application can classify and buffer the data from each vehicle in real time according to the recording time, storing it in an initial directory file within the corresponding initial second-level directory. The initial second-level directory is a directory corresponding to a time interval defined by a preset interval for each day, rather than a separate storage directory for different VINs. Compared to storage methods that directly classify data based on VIN, this reduces the number of files written to. This application distributes the vehicle data corresponding to the same vehicle identification number in each initial directory file to the corresponding target directory files. This ensures that each target directory file stores vehicle data corresponding to the same vehicle identification number with the same data recording date. Simultaneously, the final storage second-level directory contains only one file storing the vehicle data corresponding to a specific vehicle identification number, facilitating quick retrieval of the corresponding vehicle data.
[0016] The above description is merely an overview of the technical solutions of the embodiments of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0017] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0018] Figure 1 This is a flowchart illustrating a method for storing different vehicle-side data, as shown in an exemplary embodiment of this application.
[0019] Figure 2 This is a schematic diagram illustrating the initial directory system of an exemplary embodiment of this application.
[0020] Figure 3 Based on Figure 1 The exemplary embodiment shown illustrates a flowchart of another method for storing different vehicle-side data.
[0021] Figure 4 Based on Figure 3 The exemplary embodiment shown illustrates a flowchart of another method for storing different vehicle-side data.
[0022] Figure 5 This is a schematic diagram illustrating the application scenarios of different vehicle-side data storage methods in this application.
[0023] Figure 6This is a schematic diagram illustrating a distribution process according to an exemplary embodiment of this application.
[0024] Figure 7 This is a schematic diagram of the structure of a storage device for different vehicle-end data, as illustrated in an exemplary embodiment of this application.
[0025] Figure 8 This is a schematic diagram of the structure of a computer system for an electronic device, as illustrated in an exemplary embodiment of this application. Detailed Implementation
[0026] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0027] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0028] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0029] In this application, "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0030] To facilitate the querying of data from different vehicles, existing cloud platforms store data in real-time by partitioning based on the vehicle identification number (VIN). This means that data from vehicles with the same VIN is written to the same file. This storage method consumes a lot of storage resources. If there is data from multiple vehicles with different VINs, multiple files need to be opened simultaneously for data writing. When the file handle data reaches a certain value, it will affect the response speed of the storage process, resulting in reduced data storage efficiency.
[0031] To address this, one aspect of this application provides a method for storing data from different vehicle terminals. While ensuring convenient querying, this method improves the storage efficiency of different vehicle terminal data. Please refer to [link / reference] for details. Figure 1 , Figure 1 This is a flowchart illustrating an exemplary embodiment of a method for storing different vehicle-side data. The storage method includes at least steps S110 to S130, which are described in detail below:
[0032] S110: Determine the initial directory file for storing the data of each vehicle terminal based on the recording time of each vehicle terminal data; wherein, the initial first-level directory to which the initial directory file belongs is the data recording date, and the initial second-level directory to which it belongs is the specified time interval. The initial second-level directory is the directory corresponding to the time interval obtained by dividing a single day according to the preset interval duration.
[0033] Each piece of vehicle-side data corresponds to a specific recording time, including but not limited to the date and time of recording. Additionally, each piece of vehicle-side data corresponds to a unique vehicle identifier, used to identify the vehicle from which the data originated. This vehicle identifier can be a vehicle identification number (VIN) or other identifiers that identify the vehicle.
[0034] The initial directory file is a file set under the initial second-level directory. Please refer to [link / reference]. Figure 2 , Figure 2 This is a schematic diagram of an initial directory system illustrated in an exemplary embodiment of this application. The initial first-level directory represents the data recording date. Each initial first-level directory has multiple initial second-level directories, and the number of initial second-level directories under each initial first-level directory is the same. Each initial second-level directory corresponds to a time interval, which is the directory corresponding to the time interval divided for a single day.
[0035] For example, vehicle data A is recorded at 10:00 AM on August 1, 2024. An initial first-level directory is determined based on August 1, 2024, and an initial second-level directory is determined under this initial first-level directory based on 10:00 AM. Vehicle data A is then stored in the initial directory files within the corresponding initial second-level directories. The number of files in each initial second-level directory can be adaptively adjusted according to the specific scenario, or it can be a fixed number, or it can be related to the number of different vehicle identification identifiers. For example, one initial directory file can be set up for 10 different vehicle identification identifiers.
[0036] In another exemplary embodiment, the construction of the initial second-level directory is illustrated as follows:
[0037] Divide the daily duration by the preset interval duration, and construct the corresponding number of initial second-level directories based on the calculated quotient, so that the number of initial second-level directories under each initial first-level directory is the same.
[0038] The units for daily duration and preset interval duration can be unified, such as hourly units or minute units. This embodiment does not limit them.
[0039] For example, if the preset interval is 5 minutes, then 24 hours × 60 minutes ÷ 5 minutes = 288, meaning that 288 initial second-level directories will be built under each initial first-level directory.
[0040] S120: Store the data of each vehicle terminal to the corresponding initial directory file, so that each initial directory file stores the vehicle terminal data corresponding to different vehicle identifications within the specified time interval; wherein, the vehicle terminal data corresponding to the same vehicle identification is stored in the same initial directory file.
[0041] In this embodiment, a single initial directory file does not store only vehicle-side data corresponding to a single vehicle identifier; it can store vehicle-side data corresponding to multiple different vehicle identifiers simultaneously. However, provided that the data recording date is the same, vehicle-side data for the same vehicle identifier is stored in the same initial directory file to facilitate quick retrieval of all vehicle-side data corresponding to a particular vehicle identifier at any given recording time.
[0042] It is worth noting that the initial directory file in this embodiment can be understood as a temporary storage file during the buffer storage process, rather than the final storage file of the data from each vehicle.
[0043] S130: Distribute the vehicle-side data corresponding to the same vehicle identity in each initial directory file to the corresponding target directory file, so that each target directory file stores the vehicle-side data corresponding to the same vehicle identity with the same data recording date; wherein, the first-level directory to which the target directory file belongs is the data recording date, and the second-level directory to which it belongs is the vehicle identity.
[0044] This embodiment can distribute data in each initial directory file simultaneously, that is, distribute the various directory files under the initial second-level directory in parallel. Taking each initial directory file as a unit, the vehicle-end data in it is distributed to different target directory files according to the vehicle identification, so that the vehicle-end data with the same data recording date and the same vehicle identification are aggregated and stored in the same target directory file, thus completing the final storage of each vehicle-end data.
[0045] This embodiment can classify and buffer the data from each vehicle in real time according to the recording time, storing it in the corresponding initial directory file within the initial second-level directory. The initial second-level directory is a directory corresponding to a time interval defined by a preset interval for each day, rather than a separate storage directory for different VINs. Compared to storage methods that directly classify data based on VIN, this reduces the number of files written to. This embodiment distributes the vehicle data corresponding to the same vehicle identification number in each initial directory file to the corresponding target directory file. This ensures that each target directory file stores vehicle data corresponding to the same vehicle identification number with the same data recording date. Simultaneously, the final stored second-level directory contains only one file for storing vehicle data corresponding to a specific vehicle identification number, facilitating quick retrieval of the corresponding vehicle data.
[0046] In another exemplary embodiment of this application, it is described in detail how to distribute vehicle-side data corresponding to the same vehicle identity in each initial directory file to the corresponding target directory file. Please refer to [link / reference needed] for details. Figure 3 , Figure 3 Based on Figure 1 The exemplary embodiment shown illustrates a flowchart of another method for storing different vehicle-side data. This storage method, in... Figure 1 The S130 shown further includes S310 to S320, which are described in detail below:
[0047] S310: Merge the vehicle-side data corresponding to the same vehicle identity in each initial directory file to obtain multiple merged vehicle-side data.
[0048] The merged vehicle-side data all correspond to the same data record date and the same vehicle identification number. Merging can be understood as packaging and encapsulating multiple specified data sets into a single unit to reduce the number of processing objects and optimize the processing.
[0049] S320: Based on the vehicle identity identifier corresponding to each merged vehicle data, determine the corresponding distribution thread, and distribute the multiple merged vehicle data to the corresponding target directory file based on their respective distribution threads; wherein, different distribution threads correspond to different target directory files.
[0050] The distribution thread is the thread that distributes the corresponding vehicle-side data to the corresponding target directory file. In this embodiment, different distribution threads are used to distribute multiple merged vehicle-side data. Compared with a single thread, multiple threads can process in parallel and are relatively independent, which improves the distribution efficiency to a certain extent.
[0051] The distribution thread settings can be adjusted according to the actual situation. Two examples are introduced below:
[0052] For example, based on the number of different vehicle identifiers corresponding to multiple merged vehicle data, a corresponding number of distribution threads are generated; and the merged vehicle data is distributed to the corresponding target directory file through the corresponding number of distribution threads.
[0053] For example, if there are 100 different vehicle identification identifiers, 100 distribution threads are used for data distribution to ensure that each distribution thread distributes vehicle-side data for the same vehicle identification identifier. This ensures that the vehicle-side data for each vehicle identification identifier is processed in a targeted manner, and all vehicle-side data can be distributed simultaneously and in parallel.
[0054] In another example, based on the number of different vehicle identifiers corresponding to multiple merged vehicle data and a preset number of distribution threads, the number of vehicle identifiers corresponding to each distribution thread is determined; the vehicle data corresponding to the corresponding number of vehicle identifiers is distributed to the corresponding target directory file through each distribution thread; wherein, the vehicle identifiers corresponding to each distribution thread are different.
[0055] For example, if there are 100 different vehicle identifiers and 10 preset distribution threads, using these threads for even distribution allows each thread to distribute vehicle data for 10 different identifiers, thus distributing all vehicle data in parallel for rapid completion. Alternatively, 10 parallel distribution processes can be performed. In each process, each distribution thread distributes vehicle data corresponding to one vehicle identifier, achieving parallel distribution of 10 different vehicle identifiers per cycle. This method allows for batch parallel distribution when dealing with large datasets to complete data classification.
[0056] This embodiment merges the vehicle-side data corresponding to the same vehicle identity in each initial directory file, and completes the distribution operation of the merged vehicle-side data based on the corresponding distribution thread, thereby quickly completing the classification and storage of vehicle-side data.
[0057] In another exemplary embodiment of this application, it is described in detail how to merge the vehicle-side data corresponding to the same vehicle identity in each initial directory file to obtain multiple merged vehicle-side data sets. Please refer to [link / reference] for details. Figure 4 , Figure 4 Based on Figure 3 The exemplary embodiment shown illustrates a flowchart of another method for storing different vehicle-side data. This storage method, in... Figure 3 The S310 shown further includes S410 to S430, which are described in detail below:
[0058] S410: Traverse each vehicle-side data in each initial directory file and use the traversed vehicle-side data as the target vehicle-side data.
[0059] This embodiment uses a traversal approach to ensure that all vehicle-side data in each initial directory file are merged without omission.
[0060] S420: If the vehicle identifier corresponding to the target vehicle data is a historical vehicle identifier, then the target vehicle data will be merged into the historical vehicle data corresponding to the historical vehicle identifier; wherein, the historical vehicle identifier is the vehicle identifier corresponding to the vehicle data that has been traversed.
[0061] The vehicle identification identifier is a historical vehicle identification identifier, indicating that the corresponding vehicle-side data has already been merged into a dataset. Therefore, there is no need to create a new dataset; the traversed vehicle-side data can be directly merged into the corresponding historical vehicle-side data.
[0062] S430: If the vehicle identification number corresponding to the target vehicle identification number is not a historical vehicle identification number, the target vehicle identification number will be used as new historical vehicle identification number for merging vehicle identification number corresponding to the same vehicle identification number.
[0063] If the vehicle identification is not a historical vehicle identification, it means that the vehicle-side data corresponding to this vehicle identification has not been merged before. Therefore, a new set of historical vehicle-side data needs to be established to merge the vehicle-side data corresponding to the current vehicle identification, so as to facilitate the rapid merging of vehicle-side data with the same vehicle identification in the future.
[0064] This embodiment uses a traversal approach, which ensures that all vehicle-side data in each initial directory file are merged without omission, thereby accurately obtaining multiple merged vehicle-side data.
[0065] In another exemplary embodiment of this application, it is described in detail how to determine the initial directory file for storing each vehicle-end data based on the recording time of each vehicle-end data, that is, S111 to S112 are further included in the above S110; wherein, the recording time includes the recording date and the recording time, as detailed below:
[0066] S111: Match the recording date of each vehicle terminal data with the preset data recording date corresponding to the initial first-level directory to obtain the preset data recording date that is successfully matched.
[0067] S112: Based on the recording time of each vehicle terminal data, determine the initial directory file for storing each vehicle terminal data in the initial second-level directory under the preset data recording date that was successfully matched.
[0068] Referring to Table 1, the recording date of vehicle data B is August 2, 2024, and the recording time is 01:00. The preset data recording date 20240802 that matches it is determined in Table 1, and the initial second-level directory 0100 corresponding to 01:00 is used as the initial second-level directory corresponding to vehicle data B, thereby determining the initial directory file of vehicle data B (the initial first-level directory of the file is 20240802, and the initial second-level directory is 0100).
[0069] Table 1: Correspondence between preset data recording dates and initial second-level directories
[0070] In another exemplary embodiment of this application, the application scenarios of the above-mentioned storage methods are illustrated by way of example. Please refer to the following for details. Figure 5 , Figure 5 This is a schematic diagram illustrating the application scenarios of different vehicle-side data storage methods in this application.
[0071] Vehicle-side data—High-frequency raw vehicle messages are first uploaded to the message queue of the cloud platform for caching, serving as a data buffer. Common high-frequency messages include raw CAN messages. The message queue message format is: the key of the topic is the vehicle identification (such as the VIN), and the value of the topic is the raw message in hexadecimal.
[0072] The message storage program can write various vehicle-side data into object storage / local file system to complete the initial storage operation of vehicle-side data. Specifically, the initial first-level directory is determined based on the recording date of the vehicle-side data, and the initial second-level directory is determined based on the recording time of the vehicle-side data. The message storage program sets a checkpoint every N minutes (where N is the interval length for the time interval divided for a single day, corresponding to the number of initial second-level directories), and sets the parallelism to M (the number of workers that can perform simultaneous processing). In some embodiments, the parallelism is also divided based on the hash value of the vehicle identification number (VIN), meaning that vehicle-side data with the same vehicle identification is processed in the same sub-thread. This results in each initial second-level directory having M initial directory files, and vehicle-side data corresponding to the same vehicle identification is stored in the same initial directory file. A single initial directory file may contain vehicle-side data corresponding to multiple different identifications.
[0073] The parameters stored in real time to object storage / local file system include device number (vehicle identification), original message time (recording time: recording date + recording time), and original message (vehicle-side data). Data storage adopts column storage format such as Parquet, and data compression is performed using data compression methods such as ZSTD.
[0074] The distribution process distributes vehicle-side data from the initial directory files in the object storage / local file system. The distribution process is as follows: Figure 6 As shown. The main entry class 1 primarily receives the recorded date (i.e., all data for a given day), corresponding to the initial first-level directory mentioned above. It scans the number of initial second-level directories under the initial first-level directory (the number of initial second-level directories is X = 24 * 60 / N, where N is the configured minute data), and generates a temporary DS (apachedolphinscheduler) workflow temp_workflow1 based on the data. It generates the number of tasks in the workflow based on the number of initial second-level directories; for example, if X = 3, then 3 tasks are generated. Each task performs the same content, only the input parameters differ, which are the paths to the initial second-level directories of OBS. Each task in the workflow calls the main entry class 2 to process the vehicle-side data of one initial second-level directory. The tasks are performed in parallel; the temporary workflow temp_workflow1 is restarted and scheduled in all workers of DS to obtain the execution result of the workflow; based on business requirements (whether it is necessary to merge the vehicle-side data of the same day after distribution into a single file), it is determined whether the file needs to be merged. If so, a temporary workflow temp_workflow2 is generated again; each task in the workflow is given a device number (i.e., vehicle identification) and the main entry class 3 is called to merge the vehicle-side data of the same record date and the same device number into the same file. The temporary workflow temp_workflow2 is restarted and scheduled in all workers of DS to obtain the execution result of the workflow; the execution result status is returned, and the main entry class 1 has completed processing.
[0075] The main entry class 2 primarily receives the initial second-level directory as a parameter, iterates through the distributed Python scripts, and generates either a single-threaded script or a multi-threaded parallel script depending on the configuration. A single-threaded script means that one thread reads and distributes all files under this initial second-level directory according to the device number. A multi-threaded script means that a distribution script is generated for each initial directory file under the initial second-level directory, and a thread is started to execute it, obtain the execution result status of the distributed Python script, and return it.
[0076] Main Entry Class 3 primarily receives the results distributed by Main Entry Class 2: the device number is used as the input parameter, and multiple files with the same device number are merged into one file to obtain multiple target directory files; among them, the first-level directory to which the target directory file belongs is the data record date, and the second-level directory to which it belongs is the vehicle identification number.
[0077] This embodiment employs a distributed scheduling strategy throughout the entire distribution process. Specifically, each DS worker processes only one initial second-level directory or one initial directory file at a time. This is combined with parallel computation by multiple DS workers, using a workflow to aggregate distributed computation results to achieve efficient and high-speed vehicle-side data distribution. Furthermore, this embodiment supports the export of long-term historical vehicle-side data. By recording the time and device number, the file directory can be directly located, and there is only one file in each directory, enabling rapid data retrieval and export.
[0078] Another aspect of this application provides a storage device for different vehicle-side data, such as... Figure 7 As shown, Figure 7 This is a schematic diagram illustrating the structure of a storage device for different vehicle-side data according to an exemplary embodiment of this application. The storage device 700 includes:
[0079] The determination module 710 is used to determine the initial directory file for storing the data of each vehicle terminal based on the recording time of the data of each vehicle terminal; wherein, the initial first-level directory to which the initial directory file belongs is the data recording date, and the initial second-level directory to which it belongs is the specified time interval. The initial second-level directory is the directory corresponding to the time interval obtained by dividing a single day according to a preset interval duration.
[0080] The initial storage module 730 is used to store the vehicle-end data of each vehicle to the corresponding initial directory file, so that each initial directory file stores the vehicle-end data corresponding to different vehicle identifications within a specified time interval; wherein, the vehicle-end data corresponding to the same vehicle identification is stored in the same initial directory file.
[0081] The target storage module 750 is used to distribute the vehicle-end data corresponding to the same vehicle identity in each initial directory file to the corresponding target directory file, so that each target directory file stores the vehicle-end data corresponding to the same vehicle identity with the same data recording date; wherein, the first-level directory to which the target directory file belongs is the data recording date, and the second-level directory to which it belongs is the vehicle identity.
[0082] In another exemplary embodiment, the target storage module 750 further includes:
[0083] The merging unit is used to merge the vehicle-side data corresponding to the same vehicle identity in each initial directory file to obtain multiple merged vehicle-side data.
[0084] The target storage unit is used to determine the corresponding distribution thread based on the vehicle identity identifier corresponding to each merged vehicle data, and to distribute multiple merged vehicle data to the corresponding target directory file based on their respective distribution threads; wherein, different distribution threads correspond to different target directory files.
[0085] In another exemplary embodiment, the merging unit further includes:
[0086] The traversal module is used to traverse the vehicle-side data in each initial directory file and use the traversed vehicle-side data as the target vehicle-side data.
[0087] The first merging section is used to merge the target vehicle data into the historical vehicle data corresponding to the historical vehicle identity if the vehicle identity corresponding to the target vehicle data is a historical vehicle identity; wherein, the historical vehicle identity is the vehicle identity corresponding to the vehicle data that has been traversed.
[0088] The second merging section is used to treat the target vehicle data as new historical vehicle data if the vehicle identification identifier corresponding to the target vehicle data is not a historical vehicle identification identifier, so as to merge vehicle data corresponding to the same vehicle identification identifier.
[0089] In another exemplary embodiment, the target storage unit further includes:
[0090] The thread generation section is used to generate a corresponding number of distribution threads based on the number of different vehicle identity identifiers corresponding to multiple merged vehicle-side data.
[0091] The first distribution module is used to distribute the merged vehicle-side data to the corresponding target directory files using a corresponding number of distribution threads.
[0092] In another exemplary embodiment, the target storage unit further includes:
[0093] The thread determination section is used to determine the number of vehicle identity identifiers corresponding to each distribution thread based on the number of different vehicle identity identifiers corresponding to multiple merged vehicle-side data and the preset number of distribution threads.
[0094] The second distribution module is used to distribute the vehicle-side data corresponding to the corresponding number of vehicle identifiers to the corresponding target directory files through various distribution threads; wherein, the vehicle identifiers corresponding to each distribution thread are different.
[0095] In another exemplary embodiment, the recording time includes the recording date and the recording time; the determining module 710 further includes:
[0096] The first matching unit is used to match the recording date of each vehicle terminal data with the preset data recording date corresponding to the initial first-level directory, so as to obtain the preset data recording date that is successfully matched.
[0097] The second matching unit is used to determine the initial directory file for storing each vehicle data in the initial second-level directory under the preset data recording date that was successfully matched, based on the recording time of each vehicle data.
[0098] In another exemplary embodiment, the storage device 700 further includes:
[0099] The calculation module is used to divide the duration of a single day by the preset interval duration and construct a corresponding number of initial second-level directories based on the calculated quotient, so that the number of initial second-level directories under each initial first-level directory is the same.
[0100] This application's storage device can classify and buffer the data from each vehicle terminal in real time according to the recording time, storing it in the corresponding initial directory file within the initial second-level directory. The initial second-level directory is a directory corresponding to a time interval defined by a preset interval for each day, rather than a separate storage directory for different vehicle identification numbers (VINs). Compared to storage methods that directly classify data based on VINs, this reduces the number of files written to. This application's storage device distributes the vehicle terminal data corresponding to the same vehicle identification number from each initial directory file to the corresponding target directory file. This ensures that each target directory file stores vehicle terminal data corresponding to the same vehicle identification number from the same data recording date. Simultaneously, the final storage second-level directory contains only one file storing the vehicle terminal data corresponding to a specific vehicle identification number, facilitating quick retrieval of the corresponding vehicle terminal data.
[0101] It should be noted that the storage device provided in the above embodiments and the storage method provided in the foregoing embodiments belong to the same concept. The specific ways in which each module and unit performs operations have been described in detail in the method embodiments, and will not be repeated here.
[0102] Another aspect of this application provides an electronic device, including: a controller; and a memory for storing one or more programs, which, when executed by the controller, perform the storage method described above.
[0103] Please see Figure 8 , Figure 8 This is a schematic diagram of the structure of a computer system for an electronic device, illustrating an exemplary embodiment of this application. It shows a schematic diagram of the structure of a computer system suitable for implementing the embodiments of this application.
[0104] It should be noted that, Figure 8 The computer system 800 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0105] like Figure 8As shown, the computer system 800 includes a Central Processing Unit (CPU) 801, which can perform various appropriate actions and processes, such as executing the methods described in the above embodiments, based on programs stored in Read-Only Memory (ROM) 802 or programs loaded from storage portion 808 into Random Access Memory (RAM) 803. The RAM 803 also stores various programs and data required for system operation. The CPU 801, ROM 802, and RAM 803 are interconnected via a bus 804. An Input / Output (I / O) interface 805 is also connected to the bus 804.
[0106] The following components are connected to I / O interface 805: an input section 806 including a keyboard, mouse, etc.; an output section 807 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to I / O interface 805 as needed. A removable medium 811, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 810 as needed so that computer programs read from it can be installed into storage section 808 as needed.
[0107] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program including a computer program for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 809, and / or installed from removable medium 811. When the computer program is executed by central processing unit (CPU) 801, it performs various functions defined in the system of this application.
[0108] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying a computer-readable computer program. The transmitted data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.
[0109] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0110] The units described in the embodiments of this application can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.
[0111] Another aspect of this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the aforementioned storage method. This computer-readable storage medium may be included in the electronic device described in the above embodiments, or it may exist independently and not assembled into the electronic device.
[0112] Another aspect of this application provides a computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the storage methods provided in the various embodiments described above.
[0113] According to one aspect of the embodiments of this application, a computer system is also provided, including a Central Processing Unit (CPU), which can perform various appropriate actions and processes based on a program stored in read-only memory (ROM) or a program loaded from storage into random access memory (RAM), such as performing the methods described above. Various programs and data required for system operation are also stored in the RAM. The CPU, ROM, and RAM are interconnected via a bus. Input / output (I / O) interfaces are also connected to the bus.
[0114] The following components are connected to the I / O interface: input components including keyboards, mice, etc.; output components including cathode ray tubes (CRTs), liquid crystal displays (LCDs), and speakers; storage components including hard drives; and communication components including network interface cards such as LAN (Local Area Network) cards and modems. The communication components perform communication processing via networks such as the Internet. Drives are also connected to the I / O interface as needed. Removable media, such as disks, optical discs, magneto-optical discs, semiconductor memories, etc., are installed on the drive as needed so that computer programs read from them can be installed into the storage components as required.
[0115] The above description is merely a preferred exemplary embodiment of this application and is not intended to limit the implementation of this application. Those skilled in the art can easily make corresponding modifications or alterations based on the main concept and spirit of this application. Therefore, the scope of protection of this application should be determined by the scope of protection claimed in the claims.
Claims
1. A method for storing different vehicle-side data, characterized in that: The storage method comprises: According to the recording time of each vehicle-side data, an initial directory file for storing each vehicle-side data is determined; wherein the initial first-level directory to which the initial directory file belongs is the data recording date, and the initial second-level directory to which it belongs is the specified time interval, and the initial second-level directory is a directory corresponding to the time interval obtained by dividing a single day according to the preset interval time; Storing each vehicle-side data in a corresponding initial directory file, so that each initial directory file stores vehicle-side data corresponding to different vehicle identifications in a corresponding specified time interval; wherein the vehicle-side data corresponding to the same vehicle identification is stored in the same initial directory file; Distribute the vehicle-side data corresponding to the same vehicle identity in each initial directory file to the corresponding target directory files, so that each target directory file stores the vehicle-side data corresponding to the same vehicle identity with the same data recording date; wherein the first-level directory to which the target directory file belongs is the data recording date, and the second-level directory to which it belongs is the vehicle identity.
2. The storage method according to claim 1, characterized in that: The step of distributing the vehicle-side data corresponding to the same vehicle identity in each initial directory file to the corresponding target directory file further includes: Merging the vehicle-side data corresponding to the same vehicle identity in each initial directory file to obtain a plurality of merged vehicle-side data; The corresponding distribution thread is determined based on the vehicle identity identifier corresponding to each merged vehicle-side data, and the multiple merged vehicle-side data are distributed to the corresponding target directory file based on the respective corresponding distribution threads; wherein different distribution threads correspond to different target directory files.
3. The storage method according to claim 2, characterized in that: The step of merging the vehicle-side data corresponding to the same vehicle identity in each initial directory file to obtain a plurality of merged vehicle-side data further includes: Traverse each vehicle-side data in each initial directory file, and use the traversed vehicle-side data as the target vehicle-side data; If the vehicle identity identifier corresponding to the target vehicle-side data is a historical vehicle identity identifier, the target vehicle-side data is merged into the historical vehicle-side data corresponding to the historical vehicle identity identifier; wherein the historical vehicle identity identifier is the vehicle identity identifier corresponding to the traversed vehicle-side data; If the vehicle identity identifier corresponding to the target vehicle-side data is not the historical vehicle identity identifier, the target vehicle-side data is used as new historical vehicle-side data to merge the vehicle-side data corresponding to the same vehicle identity identifier.
4. The storage method according to claim 2, characterized in that: The method further includes: determining a corresponding distribution thread based on the vehicle identity corresponding to each merged vehicle-side data, and distributing the plurality of merged vehicle-side data to a corresponding target directory file based on the respective corresponding distribution threads, and further includes: Generate a corresponding number of distribution threads according to the number of different vehicle identifications corresponding to the multiple merged vehicle-side data; Each merged vehicle-side data is distributed to the corresponding target directory file through a corresponding number of distribution threads.
5. The storage method according to claim 2, characterized in that: The method further includes: determining a corresponding distribution thread based on the vehicle identity corresponding to each merged vehicle-side data, and distributing the plurality of merged vehicle-side data to a corresponding target directory file based on the respective corresponding distribution threads, and further includes: Determine the number of vehicle identification tags corresponding to each distribution thread according to the number of different vehicle identification tags corresponding to the plurality of merged vehicle-side data and a preset number of distribution threads; The vehicle-side data corresponding to the corresponding number of vehicle identification tags are distributed to the corresponding target directory file through each distribution thread; wherein the vehicle identification tag corresponding to each distribution thread is different.
6. The storage method according to any one of claims 1 to 5, characterized in that: The recording time includes the recording date and the recording time; the initial directory file for storing each vehicle-side data is determined according to the recording time of each vehicle-side data, further comprising: Matching the recording date of each vehicle-side data with the preset data recording date corresponding to the initial first-level directory to obtain the preset data recording date of each successfully matched one; According to the recording time of each vehicle-side data, in the initial secondary directory under the preset data recording date that matches successfully, the initial directory file for storing each vehicle-side data is determined.
7. The storage method according to any one of claims 1 to 5, characterized in that: The storage method further comprises: The single-day duration is divided by the preset interval duration, and a corresponding number of the initial secondary directories are constructed according to the calculated quotient, so that the number of initial secondary directories under each initial primary directory is the same.
8. A storage device for different vehicle-side data, characterized in that: The storage device comprises: A determination module is used to determine an initial directory file for storing each vehicle-side data according to the recording time of each vehicle-side data; wherein the initial first-level directory to which the initial directory file belongs is the data recording date, and the initial second-level directory to which it belongs is the specified time interval, and the initial second-level directory is a directory corresponding to the time interval obtained by dividing a single day according to a preset interval duration; An initial storage module is used to store each vehicle-side data into a corresponding initial directory file, so that each initial directory file stores vehicle-side data corresponding to different vehicle identifications in a corresponding specified time interval; wherein the vehicle-side data corresponding to the same vehicle identification is stored in the same initial directory file; The target storage module is used to distribute the vehicle-side data corresponding to the same vehicle identity in each initial directory file to the corresponding target directory file, so that each target directory file stores the vehicle-side data corresponding to the same vehicle identity with the same data recording date; wherein the first-level directory to which the target directory file belongs is the data recording date, and the second-level directory to which it belongs is the vehicle identity.
9. An electronic device, characterized in that: include: Controller; A memory for storing one or more programs, wherein when the one or more programs are executed by a controller, the controller implements the storage method described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: Computer-readable instructions are stored thereon, and when the computer-readable instructions are executed by the memory of the computer, the computer is caused to execute the storage method according to any one of claims 1 to 7.
