File transmission method, device, electronic equipment, product and medium
By detecting the file type and size in the file management unit of the artificial intelligence training platform, and determining the upload strategy and segmentation strategy, the problem of low file upload efficiency in the existing technology is solved, and efficient transmission of multi-type file sets is achieved and user experience is improved. .
Patent Information
- Application Number
- CN202410532935.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-29
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2044-04-29
AI Technical Summary
Existing artificial intelligence training platforms cannot efficiently transmit files of multiple types and sizes, resulting in low file upload efficiency, network instability, and server performance bottlenecks.
By detecting the file type and size in the file management unit, determining the upload strategy and splitting strategy, splitting the files and uploading them in parallel or one by one, and adjusting the fragment size using the real-time upload rate, it supports efficient transmission of multiple types of files.
It achieves efficient transmission of multiple types of file sets, improves user interface file transmission efficiency, improves user experience, and reduces the probability of transmission failure.
Smart Images

Figure CN118138581B
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a file transmission method, device, electronic equipment, product and medium. Background Art
[0002] With the development of large models, it is more common to complete model training through artificial intelligence training platforms. There are various types and sizes of files in the user's local model data and data set data. The user's needs for uploading different files are increasing. The current artificial intelligence training platform cannot meet the efficient transmission of multiple types of files. Summary of the invention
[0003] In view of this, embodiments of the present application provide a file transmission method, device, electronic device, product and medium to overcome the above problems or at least partially solve the above problems.
[0004] A first aspect of an embodiment of the present application provides a file transmission method, which is applied to a file management unit of an artificial intelligence training platform, wherein the file management unit is used to connect a user interface of the artificial intelligence training platform with a training service of the artificial intelligence training platform, and the method includes:
[0005] When it is detected in the user interface that a target file set that a user needs to upload to the artificial intelligence training platform is determined, the type of the target file set and the file size of each file in the target file set are determined;
[0006] According to the type of the target file set, an upload strategy corresponding to the target file set is determined; according to the size relationship between the file size of each file in the target file set and a preset file fragment size, a segmentation strategy for the target file set is determined; and based on the segmentation strategy, files in the target file set that meet the segmentation conditions are segmented to obtain a file set to be uploaded, wherein the preset file fragment size is determined based on a real-time upload rate of files in the file management unit detected by a northbound interface;
[0007] The file set to be uploaded is uploaded to the artificial intelligence training platform based on the upload strategy.
[0008] Optionally, determining a segmentation strategy for the target file set according to a size relationship between a file size of each file in the target file set and a preset file segment size, and segmenting files in the target file set that meet a segmentation condition based on the segmentation strategy to obtain a file set to be uploaded includes:
[0009] When the type of the target file set is a single file, determining that the upload strategy is a one-by-one upload strategy;
[0010] Determine the size relationship between the file size of the single file and the preset file fragment size;
[0011] When the file size of the single file is less than or equal to the preset file fragment size, the single file is determined to be the file set to be uploaded; when the file size of the single file is greater than the preset file fragment size, the single file is determined to be the first file, and the single file as the first file is split into a first file fragment set according to the preset file fragment size, and the first file fragment set is determined to be the file set to be uploaded, wherein the first file fragment set includes multiple first file fragments;
[0012] The uploading of the file set to be uploaded to the artificial intelligence training platform based on the upload strategy includes: adding a single file or the multiple first file fragments contained in the file set to be uploaded to the same file upload queue, and uploading them one by one based on the one-by-one upload strategy.
[0013] Optionally, determining a segmentation strategy for the target file set according to a size relationship between a file size of each file in the target file set and a preset file segment size, and segmenting files in the target file set that meet a segmentation condition based on the segmentation strategy to obtain a file set to be uploaded includes:
[0014] When the type of the target file set is multiple files, determining that the upload strategy is a parallel upload strategy and / or a one-by-one upload strategy;
[0015] Determine a size relationship between a file size of each sub-file in the plurality of files and the preset file segment size;
[0016] When the file size of the subfile is larger than the preset file fragment size, the subfile is determined to be the first file, and the subfile of the first file is split into a plurality of second file fragment sets according to the preset file fragment size, and the plurality of second file fragment sets and the subfiles with a file size greater than or equal to the preset file fragment size are determined to be the file set to be uploaded, the second file fragment set including a plurality of second file fragments, and each second file fragment set corresponding to a subfile with a file size greater than the preset file fragment size;
[0017] The method of uploading the file set to be uploaded to the artificial intelligence training platform based on the upload strategy includes: adding the multiple second file fragment sets contained in the file set to be uploaded or the sub-files whose file size is greater than or equal to the preset file fragment size to multiple file upload queues respectively, and performing parallel uploading based on the parallel upload strategy, wherein each of the second file fragment sets is uploaded one by one in the same file upload queue based on the one-by-one upload strategy.
[0018] Optionally, the method further comprises:
[0019] When the file upload queue is empty, directly adding the file set to be uploaded to the file upload queue;
[0020] When the file upload queue is not empty, the queue length of the file upload queue is less than a preset length and the size of the file segment in the file upload queue is less than a preset file segment size, adding the file set to be uploaded to the file upload queue;
[0021] When the file upload queue is not empty, the queue length of the file upload queue is less than the preset length and the size of the file segment in the file upload queue is equal to the preset file segment size, wait for the files in the file upload queue to be uploaded and then add the file set to be uploaded to the file upload queue.
[0022] Optionally, the method further comprises:
[0023] Marking the plurality of first file fragments included in the first file fragment set and the plurality of second file fragments included in the second file fragment set according to the segmentation order, so that each first file fragment has a first fragment sequence number corresponding thereto, and each second file fragment has a second fragment sequence number corresponding thereto;
[0024] After the first file fragment is uploaded, the first file fragment is reassembled with other first file fragments according to the first fragment sequence number to obtain a single file corresponding to the first file fragment set;
[0025] After the second file fragment is uploaded, the second file fragment is reassembled with other second file fragments according to the second fragment sequence number to obtain a sub-file corresponding to the second file fragment set.
[0026] Optionally, the method further comprises:
[0027] Creating a temporary directory for the file set to be uploaded, the temporary directory including a first temporary directory and a second temporary directory;
[0028] The uploaded first file fragment is stored in the first temporary directory. In the first temporary directory, the first file fragment is reassembled with other first file fragments according to the first fragment sequence number. After obtaining a single file corresponding to the first file fragment set, the single file is moved to the first target directory, and the first temporary directory is cleaned up.
[0029] The uploaded second file fragment is stored in the second temporary directory. In the second temporary directory, the second file fragment is reorganized with other second file fragments according to the second fragment sequence number. After obtaining the sub-file corresponding to the second file fragment set, the sub-file is moved to the second target directory, and the second temporary directory is cleaned up.
[0030] Optionally, the creating a temporary directory for the file set to be uploaded includes:
[0031] Creating a temporary directory with a universal unique identification code, and dot-hiding the created temporary directory so that the temporary directory is invisible in the user interface;
[0032] Set the properties of the temporary directory to the root user.
[0033] Optionally, the method further comprises:
[0034] When the file set to be uploaded fails to be uploaded, error information of the upload failure is fed back to the user interface;
[0035] Re-upload the file that was being uploaded when the upload failed according to the configured preset error retry count.
[0036] Optionally, the method further comprises:
[0037] Determine whether the number of re-uploads is greater than the preset number of error retries;
[0038] When the number of re-uploads is greater than the preset number of error retries and the file being uploaded when the upload fails cannot be completed, the file uploaded before the upload failure is cleaned up as dirty data.
[0039] Optionally, the method further comprises:
[0040] After the upload of the to-be-uploaded file set is completed, a consistency check is performed on the uploaded to-be-uploaded file set using a file verification code to obtain a verification result;
[0041] When the verification result indicates that the content of the to-be-uploaded file set is tampered with or damaged, the to-be-uploaded file set is re-uploaded.
[0042] Optionally, before verifying the integrity and consistency of the uploaded file set by using the file verification code, the following is further included:
[0043] Setting a sampling strategy and a sampling ratio, wherein the sampling strategy includes random sampling and stratified sampling;
[0044] Determine the files and / or file segments that need to be checked for consistency from the set of files to be uploaded according to the sampling strategy and the sampling ratio;
[0045] A consistency check is performed on the files and / or file segments that are determined to require a consistency check.
[0046] A second aspect of an embodiment of the present application provides a file transmission device, the device comprising: a file management unit applied to an artificial intelligence training platform, the file management unit being used to connect a user interface of the artificial intelligence training platform with a training service of the artificial intelligence training platform, the device comprising:
[0047] A detection module, configured to determine the type of the target file set and the file size of each file in the target file set when a target file set that a user needs to upload to the artificial intelligence training platform is detected in the user interface;
[0048] a determination module, configured to determine an upload strategy corresponding to the target file set according to the type of the target file set, determine a segmentation strategy for the target file set according to a size relationship between the file size of each file in the target file set and a preset file segmentation size, and segment the files in the target file set that meet the segmentation condition based on the segmentation strategy to obtain a file set to be uploaded, wherein the preset file segmentation size is determined based on a real-time upload rate of files in the file management unit detected by a northbound interface;
[0049] An uploading module is used to upload the set of files to be uploaded to the artificial intelligence training platform based on the upload strategy.
[0050] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the file transfer method as described in the first aspect.
[0051] According to a fourth aspect of an embodiment of the present application, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the file transfer method described in the first aspect is implemented.
[0052] According to a fifth aspect of the embodiments of the present application, a computer-readable medium is provided, on which a computer program is stored, wherein when the computer program is executed by a processor, the file transfer method as described in the first aspect is implemented.
[0053] Beneficial effects of this application:
[0054] The embodiments of the present application provide a file transmission method, device, electronic device, product and medium, which are applied to a file management unit of an artificial intelligence training platform, wherein the file management unit is used to connect a user interface of the artificial intelligence training platform with a training service of the artificial intelligence training platform, and the method comprises: when a target file set that a user needs to upload to the artificial intelligence training platform is detected in the user interface, the type of the target file set and the file size of each file in the target file set are determined; according to the type of the target file set, an upload strategy corresponding to the target file set is determined; according to the size relationship between the file size of each file in the target file set and a preset file fragment size, a segmentation strategy of the target file set is determined; and based on the segmentation strategy, files in the target file set that meet the segmentation conditions are segmented to obtain a file set to be uploaded, wherein the preset file fragment size is determined based on the real-time upload rate of the files in the file management unit detected by the northbound interface; and the file set to be uploaded is uploaded to the artificial intelligence training platform based on the upload strategy.
[0055] It is able to determine different upload strategies for the target file set required for the training business of the artificial intelligence training platform according to the type of the target file set, and determine the segmentation strategy of the target file set and perform segmentation according to the size relationship between the file size of each file in the target file set and the preset file fragment size determined by the real-time upload rate of the file detected based on the northbound interface to obtain the file set to be uploaded, and upload the file set to be uploaded to the artificial intelligence training platform based on the upload strategy. By supporting different segmentation strategies and transmission strategies for multiple types of target file sets, efficient transmission of multiple types of target file sets can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application.
[0057] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the description of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0058] Figure 1 is a flowchart of a file transmission method provided by an embodiment of the present application;
[0059] Figure 2 This is a data support architecture diagram of an artificial intelligence training platform in a file transmission method provided in an embodiment of the present application;
[0060] Figure 3 It is a schematic diagram of an enqueue strategy in a file transfer method provided in an embodiment of the present application;
[0061] Figure 4 is a schematic diagram of another enqueue strategy in a file transfer method provided in an embodiment of the present application;
[0062] Figure 5 This is a schematic diagram of merging and reorganizing file slices in a file transmission method provided in an embodiment of the present application;
[0063] Figure 6 This is a flow chart of uploading and merging and reorganizing a file containing file fragments in a file transmission method provided in an embodiment of the present application;
[0064] Figure 7 It is a schematic diagram of a framework of a file transmission device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0065] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application may be combined with each other.
[0066] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0067] The file management unit of the artificial intelligence (AI) training platform is a core module and an important bridge connecting user data and training services. It is expected that the user's local models and data sets can be efficiently and conveniently uploaded to the artificial intelligence training platform via Web (World Wide Web) transmission, and serve the training services of the artificial intelligence training platform.
[0068] However, since the local model data file set of users is very large, as the development of large models intensifies, large models with billions or tens of billions of parameters are also relatively common, resulting in large model data file sets of users. The file size of data upload supported by the current artificial intelligence training platform can no longer meet the needs of users.
[0069] In addition, the file sets of the user's local model data are usually characterized by large number, diverse types, and different sizes. Therefore, there is an urgent need to provide a stable, efficient, and reliable user web-side upload method to meet the user's local file transfer needs.
[0070] In the related art, the solution for uploading a file set through the user interface (i.e., the user web side) of the artificial intelligence training platform is as follows: the user selects the file to be uploaded on the user interface, and the front end verifies the file size, file type, and other file attributes, then receives the file stream of the file, and uses a POST request to submit the file attributes and file stream to the server for processing by submitting a form through an HTTP request. After the server receives the uploaded file, it further processes the file.
[0071] However, traditional UI transmission solutions face the following problems:
[0072] 1. File size limit: You can only upload a single file and the size of a single file is no larger than 1G. If you want to upload a large file, you need to use the SFTP (Secure File Transfer Program, a file transfer protocol that securely transfers files through SSH (Secure Shell)) tool to operate in the background. If you want to upload multiple files, you need to perform multiple upload operations, which is very inconvenient.
[0073] 2. Network problems: In production environments, customers often encounter upload failures due to network jitter or instability.
[0074] 3. Large files take too long to upload, and errors caused by unstable network factors cannot be recovered and must be re-uploaded, resulting in low efficiency.
[0075] 4. Microservice overload or server performance bottleneck caused by a large number of file requests.
[0076] 5. The process of receiving large files is long, and the lack of proper logging leads to uncertainties that make it difficult to quickly locate and find the cause of the problem after the file upload fails.
[0077] Therefore, the file transfer solutions in the related art cannot meet the file transfer needs of users in the production environment.
[0078] In order to solve the problems encountered by users during file transfer, the present application proposes a file transfer method, device, electronic device, product and medium. No matter what type of file set the user selects (e.g., single file, multiple files, folder, large file, small file), the file transfer can be performed efficiently, thereby improving the file transfer efficiency of the user interface and further enhancing the user experience.
[0079] Figure 1 is a flowchart of a file transmission method provided by an embodiment of the present application. Figure 2 This is a data support architecture diagram of an artificial intelligence training platform in a file transmission method provided in an embodiment of the present application, such as Figure 1As shown, a file management unit applied to an artificial intelligence training platform, the file management unit is used to connect the user interface of the artificial intelligence training platform with the training business of the artificial intelligence training platform, and the method includes:
[0080] In step S101, when it is detected in the user interface that a target file set that a user needs to upload to the artificial intelligence training platform is detected, the type of the target file set and the file size of each file in the target file set are determined;
[0081] In step S102, an upload strategy corresponding to the target file set is determined according to the type of the target file set, a segmentation strategy of the target file set is determined according to the size relationship between the file size of each file in the target file set and a preset file segmentation size, and files in the target file set that meet the segmentation condition are segmented based on the segmentation strategy to obtain a file set to be uploaded, wherein the preset file segmentation size is determined based on the real-time upload rate of the files in the file management unit detected by the northbound interface;
[0082] In step S103, the file set to be uploaded is uploaded to the artificial intelligence training platform based on the upload strategy.
[0083] First, if Figure 2 As shown, the user's local data is the target file set, which includes model data and data set data, wherein the data set data includes training samples for training the model, etc. The artificial intelligence training platform includes a file management unit and a training service. The user needs to train the model data through the data set data on the artificial intelligence training platform. Therefore, the target file set needs to be transferred to the artificial intelligence training platform so that the training service of the artificial intelligence training platform can perform model management, data set management, model training, model deployment and other operations on the model data according to the uploaded target file set.
[0084] First, in step S101, when it is detected in the user interface that a target file set that a user needs to upload to the artificial intelligence training platform is determined, the type of the target file set and the file size of each file in the target file set are determined.
[0085] In an embodiment of the present application, when a user selects a target file set to be uploaded on the user interface, the file management unit of the artificial intelligence training platform verifies the type of the target file set and the file size of each file contained in the target file set to determine the type of the target file set and the file size of each file. The target file set may contain multiple files, a single file, a folder, etc., and the sizes of the files contained in the target file set may be the same or different.
[0086] Further, in step S102, based on the type of the target file set, an upload strategy corresponding to the target file set is determined, and based on the size relationship between the file size of each file in the target file set and a preset file fragment size, a segmentation strategy for the target file set is determined, and based on the segmentation strategy, the files in the target file set that meet the segmentation conditions are segmented to obtain a file set to be uploaded, wherein the preset file fragment size is determined based on the real-time upload rate of the files in the file management unit detected by the northbound interface.
[0087] In an embodiment of the present application, different types of target file sets correspond to different upload strategies, and different file sizes and preset file slice sizes correspond to different segmentation strategies, wherein the preset file slice size is a standard for segmenting files, and the preset file slice size is determined based on the real-time upload rate of files in the file management unit detected by the northbound interface. The preset file slice size is proportional to the real-time upload rate of the file. When the real-time upload rate is high, it means that the current network bandwidth is high, and a relatively large preset file slice size can be selected to make full use of the current network bandwidth resources and facilitate customers to obtain more efficient file slice size values. When the real-time upload rate is low, it means that the current network bandwidth is low and the network environment is unstable. A relatively small preset file slice size can be selected, thereby reducing the probability of file transmission failure. In order to ensure that the setting of the preset file slice size can ensure maximum utilization of the network bandwidth, the present application uses a northbound interface and a script to test the network speed to obtain a more efficient slice size value.
[0088] The embodiments of the present application have been tested in the environment of Gigabit network card and 10 Gigabit network card, ordinary mechanical hard disk, and shard size (2M~8M). Under the test environment, the transmission efficiency is highest when the preset file shard size is 4M, so the recommended preset file shard size under the network configuration of Gigabit and 10 Gigabit network cards is 4M. Due to different server network configurations, different storage networks, different disk hardware, different client memory, CPU, and disk capabilities, there may be a better value for the preset file shard size. Therefore, we provide a parameter change configuration for the preset file shard size in the configuration file of the backend storage microservice, and users can flexibly configure the shard size.
[0089] First of all, due to the different hardware devices of different users, the maximum bandwidth that different hardware devices can support is different. We have conducted a lot of tests under the Gigabit network and given a recommended default shard size. However, for 10 Gigabit network cards, IB network cards, etc., a real-time speed test script is provided before uploading the file to perform real-time speed test to obtain the maximum network bandwidth that can be supported during file transfer. Then, there is the speed test method, which is to upload the northbound interface. The northbound interface is a safe, convenient and direct method. Usually, after the product is released, there will usually be a firewall policy to strengthen the product security, and the username and password often need to be encrypted.
[0090] The northbound interface performs secure interface authentication by using the AK and SK keys configured by the developer user and combining them with the timestamp string. Then, the real-time speed test is performed through the uploaded northbound API. This application provides the following speed test script.
[0091]
[0092] The northbound interface speed test script continuously uploads, tests and obtains the real-time upload speed within 5 minutes.
[0093] The following explains the meaning of the northbound interface speed test script:
[0094] Line 1: Use / bin / bash interpreter to execute;
[0095] Line 2: Get the timestamp of the current time in seconds;
[0096] Line 3: Calculate the end time, which is set to 300 seconds after the start time, i.e., the upload will continue for 5 minutes;
[0097] Line 4: Initialize a variable for subsequent counting of upload times;
[0098] Lines 5-8: Use the curl command to send a POST request to obtain signature information, and save the result in the auth.txt file. This is the secure access and authentication method for the northbound interface.
[0099] Lines 9-10: Extract two key parameters in the signature information from auth.txt and use them as header parameters for northbound upload interface security authentication;
[0100] Line 11: Set the file name of the target file set to be uploaded, and use a 50M file for testing;
[0101] Lines 12-14: Print the extracted parameters;
[0102] Line 15: Initialize a variable for subsequent calculation of the sum of upload speeds;
[0103] Line 16: Use a while loop to continuously upload files to measure the speed before the end time;
[0104] Line 17: Print the current upload count;
[0105] Line 18: Get the timestamp when the upload starts;
[0106] Lines 19-20: Use the curl command to send a POST request to upload a file and save the returned result;
[0107] Line 21: Print the upload result;
[0108] Line 22: Get the timestamp when the upload ends;
[0109] Lines 23-24: Calculate the time (in seconds) taken to upload and print it;
[0110] Lines 25-26: Calculate the upload speed (file size divided by the time it takes to upload) and print it, retaining two decimal places;
[0111] Line 27: Add the upload speed of each time to the sum variable;
[0112] Line 28: The number of uploads increases by 1;
[0113] Line 29: End of loop;
[0114] Line 30: Since the loop will be calculated once more, the number of uploads is reduced by 1 here;
[0115] Lines 31-32: Calculate the average upload speed (the accumulated upload speed divided by the number of uploads) and print it, retaining two decimal places.
[0116] Therefore, after determining the type of the target file set and the file size of each file included in the target file set, an upload strategy corresponding to the type of the target file set is determined according to the determined type of the target file, and a segmentation strategy for the target file set is determined according to the size relationship between the file size of each file in the determined target file set and the preset file segmentation size. The segmentation strategy can be no segmentation, segmentation of some files, or segmentation of all files. After the files in the target file set that meet the segmentation conditions are segmented based on the segmentation strategy, a file set to be uploaded is obtained, and the file set to be uploaded includes segmented files that meet the segmentation conditions and unsegmented files that do not meet the segmentation conditions.
[0117] Finally, in step S103, the file set to be uploaded is uploaded to the artificial intelligence training platform based on the upload strategy.
[0118] In an embodiment of the present application, after obtaining the file set to be uploaded, the file set to be uploaded is uploaded to the artificial intelligence training platform according to the upload strategy corresponding to the type of the target file set, so that the training service trains the model on the artificial intelligence training platform based on the received file set to be uploaded.
[0119] Through the above embodiments, different upload strategies can be determined according to the type of the target file set for the training business of the artificial intelligence training platform, and the segmentation strategy of the target file set can be determined and segmented according to the size relationship between the file size of each file in the target file set and the preset file fragment size determined based on the real-time upload rate of the file detected based on the northbound interface to obtain the file set to be uploaded, and the file set to be uploaded is uploaded to the artificial intelligence training platform based on the upload strategy. By supporting different segmentation strategies and transmission strategies for multiple types of target file sets, efficient transmission of multiple types of target file sets can be achieved.
[0120] Optionally, the step S102 includes:
[0121] When the type of the target file set is a single file, determining that the upload strategy is a one-by-one upload strategy;
[0122] Determine the size relationship between the file size of the single file and the preset file fragment size;
[0123] When the file size of the single file is less than or equal to the preset file fragment size, the single file is determined to be the file set to be uploaded; when the file size of the single file is greater than the preset file fragment size, the single file is determined to be the first file, and the single file as the first file is split into a first file fragment set according to the preset file fragment size, and the first file fragment set is determined to be the file set to be uploaded, wherein the first file fragment set includes multiple first file fragments;
[0124] The uploading of the file set to be uploaded to the artificial intelligence training platform based on the upload strategy includes: adding a single file or the multiple first file fragments contained in the file set to be uploaded to the same file upload queue, and uploading them one by one based on the one-by-one upload strategy.
[0125] Specifically, in an embodiment of the present application, different upload strategies can be determined based on different types of target file sets. When the type of the target file set is a single file, in order to make full use of the bandwidth and no longer occupy concurrent resources, the upload strategy for the single file is determined to be an upload-by-upload strategy, wherein the upload-by-upload strategy is a strategy for uploading file segments of a single file one by one, that is, waiting for all file segments of a single file to be uploaded before uploading other files.
[0126] Furthermore, it is necessary to determine the size relationship between the file size of a single file and the preset file segment size. When the file size of a single file is less than or equal to the preset file segment size, there is no need to split the single file. At this time, the single file is directly determined as the file set to be uploaded; when the file size of a single file is greater than the preset file segment size, the single file is determined to be the first file, and the file size of the single file represented by the first file is greater than the preset file segment size, and the first file is split into a first file segment set according to the preset file segment size, that is, the first file segment set contains N first file segments, the file size of the first N-1 first file segments is the preset file segment size, the file size of the Nth first file segment is less than or equal to the preset file segment size, and the first file segment set is determined to be the file set to be uploaded, where N is greater than or equal to 2.
[0127] And add the single file or multiple first file fragments contained in the file set to be uploaded to the same file upload queue, and upload the single file or multiple first file fragments contained in the file set to be uploaded to the artificial intelligence training platform one by one according to the upload strategy, wherein, in an embodiment of the present application, multiple file upload queues may be included, and each file upload queue is a thread.
[0128] Through the above embodiments, the upload strategy for the target file set of a single file type can be determined as a one-by-one upload strategy, and the segmentation strategy for the single file can be determined according to the size relationship between the single file and the preset file segment size. After the single file is segmented, the file set to be uploaded is added to the file upload queue for uploading according to the one-by-one upload strategy. This can not only efficiently utilize network bandwidth resources and avoid thread occupation, but also use the idea of segmentation to avoid the problem of transmission errors requiring overall re-transmission, thereby improving the efficient transmission of single files.
[0129] Optionally, the step S102 includes:
[0130] When the type of the target file set is multiple files, determining that the upload strategy is a parallel upload strategy and / or a one-by-one upload strategy;
[0131] Determine a size relationship between a file size of each sub-file in the plurality of files and the preset file segment size;
[0132] When the file size of the subfile is larger than the preset file fragment size, the subfile is determined to be the first file, and the subfile of the first file is split into a plurality of second file fragment sets according to the preset file fragment size, and the plurality of second file fragment sets and the subfiles with a file size greater than or equal to the preset file fragment size are determined to be the file set to be uploaded, the second file fragment set including a plurality of second file fragments, and each second file fragment set corresponding to a subfile with a file size greater than the preset file fragment size;
[0133] The method of uploading the file set to be uploaded to the artificial intelligence training platform based on the upload strategy includes: adding the multiple second file fragment sets contained in the file set to be uploaded or the sub-files whose file size is greater than or equal to the preset file fragment size to multiple file upload queues respectively, and performing parallel uploading based on the parallel upload strategy, wherein each of the second file fragment sets is uploaded one by one in the same file upload queue based on the one-by-one upload strategy.
[0134] Specifically, in an embodiment of the present application, when the type of the target file set is multiple files, the upload strategy is determined to be a parallel upload strategy and / or a one-by-one upload strategy, wherein the parallel upload strategy is to upload different files through file upload queues of multiple threads, that is, in a target file set, each sub-file is transmitted through a file upload queue.
[0135] Further, determine the size relationship between the file size of each subfile included in the target file set and the preset file segment size. When there is a subfile whose file size is larger than the preset file segment size, determine that this subfile is the first file, and split the multiple subfiles of the first file into multiple second file segment sets according to the preset file segment size, that is, each subfile of the first file is split into a second file segment set, each second file segment set corresponds to a subfile whose file size is larger than the preset file segment size, and each second file segment set includes multiple second file segments. Determine that the multiple second file segment sets and subfiles with a file size greater than or equal to the preset file segment size are the file sets to be uploaded. That is to say, when there is a subfile whose file size is less than or equal to the preset file segment size, determine that this subfile does not need to be divided. Therefore, the file set to be uploaded includes multiple subfiles divided into second file segment sets and multiple subfiles that are not divided.
[0136] Furthermore, multiple second file fragment sets or sub-files with a file size greater than or equal to a preset file fragment size contained in a file set to be uploaded whose type is multiple files of the target file set are respectively added to multiple file upload queues, the same second file fragment set is added to the same file upload queue, the same sub-file is added to the same file upload queue, and the sub-files or file fragment sets in the multiple file upload queues are uploaded in parallel based on a parallel upload strategy, wherein each second file fragment set is uploaded one by one in the same file upload queue based on a one-by-one upload strategy.
[0137] Through the above embodiments, the upload strategy for a target file set of multiple files can be determined as a parallel upload strategy and / or a one-by-one upload strategy, and the segmentation strategy of the target file set can be determined according to the size relationship between each sub-file in the multiple files and the preset file segment size. For sub-files whose file size is larger than the preset file segment size, after segmentation according to the preset file segment size, a to-be-uploaded file set including multiple sub-files of the second file segment set and multiple sub-files that are not divided is obtained, and the to-be-uploaded file set is added to multiple file upload queues for uploading according to the concurrent upload strategy, and file transmission is performed one by one for multiple second file segments in the second file segment set in the file upload queue according to the one-by-one upload strategy. This can not only efficiently utilize network bandwidth resources, but also reasonably utilize multiple threads for concurrent uploading of multiple files. The idea of segmentation can also avoid the problem of transmission errors requiring overall re-transmission, thereby improving the efficient transmission of multiple files.
[0138] Optionally, the method further comprises:
[0139] When the file upload queue is empty, directly adding the file set to be uploaded to the file upload queue;
[0140] When the file upload queue is not empty, the queue length of the file upload queue is less than a preset length and the size of the file segment in the file upload queue is less than a preset file segment size, adding the file set to be uploaded to the file upload queue;
[0141] When the file upload queue is not empty, the queue length of the file upload queue is less than the preset length and the size of the file segment in the file upload queue is equal to the preset file segment size, wait for the files in the file upload queue to be uploaded and then add the file set to be uploaded to the file upload queue.
[0142] Specifically, in an embodiment of the present application, the strategy for adding the file set to be uploaded to the file upload queue includes: when the file upload queue is empty, it means that there is no file upload task currently being executed. At this time, the content contained in the file set to be uploaded can be directly added to the file upload queue to perform file transfer of the file set to be uploaded.
[0143] When the file upload queue is not empty, it means that there is a file upload task currently being executed. At this time, it is necessary to determine whether the queue length of the file upload queue is less than the preset length, and the size relationship between the file segment size in the file being uploaded in the current file upload queue and the preset file segment size.
[0144] Figure 3 is a schematic diagram of an enqueue strategy in a file transfer method provided in an embodiment of the present application, Figure 4 It is a schematic diagram of another enqueue strategy in a file transfer method provided in an embodiment of the present application.
[0145] like Figure 3 As shown, when the queue length is less than the preset length and when the size of the file segment in the file upload queue is less than the preset file segment size, the file set to be uploaded can be added to the file upload queue for file transmission.
[0146] like Figure 4 As shown, when the queue length is less than the preset length and when the size of the file segment in the file upload queue is equal to the preset file segment size, it means that the current file upload queue is a single file being uploaded one by one. At this time, it is necessary to wait for the upload of a single file in the file upload queue to be completed, and then add the file set to be uploaded to the file upload queue for file transfer.
[0147] Through the above embodiments, the files to be uploaded can be added to the file upload queue in a centralized manner according to different queue entry strategies according to different file upload situations in the current file upload queue.
[0148] Optionally, the method further comprises:
[0149] Marking the plurality of first file fragments included in the first file fragment set and the plurality of second file fragments included in the second file fragment set according to the segmentation order, so that each first file fragment has a first fragment sequence number corresponding thereto, and each second file fragment has a second fragment sequence number corresponding thereto;
[0150] After the first file fragment is uploaded, the first file fragment is reassembled with other first file fragments according to the first fragment sequence number to obtain a single file corresponding to the first file fragment set;
[0151] After the second file fragment is uploaded, the second file fragment is reassembled with other second file fragments according to the second fragment sequence number to obtain a sub-file corresponding to the second file fragment set.
[0152] Specifically, due to the concurrent uploading of file segments, it is impossible to guarantee that each file segment of the same file can be sent one by one in the segmentation order 100%. For each file segment of the user interface, the server side should design corresponding strategies to ensure the accuracy and consistency of the merging and reorganization of file segments.
[0153] Therefore, in the embodiment of the present application, when it is necessary to divide a single file or sub-file that is larger than a preset file fragment size, in addition to determining the value of the preset file fragment size according to the real-time upload rate of the file, it is also necessary to mark the divided file fragments according to the segmentation order, so that each of the divided file fragments corresponds to a fragment sequence number. After a single file is divided into a first file fragment set including multiple first file fragments according to the preset file fragment size, it is necessary to mark each first file fragment included in the first file fragment set according to the segmentation order, so that each first file fragment corresponds to a first fragment sequence number, that is, in the first After the file fragment set is uploaded, multiple first file fragments can be re-merged and reorganized into a single file according to the sequential rule of the first fragment serial number; when the sub-files of the multiple files whose file size is larger than the preset file fragment size are divided into a second file fragment set containing multiple second file fragments according to the preset file fragment size, each second file fragment contained in the second file fragment set needs to be marked according to the segmentation order, so that each second file fragment corresponds to a second fragment serial number, that is, after the second file fragment set is uploaded, multiple second file fragments can be re-merged and reorganized into sub-files according to the sequential rule of the second fragment serial number.
[0154] Optionally, the method further comprises:
[0155] Creating a temporary directory for the file set to be uploaded, the temporary directory including a first temporary directory and a second temporary directory;
[0156] The uploaded first file fragment is stored in the first temporary directory. In the first temporary directory, the first file fragment is reassembled with other first file fragments according to the first fragment sequence number. After obtaining a single file corresponding to the first file fragment set, the single file is moved to the first target directory, and the first temporary directory is cleaned up.
[0157] The uploaded second file fragment is stored in the second temporary directory. In the second temporary directory, the second file fragment is reorganized with other second file fragments according to the second fragment sequence number. After obtaining the sub-file corresponding to the second file fragment set, the sub-file is moved to the second target directory, and the second temporary directory is cleaned up.
[0158] Specifically, in an embodiment of the present application, for files that are divided into file segments for uploading, before the entire file is uploaded, the server needs to temporarily store the partial file segments that have been uploaded to prevent users from accidentally deleting them.
[0159] Based on this, the embodiment of the present application proposes a technical concept of merging and reorganizing the file segments that are uploaded and saved successfully immediately, and then performing the move operation after the last file segment is uploaded and merged and reorganized. The file segments of the same file received in sequence are temporarily stored by setting a temporary directory and the uploaded file segments are merged. The temporary directory includes a first temporary directory and a second temporary directory. The first temporary directory is used to temporarily store the first file segment, and the second temporary directory is used to temporarily store the second file segment.
[0160] Specifically, the first file segments that have been uploaded are stored in sequence in the first temporary directory. In the first temporary directory, the first file segments are reorganized with other first file segments according to the first segment sequence number. After obtaining a single file corresponding to the first file segment set, the single file is moved, and the content in the first temporary directory is cleaned up for use by other file upload tasks; the second file segments that have been uploaded are stored in the second temporary directory. In the second temporary directory, the second file segments are reorganized with other second file segments according to the second segment sequence number. After obtaining a sub-file corresponding to the second file segment set, the sub-file is moved, and the second temporary directory is cleaned up for use by other file upload tasks.
[0161] Optionally, if a duplicate file exists during the move, it will be renamed according to the file name _yyyyMMddHHmmss and accurate to seconds, where _yyyyMMddHHmmss is a time format representation, where: yyyy: four-digit year, MM: two-digit month, dd: two-digit day, HH: two-digit hour (24-hour system), mm: two-digit minute, ss: two-digit second.
[0162] Through the above embodiment, a temporary directory is used to temporarily store the uploaded file segments in the file being transferred and merge and reorganize them in the temporary directory, thereby ensuring the security of the uploaded file segments and the efficiency of merging and reorganizing the file segments, and improving the user experience.
[0163] Optionally, the cleaning process in the temporary file can be performed simultaneously with the merging and reorganization process, or can be performed after all the file segments of the file are merged and reorganized.
[0164] Figure 5This is a schematic diagram of the merging and reorganization of file slices in a file transfer method provided in an embodiment of the present application. The following describes the process of merging and reorganizing the file slices and simultaneously cleaning up the file.
[0165] like Figure 5 As shown, when it is necessary to ensure both the efficiency and correctness of the merging and reorganization of file segments, after the file segments are uploaded, the server can start merging and reorganizing the received file segments and delete the merged file segments in the temporary directory to free up storage space in the temporary directory.
[0166] First of all, it should be understood that in the same file, except for the last file fragment, the sizes of other file fragments are consistent with the preset file fragment size. Therefore, during the merging and reorganization process, the starting position of the merged file fragment is recorded each time and compared with the file fragment to be merged. If the starting point or fragment sequence number of the file fragment to be merged is incorrect, the merging and reorganization of the file fragment is rejected, and a loop is waited until the correct file fragment is merged and reorganized.
[0167] The following is a code snippet for merging and reorganizing file fragments and a detailed description:
[0168]
[0169] Line 1: Get the size of each file shard defined in the storage configuration;
[0170] Line 2: Calculate the starting position of the file fragment in the file according to the fragment size of the file fragment;
[0171] Line 3: Get the size of the files that have been merged and reorganized;
[0172] Line 4: Loop condition, ensuring that the starting position already exists on the server side and that the starting position of the file segment is consistent with the merged directory file;
[0173] Line 5: Call a private method to merge and reorganize file fragments based on technologies such as file channels and file stream objects;
[0174] Line 6: Delete the redundant file fragments that have been merged and reorganized successfully;
[0175] Line 7: Update the fragment number of the file fragment, that is, update it to the fragment number of the next file fragment to be merged and reorganized;
[0176] Lines 8-9: Splice the absolute paths of the merged and reassembled files and create the corresponding File objects;
[0177] Line 10: Recalculate the starting position of the new file segment in the file;
[0178] Line 11: Re-obtain the size of the merged reorganized file;
[0179] The private method code in line 5 above is as follows:
[0180]
[0181] In the above private method, the file channel and file stream object methods are used to merge and reorganize file fragments.
[0182] Line 17, private method definition, source refers to the file fragment to be merged, des refers to the merged and reorganized file;
[0183] Lines 18 to 28 create file stream and file channel objects, obtain the file stream and file channel objects, and assign the file channel objects
[0184] Among them, line 27 specifies that the output stream of the file is in append mode to achieve merging and reorganization;
[0185] Line 29: Get the size of each slice file defined in the storage configuration;
[0186] Lines 30 to 35 calculate the starting position in the merged and reorganized target file based on the shard number. The bytes of the file shard to be transferred are truncated, that is, if these bytes to be transferred already exist, they are truncated and will not be merged again, to prevent the retry mechanism from causing redundant file shards to be saved and merged, thus affecting the accuracy of the merged and reorganized file.
[0187] Optionally, the above code portion can also be timed out. If the merge cannot be performed for a long time, it means that the file fragment may be missing or the file fragment on the storage side of the server is deleted or lost for some reason, making it impossible to obtain the complete file in any case. At this time, an error message should be thrown and the detailed reason for the error should be prompted.
[0188] Through the above-mentioned embodiments, a single file or sub-file that is divided into file fragments can be marked with fragment serial numbers after the division, and after the upload is completed, the various file fragments can be merged and reorganized according to the fragmentation needs to restore them to the original files before the division, thereby avoiding problems such as missing or wrong transmission of file fragments, repeated merging of file fragments, and incorrect merging due to divided uploads.
[0189] Optionally, the creating a temporary directory for the file set to be uploaded includes:
[0190] Creating a temporary directory with a universal unique identification code, and dot-hiding the created temporary directory so that the temporary directory is invisible in the user interface;
[0191] Set the properties of the temporary directory to the root user.
[0192] Specifically, in an embodiment of the present application, in order to prevent the administrator or user from accidentally deleting the file fragments being merged in the user interface, when creating a temporary directory in the upload directory, a universal unique identifier (UUID) can be used to create the temporary directory, and the created temporary directory can be hidden, so that the temporary directory is invisible in the user interface or the administrator interface of the server, and the temporary directory is set as the attribute of the root user (root user). Even if an ordinary user connects through an SFTP tool, the temporary directory will not be deleted or renamed. Secondly, if the temporary directory is placed under the upload directory, file reading and writing such as reading fragments and merging files occur in the same directory. For multiple storage situations, the occurrence of cross-storage data reading and writing can also be reduced.
[0193] Optionally, the method further comprises:
[0194] When the file set to be uploaded fails to be uploaded, error information of the upload failure is fed back to the user interface;
[0195] Re-upload the file that was being uploaded when the upload failed according to the configured preset error retry count.
[0196] Specifically, in the embodiment of the present application, an error handling and retry mechanism is set for uploading each file segment of each file to cope with network fluctuations or server errors or storage, disk and other abnormal problems. When the file segment is successfully uploaded, the server will return a response code of 200, indicating that the upload is successful. When the file segment fails to be uploaded, the error message of the upload failure needs to be fed back to the user interface, and the file segment needs to be uploaded again. The error message is captured and returned by the server code. In the case of a file segment transmission failure caused by network instability, the server may not be able to return an error message, resulting in a file segment transmission failure. At this time, the error message returned can be customized by the user interface. When due to resource overload timeout, storage abnormality, disk abnormality, etc., the server code captures the exception and returns it to the user interface for display according to the agreed data structure.
[0197] For the problems of file segment transmission failure caused by these two types of errors, the same retry mechanism is used to resend and re-upload the file slices at the breakpoint (where the upload failed). If it fails, the file that was being uploaded when the upload failed is re-uploaded according to the preset error retry times.
[0198] Preferably, due to the introduction of a retry mechanism for breakpoint resumption, when file slices are sent repeatedly, the server should ensure that the repeated slices will not be repeatedly reassembled and merged according to the order of the slice sequence numbers.
[0199] The value of the preset error retry times can be set according to actual needs and is not specifically limited here.
[0200] Through the above embodiments, an error handling and retry mechanism is set to cope with the problem of abnormal upload interruption at a breakpoint in the file transmission process, thereby improving the file transmission efficiency and user experience.
[0201] Optionally, the method further comprises:
[0202] Determine whether the number of re-uploads is greater than the preset number of error retries;
[0203] When the number of re-uploads is greater than the preset number of error retries and the file being uploaded when the upload fails cannot be completed, the file uploaded before the upload failure is cleaned up as dirty data.
[0204] Specifically, in an embodiment of the present application, in order to cope with the situation where the file upload cannot be recovered after being interrupted, that is, the file upload fails, the file segments that have been uploaded become dirty data. In order to avoid invalid occupation of resources, it is necessary to clean up the dirty data when the upload is interrupted and cannot be recovered. Therefore, it is necessary to determine whether the number of re-uploads is greater than the preset number of error retries. When it is greater than the preset number of error retries, it means that the upload cannot be recovered after being interrupted. At this time, it is determined that the file segments that have been uploaded before the upload failure and are temporarily stored in the temporary directory are dirty data, and they are cleaned up.
[0205] Optionally, a scheduled cleanup strategy can be set to clean up dirty data during a time period when the number of users of the artificial intelligence training platform is less than a preset threshold, for example, to clean up dirty data from 24 hours ago at 3 a.m.
[0206] The above embodiments can solve the problems of missing or multiple file segments during the merging and reorganization of file segments, and ensure the accuracy of the file segment sizes and file segment positions during the merging and reorganization of file segments.
[0207] Optionally, the method further comprises:
[0208] After the upload of the to-be-uploaded file set is completed, a consistency check is performed on the uploaded to-be-uploaded file set using a file verification code to obtain a verification result;
[0209] When the verification result indicates that the content of the to-be-uploaded file set is tampered with or damaged, the to-be-uploaded file set is re-uploaded.
[0210] Specifically, in an embodiment of the present application, the starting position is calculated based on the segment sequence number and the segment size, which can ensure that the file segment size and the file segment position are correct, but cannot guarantee the situation where the actual content of the file segment is incorrect. Therefore, the present application further uses a consistency verification algorithm strategy to perform a consistency verification on the files in the merged and reorganized file set to be uploaded after the upload of the file set to be uploaded is completed, so as to ensure the correctness of the merged and reorganized file set to be uploaded.
[0211] Among them, the consistency check algorithm strategy can be set based on the file checksum, which includes MD5 (a hash function used to convert a message of any length into a 128-bit hash value to ensure data integrity and detect data damage or tampering), SHA1 (a hash function used to convert a message of any length into a 160-bit hash value. SHA1 is more secure than MD5, but SHA1 is slower than MD5. SHA1 is commonly used in digital signatures, code signatures and encryption), CRC32 (a cyclic redundancy check algorithm used to convert a data block into a 32-bit checksum, CRC32, used to detect errors in data transmission or storage). These checksums are used to verify the integrity and consistency of files to ensure that the files have not been tampered with or damaged during transmission or storage.
[0212] The specific file verification code to be used can be adjusted and selected according to actual needs.
[0213] When it is determined after the consistency check that the check result indicates that the content of the file set to be uploaded has been tampered with or damaged, the tampered with or damaged part is re-uploaded.
[0214] Through the above embodiments, consistency check can be performed on files with correct file segment sizes and file segment positions after merging and reorganization, thereby preventing the actual content of the file segment from being tampered with or damaged, thereby improving the accuracy of file transmission and user experience.
[0215] Optionally, before verifying the integrity and consistency of the uploaded file set by using the file verification code, the following is further included:
[0216] Setting a sampling strategy and a sampling ratio, wherein the sampling strategy includes random sampling and stratified sampling;
[0217] Determine the files and / or file segments that need to be checked for consistency from the set of files to be uploaded according to the sampling strategy and the sampling ratio;
[0218] A consistency check is performed on the files and / or file segments that are determined to require a consistency check.
[0219] Specifically, in the embodiment of the present application, if a full check is performed (i.e., a consistency check is performed on each file segment of the uploaded and merged and reorganized file), although the highest data security can be guaranteed, the cost of the check will inevitably increase. Therefore, it is necessary to find a balance between file segmentation and consistency check. Based on this, the embodiment of the present application provides a rule configuration for consistency check, and defines the sampling ratio and sampling strategy.
[0220] First, set the sampling ratio. The sampling ratio ranges from 0 to 1. The larger the value, the higher the sampling ratio and the higher the security, but the greater the consistency check overhead.
[0221] Furthermore, the sampling strategy is set, which includes random sampling and stratified sampling.
[0222] According to the set sampling strategy and sampling ratio, the files and / or file fragments that need to be checked for consistency are determined from the set of files to be uploaded, and the consistency check is performed on the determined files and / or file fragments that need to be checked for consistency.
[0223] As a preference, users can determine the sampling ratio and sampling strategy based on the requirements for data security and upload efficiency. At the same time, the sampling ratio and sampling strategy can be dynamically adjusted according to changes in demand to balance the accuracy and efficiency of verification.
[0224] For the file shards to be checked for consistency, a consistency check is performed, and the file to be uploaded is selected on the user interface, and the sampling ratio and sampling strategy are set according to the user. According to the sampling ratio and sampling strategy, the hash value of the file shard is obtained, and the file stream of the file shard is sent. The check value and file stream of the file shard are submitted to the server for processing by submitting a form through an HTTP request using a POST request.
[0225] The following is a description of the specific process of consistency verification:
[0226] Step 1: Set the sampling ratio and sampling strategy.
[0227] Step 2: Determine the number of files or file slices for consistency check based on the file size or slice size and sampling ratio.
[0228] Step 3: According to the sampling strategy, determine the sequence number of the file or file slice to be checked for consistency.
[0229] a. Random sampling
[0230] Randomly select the serial numbers of all files or file slices, and use the Math.random() function combined with the array method to implement the sampling of the number of files or file slices in step 2.
[0231] b. Stratified sampling
[0232] Customize the stratified sampling function to determine the M files or M file slices that need to be extracted in each layer. According to the total number of files or file slices / M in step 2, determine the number of stratified layers, divide all files or file slices into different layers, and then extract M files or file slices from each layer.
[0233] Step 4: Send the file stream and hash value of the file or file slice to the server, and the server backend code receives the file stream and the hash value of the file or file slice passed by the user interface.
[0234] Preferably, the file stream is received and the hash value is calculated before the file stream is dropped to the disk to save storage resources and reduce the resource overhead of microservices. The file stream is read into the data buffer, and the data blocks in the stream are read cyclically to update the hash value. Once all the data has been read and processed, it will calculate the final hash value and convert it into a hexadecimal string representation. The calculated hash value is then compared with the hash value carried by the request sent by the front end to verify the consistency of the file or file slice. If they are consistent, the data of the file or file slice is dropped to the disk. If they are inconsistent, it means that an error may have occurred during the transmission of the file or file slice, and the upload task should be completed again.
[0235] Through the above embodiments, the consistency check process can be further optimized to balance the accuracy of file transmission and the efficiency of consistency check.
[0236] Figure 6 FIG. 1 is a flowchart of uploading and merging and reorganizing a file containing file fragments in a file transmission method provided in an embodiment of the present application, and is described by taking the first file fragment set of a single file as an example. Figure 6 shown.
[0237] First, determine whether the uploaded first file segment is the first first file segment of a single file according to the first segment sequence number. If it is the first first file segment of a single file, write it directly to the first target directory without writing it to the first temporary directory. If it is not the first first file segment of a single file, write it directly to the first temporary directory.
[0238] Further, it is determined whether the other first file segments are uploaded successfully. If they are not uploaded successfully, it is determined to be abnormal and a retransmission mechanism is performed. If it cannot be recovered, the upload is directly terminated.
[0239] Further, the other first file segments in the successfully uploaded area are merged and reorganized, and it is determined whether the merger and reorganization is successful, and the successfully merged and reorganized parts are cleared from the temporary file.
[0240] Finally, determine whether it is the last first file fragment in a single file. If it is the last first file fragment, directly write the first file fragment into the first target directory and merge and reorganize it with the merged and reorganized part to obtain a merged and reorganized single file.
[0241] The process of uploading and merging and reorganizing sub-files in multiple files is similar and will not be repeated here.
[0242] Figure 7 is a schematic diagram of a file transmission device provided by an embodiment of the present application. Figure 7 As shown, an embodiment of the present application provides a file transmission device, which is applied to a file management unit of an artificial intelligence training platform, wherein the file management unit is used to connect a user interface of the artificial intelligence training platform with a training service of the artificial intelligence training platform, and the device includes:
[0243] A detection module 11 is used to determine the type of the target file set and the file size of each file in the target file set when a target file set that a user needs to upload to the artificial intelligence training platform is detected in the user interface;
[0244] A determination module 12 is used to determine an upload strategy corresponding to the target file set according to the type of the target file set, determine a segmentation strategy for the target file set according to a size relationship between the file size of each file in the target file set and a preset file segmentation size, and segment the files in the target file set that meet the segmentation condition based on the segmentation strategy to obtain a file set to be uploaded, wherein the preset file segmentation size is determined based on a real-time upload rate of files in the file management unit detected by a northbound interface;
[0245] The uploading module 13 is used to upload the file set to be uploaded to the artificial intelligence training platform based on the uploading strategy.
[0246] Optionally, the determining module 12 includes:
[0247] A first determining unit, configured to determine that the upload strategy is a one-by-one upload strategy when the type of the target file set is a single file;
[0248] A second determining unit, configured to determine a size relationship between the file size of the single file and the preset file fragment size;
[0249] a third determining unit, configured to determine that the single file is the file set to be uploaded when the file size of the single file is less than or equal to the preset file fragment size, and to determine that the single file is the first file when the file size of the single file is greater than the preset file fragment size, and to split the single file, which is the first file, into a first file fragment set according to the preset file fragment size, and to determine that the first file fragment set is the file set to be uploaded, wherein the first file fragment set includes a plurality of first file fragments;
[0250] The upload module 13 includes: a first upload unit, which is used to add a single file or a plurality of first file segments included in the to-be-uploaded file set to the same file upload queue, and upload them one by one based on the one-by-one upload strategy.
[0251] Optionally, the determining module 12 includes:
[0252] A first upload strategy determination module, configured to determine, when the type of the target file set is a plurality of files, whether the upload strategy is a parallel upload strategy and / or a one-by-one upload strategy;
[0253] A fourth determining unit, configured to determine a size relationship between a file size of each sub-file in the plurality of files and the preset file fragment size;
[0254] a fifth determining unit, configured to determine that the subfile is a first file when the file size of the subfile is larger than the preset file fragment size, and split the subfile of the first file into a plurality of second file fragment sets according to the preset file fragment size, and determine that the plurality of second file fragment sets and the subfiles having a file size greater than or equal to the preset file fragment size are the file set to be uploaded, wherein the second file fragment set includes a plurality of second file fragments, and each second file fragment set corresponds to a subfile having a file size greater than the preset file fragment size;
[0255] The upload module 13 includes: a second upload unit, used to add the multiple second file fragment sets contained in the file set to be uploaded or the sub-files whose size is greater than or equal to the preset file fragment size to multiple file upload queues respectively, and perform parallel uploading based on the parallel upload strategy, wherein each of the second file fragment sets is uploaded one by one in the same file upload queue based on the one-by-one upload strategy.
[0256] Optionally, the device further comprises:
[0257] A first enqueue module, used for directly adding the to-be-uploaded file set to the file upload queue when the file upload queue is empty;
[0258] A second queue entry module, configured to add the to-be-uploaded file set to the file upload queue when the file upload queue is not empty, the queue length of the file upload queue is less than a preset length, and the size of the file segment in the file upload queue is less than a preset file segment size;
[0259] The third enqueue module is used to add the to-be-uploaded file set to the file upload queue after waiting for the files in the file upload queue to be uploaded, when the file upload queue is not empty, the queue length of the file upload queue is less than a preset length and the size of the file segments in the file upload queue is equal to the preset file segment size.
[0260] Optionally, the device further comprises:
[0261] a marking module, configured to mark the plurality of first file fragments included in the first file fragment set and the plurality of second file fragments included in the second file fragment set according to the segmentation order, so that each first file fragment has a first fragment sequence number corresponding thereto, and each second file fragment has a second fragment sequence number corresponding thereto;
[0262] A first reassembly module, configured to reassemble the first file fragment with other first file fragments according to the first fragment sequence number after the first file fragment is uploaded, to obtain a single file corresponding to the first file fragment set;
[0263] The second reassembly module is used to reassemble the second file fragment with other second file fragments according to the second fragment sequence number after the second file fragment is uploaded, so as to obtain a sub-file corresponding to the second file fragment set.
[0264] Optionally, the device further comprises:
[0265] A creation module, used to create a temporary directory for the file set to be uploaded, wherein the temporary directory includes a first temporary directory and a second temporary directory;
[0266] a first storage module, configured to store the uploaded first file fragment in the first temporary directory, reorganize the first file fragment with other first file fragments according to the first fragment sequence number in the first temporary directory, and after obtaining a single file corresponding to the first file fragment set, move the single file to a first target directory, and clean up the first temporary directory;
[0267] The second storage module is used to store the uploaded second file fragments in the second temporary directory, and in the second temporary directory, the second file fragments are reorganized with other second file fragments according to the second fragment sequence numbers, and after obtaining the sub-files corresponding to the second file fragment set, the sub-files are moved to the second target directory, and the second temporary directory is cleaned up.
[0268] Optionally, the creation module includes:
[0269] A creating unit, used to create a temporary directory with a universal unique identification code, and hide the created temporary directory to make the temporary directory invisible in the user interface;
[0270] A setting unit is used to set the attribute of the temporary directory to the root user.
[0271] Optionally, the device further comprises:
[0272] A feedback module, used for feeding back error information of the upload failure to the user interface when the upload of the to-be-uploaded file set fails;
[0273] The first retransmission module is used to re-upload the file being uploaded when the upload fails according to the configured preset error retry number.
[0274] Optionally, the device further comprises:
[0275] A judgment module is used to judge whether the number of re-uploads is greater than a preset number of error retries;
[0276] The cleaning module is used to clean up the files uploaded before the upload failure as dirty data when the number of re-uploads is greater than the preset error retry number and the file being uploaded cannot be uploaded completely when the upload fails.
[0277] Optionally, the device further comprises:
[0278] A verification module, used for performing consistency verification on the uploaded file set to be uploaded by using a file verification code after the file set to be uploaded is uploaded, to obtain a verification result;
[0279] The second retransmission module is used to re-upload the file set to be uploaded when the verification result indicates that the content of the file set to be uploaded is tampered with or damaged.
[0280] Optionally, the device further comprises:
[0281] A sampling module, used to set a sampling strategy and a sampling ratio before verifying the integrity and consistency of the uploaded file set through a file verification code, wherein the sampling strategy includes random sampling and stratified sampling;
[0282] A consistency check determination module, used to determine files and / or file segments that need to be checked for consistency from the set of files to be uploaded according to the sampling strategy and the sampling ratio;
[0283] The verification module is used to perform consistency verification on the files and / or file segments that are determined to need consistency verification.
[0284] Based on the same inventive concept, another embodiment of the present application further provides an electronic device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the file transfer method as described in any of the above embodiments.
[0285] Based on the same inventive concept, another embodiment of the present application further provides a computer program product, including a computer program, which is executed by a processor to perform the file transfer method described in any of the above embodiments.
[0286] Based on the same inventive concept, another embodiment of the present application further provides a computer-readable medium on which a computer program is stored, wherein when the program is executed by a processor, the file transfer method as described in any of the above embodiments is implemented.
[0287] As for the device, 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.
[0288] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0289] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, devices, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt 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.
[0290] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. 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 terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal 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.
[0291] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including 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.
[0292] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement 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.
[0293] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.
[0294] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal 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, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0295] The above is a detailed introduction to a file transfer method, device, electronic device, product and medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A file transmission method, characterized in that: A file management unit applied to an artificial intelligence training platform, the file management unit being used to connect a user interface of the artificial intelligence training platform with a training service of the artificial intelligence training platform, the method comprising: When it is detected in the user interface that a target file set that a user needs to upload to the artificial intelligence training platform is determined, the type of the target file set and the file size of each file in the target file set are determined; According to the type of the target file set, an upload strategy corresponding to the target file set is determined; according to the size relationship between the file size of each file in the target file set and the preset file segmentation size, a segmentation strategy for the target file set is determined; and based on the segmentation strategy, files in the target file set that meet the segmentation conditions are segmented to obtain a file set to be uploaded, wherein the preset file segmentation size is determined based on the real-time upload rate of the files in the file management unit detected by the northbound interface, and the real-time upload rate is measured in real time based on a real-time speed measurement script provided by the northbound interface before the file is uploaded, so as to obtain the maximum network bandwidth that the hardware device can support during file transmission; The file set to be uploaded is uploaded to the artificial intelligence training platform based on the upload strategy, including: different types of target file sets have different segmentation strategies and transmission strategies. For a target file set of a single file type, a single file or multiple first file fragments contained in the file set to be uploaded are added to the same file upload queue, and the single file or multiple first file fragments contained in the file set to be uploaded are uploaded one by one according to the one-by-one upload strategy; for a target file set of multiple files type, multiple second file fragment sets or sub-files whose file size is less than or equal to the preset file fragment size contained in the file set to be uploaded are added to multiple file upload queues respectively, the same second file fragment set is added to the same file upload queue, the same sub-file is added to the same file upload queue, and the sub-files or file fragment sets in the multiple file upload queues are uploaded in parallel based on the parallel upload strategy, wherein each second file fragment set is uploaded one by one in the same file upload queue based on the one-by-one upload strategy; The method further comprises: immediately merging and reorganizing the successfully uploaded and saved file segments, temporarily storing the uploaded file segments in the file being transferred in a temporary directory and merging and reorganizing them in the temporary directory, cleaning up the temporary files during the merging and reorganizing process, and executing the move operation after the last file segment is uploaded and merged and reorganized; The method further comprises: calculating the starting position of the file segments to be merged in the merged and reorganized target file according to the segment numbers, truncating the number of bytes of the file segments to be merged, and truncating the bytes to be transmitted in the file segments to be merged when the bytes to be transmitted already exist, without repeating the merging; The method immediately starts merging and reorganizing the successfully uploaded and saved file segments, including: obtaining the size of each file segment defined in the storage configuration, calculating the starting position of the file segment in the file according to the segment size of the file segment, obtaining the size of the merged and reorganized file in the file, ensuring that the starting position already exists on the server side, and the starting position of the file segment is consistent with the merged directory file, calling a private method, merging and reorganizing the file segments according to the file channel and the file stream object, deleting the redundant file segments that have been merged and reorganized successfully, updating the segment sequence number of the file segment, splicing the absolute path of the merged and reorganized file, and creating the corresponding file F ile object, recalculate the starting position of the new file segment in the file, and re-obtain the size of the merged and reorganized file, wherein the private method is to create a file stream and a file channel object, and assign the file channel object after obtaining the file stream and the file channel object, obtain the size of each slice file defined in the storage configuration, calculate the starting position of the file segment to be merged in the merged and reorganized target file according to the segment number, truncate the number of bytes of the file segment to be merged, and when the bytes to be transmitted of the file segment to be merged already exist, truncate them, and will not repeatedly merge the existing bytes to be transmitted.
2. The file transmission method according to claim 1, characterized in that: The step of determining a segmentation strategy for the target file set according to a size relationship between the file size of each file in the target file set and a preset file segment size, and segmenting the files in the target file set that meet the segmentation condition based on the segmentation strategy to obtain a file set to be uploaded includes: When the type of the target file set is a single file, determining that the upload strategy is a one-by-one upload strategy; Determine the size relationship between the file size of the single file and the preset file fragment size; When the file size of the single file is less than or equal to the preset file fragment size, the single file is determined to be the file set to be uploaded; when the file size of the single file is greater than the preset file fragment size, the single file is determined to be the first file, and the single file as the first file is split into a first file fragment set according to the preset file fragment size, and the first file fragment set is determined to be the file set to be uploaded, wherein the first file fragment set includes multiple first file fragments; The uploading of the file set to be uploaded to the artificial intelligence training platform based on the upload strategy includes: adding a single file or the multiple first file fragments contained in the file set to be uploaded to the same file upload queue, and uploading them one by one based on the one-by-one upload strategy.
3. The file transmission method according to claim 2, characterized in that: The step of determining a segmentation strategy for the target file set according to a size relationship between the file size of each file in the target file set and a preset file segment size, and segmenting the files in the target file set that meet the segmentation condition based on the segmentation strategy to obtain a file set to be uploaded includes: When the type of the target file set is multiple files, determining that the upload strategy is a parallel upload strategy and / or a one-by-one upload strategy; Determine a size relationship between a file size of each sub-file in the plurality of files and the preset file segment size; When the file size of the subfile is larger than the preset file fragment size, the subfile is determined to be the first file, and the subfile of the first file is split into a plurality of second file fragment sets according to the preset file fragment size, and the plurality of second file fragment sets and the subfiles whose file size is less than or equal to the preset file fragment size are determined to be the file set to be uploaded, the second file fragment set including a plurality of second file fragments, and each second file fragment set corresponding to a subfile whose file size is larger than the preset file fragment size; The method of uploading the file set to be uploaded to the artificial intelligence training platform based on the upload strategy includes: adding the multiple second file fragment sets contained in the file set to be uploaded or the sub-files whose file size is less than or equal to the preset file fragment size to multiple file upload queues respectively, and uploading them in parallel based on the parallel upload strategy, wherein each of the second file fragment sets is uploaded one by one in the same file upload queue based on the one-by-one upload strategy.
4. The file transmission method according to claim 3, characterized in that: The method further comprises: When the file upload queue is empty, directly adding the file set to be uploaded to the file upload queue; When the file upload queue is not empty, the queue length of the file upload queue is less than a preset length and the size of the file segment in the file upload queue is less than a preset file segment size, adding the file set to be uploaded to the file upload queue; When the file upload queue is not empty, the queue length of the file upload queue is less than the preset length and the size of the file segment in the file upload queue is equal to the preset file segment size, wait for the files in the file upload queue to be uploaded and then add the file set to be uploaded to the file upload queue.
5. The file transmission method according to claim 3, characterized in that: The method further comprises: Marking the plurality of first file fragments included in the first file fragment set and the plurality of second file fragments included in the second file fragment set according to the segmentation order, so that each first file fragment has a first fragment sequence number corresponding thereto, and each second file fragment has a second fragment sequence number corresponding thereto; After the first file fragment is uploaded, the first file fragment is reassembled with other first file fragments according to the first fragment sequence number to obtain a single file corresponding to the first file fragment set; After the second file fragment is uploaded, the second file fragment is reassembled with other second file fragments according to the second fragment sequence number to obtain a sub-file corresponding to the second file fragment set.
6. The file transmission method according to claim 5, characterized in that: The method further comprises: Creating a temporary directory for the file set to be uploaded, the temporary directory including a first temporary directory and a second temporary directory; The uploaded first file fragment is stored in the first temporary directory. In the first temporary directory, the first file fragment is reassembled with other first file fragments according to the first fragment sequence number. After obtaining a single file corresponding to the first file fragment set, the single file is moved to the first target directory, and the first temporary directory is cleaned up. The uploaded second file fragment is stored in the second temporary directory. In the second temporary directory, the second file fragment is reorganized with other second file fragments according to the second fragment sequence number. After obtaining the sub-file corresponding to the second file fragment set, the sub-file is moved to the second target directory, and the second temporary directory is cleaned up.
7. The file transmission method according to claim 6, characterized in that: The step of creating a temporary directory for the set of files to be uploaded includes: Creating a temporary directory with a universal unique identification code, and dot-hiding the created temporary directory so that the temporary directory is invisible in the user interface; Set the properties of the temporary directory to the root user.
8. The file transmission method according to claim 1, characterized in that: The method further comprises: When the file set to be uploaded fails to be uploaded, error information of the upload failure is fed back to the user interface; Re-upload the file that was being uploaded when the upload failed according to the configured preset error retry count.
9. The file transmission method according to claim 8, characterized in that: The method further comprises: Determine whether the number of re-uploads is greater than the preset number of error retries; When the number of re-uploads is greater than the preset number of error retries and the file being uploaded when the upload fails cannot be completed, the file uploaded before the upload failure is cleaned up as dirty data.
10. The file transmission method according to claim 3, characterized in that: The method further comprises: After the upload of the to-be-uploaded file set is completed, a consistency check is performed on the uploaded to-be-uploaded file set using a file verification code to obtain a verification result; When the verification result indicates that the content of the to-be-uploaded file set is tampered with or damaged, the to-be-uploaded file set is re-uploaded.
11. The file transmission method according to claim 10, characterized in that: Before the integrity and consistency of the uploaded file set is verified by the file verification code, the following is also included: Setting a sampling strategy and a sampling ratio, wherein the sampling strategy includes random sampling and stratified sampling; Determine the files and / or file segments that need to be checked for consistency from the set of files to be uploaded according to the sampling strategy and the sampling ratio; A consistency check is performed on the files and / or file segments that are determined to require a consistency check.
12. A file transmission device, characterized in that: A file management unit applied to an artificial intelligence training platform, the file management unit is used to connect the user interface of the artificial intelligence training platform with the training business of the artificial intelligence training platform, the device comprising: A detection module, configured to determine the type of the target file set and the file size of each file in the target file set when a target file set that a user needs to upload to the artificial intelligence training platform is detected in the user interface; A determination module, used to determine an upload strategy corresponding to the target file set according to the type of the target file set, determine a segmentation strategy for the target file set according to a size relationship between the file size of each file in the target file set and a preset file segmentation size, and segment the files in the target file set that meet the segmentation condition based on the segmentation strategy to obtain a file set to be uploaded, wherein the preset file segmentation size is determined based on a real-time upload rate of the files in the file management unit detected by the northbound interface, and the real-time upload rate is measured in real time based on a real-time speed measurement script provided by the northbound interface before the file is uploaded, so as to obtain a maximum network bandwidth that can be supported by the hardware device during file transmission; An upload module, used for uploading the to-be-uploaded file set to the artificial intelligence training platform based on the upload strategy, including: different types of target file sets have different segmentation strategies and transmission strategies, for a target file set of a single file type, a single file or multiple first file fragments contained in the to-be-uploaded file set are added to the same file upload queue, and the single file or multiple first file fragments contained in the to-be-uploaded file set are uploaded one by one according to the one-by-one upload strategy; for a target file set of multiple files type, multiple second file fragment sets or subfiles whose file size is less than or equal to the preset file fragment size contained in the to-be-uploaded file set are added to multiple file upload queues respectively, the same second file fragment set is added to the same file upload queue, the same subfile is added to the same file upload queue, and subfiles or file fragment sets in multiple file upload queues are uploaded in parallel based on the parallel upload strategy, wherein each second file fragment set is uploaded one by one in the same file upload queue based on the one-by-one upload strategy; The determination module is also used to: immediately start merging and reorganizing the successfully uploaded and saved file segments, temporarily store the uploaded file segments in the file being transferred in a temporary directory and merge and reorganize them in the temporary directory, clean up the temporary files during the merging and reorganization process, and wait until the last file segment is uploaded and merged and reorganized before performing the move operation; The determination module is further used to: calculate the starting position of the file segments to be merged in the merged and reorganized target file according to the segment numbers, truncate the number of bytes of the file segments to be merged, and when the bytes to be transmitted in the file segments to be merged already exist, truncate them and do not merge repeatedly; The method immediately starts merging and reorganizing the successfully uploaded and saved file segments, including: obtaining the size of each file segment defined in the storage configuration, calculating the starting position of the file segment in the file according to the segment size of the file segment, obtaining the size of the merged and reorganized file in the file, ensuring that the starting position already exists on the server side, and the starting position of the file segment is consistent with the merged directory file, calling a private method, merging and reorganizing the file segments according to the file channel and the file stream object, deleting the redundant file segments that have been merged and reorganized successfully, updating the segment sequence number of the file segment, splicing the absolute path of the merged and reorganized file, and creating the corresponding file F ile object, recalculate the starting position of the new file segment in the file, and re-obtain the size of the merged and reorganized file, wherein the private method is to create a file stream and a file channel object, and assign the file channel object after obtaining the file stream and the file channel object, obtain the size of each slice file defined in the storage configuration, calculate the starting position of the file segment to be merged in the merged and reorganized target file according to the segment number, truncate the number of bytes of the file segment to be merged, and when the bytes to be transmitted of the file segment to be merged already exist, truncate them, and will not repeatedly merge the existing bytes to be transmitted.
13. An electronic device, characterized in that: The device comprises a memory, a processor and a computer program stored in the memory, wherein the processor executes the computer program to implement the file transmission method according to any one of claims 1 to 11.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the file transmission method according to any one of claims 1 to 11 is implemented.
15. A computer readable medium, characterized in that A computer program is stored thereon, wherein when the computer program is executed by a processor, the file transmission method according to any one of claims 1 to 11 is implemented.
Citation Information
Patent Citations
Data transmission method and system
CN105610836A
File uploading method and device, equipment and storage medium
CN115987965A
