Resource storage method and device based on multi-al service tenant
By allocating resource isolation space for multi-tenant AI services and storing them according to resource type, the security and isolation issues of multi-tenant AI services are solved, and the needs for high availability and customization are met.
Patent Information
- Application Number
- CN202310345060.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-31
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2043-03-31
AI Technical Summary
In existing technologies, data resource isolation methods for multi-tenant AI services cannot effectively guarantee security and isolation, leading to security and availability issues of data resources among tenants.
By assigning a unique tenant identifier to each AI service tenant, the corresponding resource isolation space is determined, and AI service resources are stored in different isolation spaces according to resource type, including tenant-independent databases, Kubernetes namespaces, and AI service workspaces, thus achieving hard isolation.
It enables fine-grained isolation of AI service resources for multiple AI service tenants, preventing data spillover, ensuring high availability of AI services and meeting tenants' customization needs, and improving security and isolation.
Smart Images

Figure CN116599863B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, and in particular to a resource storage method and device based on multi-AI service tenants. BACKGROUND
[0002] With the continuous development of artificial intelligence (AI) technology and the wide demand for AI in various industries, a large number of AI services need to provide customized AI capabilities to meet user needs. Multi-tenant technology can effectively save the cost of developing systems by providing services to tenants in a shared system architecture environment, but it is necessary to ensure the isolation of data resources between tenants, and each tenant needs to configure the rented AI system according to its own needs.
[0003] In related technologies, the data resources between tenants are usually isolated by sharing data or sharing processes.
[0004] However, the method of relying on shared data and shared processes cannot guarantee the security of AI services and the isolation of data resources between tenants. Therefore, how to isolate the data resources of multi-tenants and ensure the security of the data resources of each tenant is a problem to be solved. SUMMARY
[0005] To solve the problems in the prior art, the embodiments of the present application provide a resource storage method and device based on multi-AI service tenants.
[0006] The present application provides a resource storage method based on multi-AI service tenants, comprising:
[0007] Obtaining tenant identifiers of at least two AI service tenants;
[0008] Based on the tenant identifier, at least one AI service resource isolation space corresponding to the AI service tenant is determined; different AI service resource isolation spaces are used to store different types of AI service resources;
[0009] Based on the type of AI service resource and the AI service resource isolation space corresponding to the AI service resource, the AI service resource is stored;
[0010] Based on different types of AI service resources stored in each AI service resource isolation space, the AI service is created in the target application.
[0011] Optionally, the type of AI service resource includes at least one of the following:
[0012] AI service file resources, which are file type resources required for creating the AI service;
[0013] AI service data resources, which are data type resources required when the AI service is created;
[0014] AI service interfaces, which are application programming interfaces (APIs) required when the AI service is run;
[0015] AI service running environment resources, which are running environment resources required when the AI service is run;
[0016] The resource isolation spaces at least include a tenant independent database, a Kubernetes namespace, an AI service workspace, and an AI service interface space; the tenant independent database is used to store the AI service data resources, the Kubernetes namespace is used to store the AI service running environment resources, the AI service workspace is used to store the AI service file resources, and the AI service interface space is used to store path information of the AI service interfaces.
[0017] Optionally, based on the tenant identifier, at least one AI service resource isolation space corresponding to the AI service tenant is determined, including:
[0018] For each AI service tenant, based on the tenant identifier, a first name corresponding to the tenant independent database and a second name corresponding to the Kubernetes namespace are created;
[0019] It is queried whether the first name exists, and in the case that the first name does not exist, the tenant independent database is determined based on the first name;
[0020] It is queried whether the second name exists, and in the case that the second name does not exist, the Kubernetes namespace is determined based on the second name;
[0021] Based on the tenant identifier, a workspace directory corresponding to the AI service is constructed, and based on the workspace directory, the AI service workspace is determined;
[0022] Based on the tenant identifier, API path information is generated, and based on the API path information, the AI service interface space is determined.
[0023] Optionally, based on the type of the AI service resource and the AI service resource isolation space corresponding to the AI service resource, the AI service resource is stored, including:
[0024] In the case that the type of the AI service resource includes the AI service file resource, the AI service file resource is stored to the AI service workspace;
[0025] in the case that the type of the AI service resource includes the AI service data resource, storing the AI service data resource to the tenant-independent database;
[0026] in the case that the type of the AI service resource includes the AI service interface, storing the API path information to the AI service interface space;
[0027] in the case that the type of the AI service resource includes the AI service running environment resource, storing the AI service running environment resource to the Kubernetes namespace.
[0028] Optionally, before the tenant identification of the at least two AI service tenants is acquired, the method further comprises:
[0029] for each of the AI service tenants, acquiring a timestamp and M random numbers at a current time; M is a positive integer;
[0030] performing base conversion on the timestamp and the M random numbers to generate the tenant identification.
[0031] Optionally, after the AI service is created in the target application, the method further comprises:
[0032] for any of the AI service tenants, running the AI service in the case that the AI service tenant calls the AI service.
[0033] The application further provides a resource storage device based on multiple AI service tenants, comprising:
[0034] a first acquisition module, configured to acquire tenant identification of at least two AI service tenants;
[0035] a determination module, configured to determine at least one AI service resource isolation space corresponding to the AI service tenant based on the tenant identification; different AI service resource isolation spaces are used to store different types of AI service resources;
[0036] a storage module, configured to store AI service resources based on the type of the AI service resources and the AI service resource isolation space corresponding to the AI service resources;
[0037] a creation module, configured to create the AI service in a target application based on different types of AI service resources stored in each of the AI service resource isolation spaces.
[0038] The application further provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the method for storing resources based on multiple AI service tenants according to any of the above when executing the program.
[0039] The application further provides a non-transitory computer-readable storage medium, which stores a computer program, and the computer program is executable on a processor to implement the method for storing resources based on multiple AI service tenants according to any of the above.
[0040] The application further provides a computer program product, which includes a computer program, and the computer program is executable on a processor to implement the method for storing resources based on multiple AI service tenants according to any of the above.
[0041] The application provides the method and device for storing resources based on multiple AI service tenants, determines at least one AI service resource isolation space for each AI service tenant based on the tenant identifier corresponding to each AI service tenant, and thus can store AI service resources based on the type of the AI service resources and the AI service resource isolation space corresponding to the AI service resources in the case of calling an AI service of any AI service tenant; that is, for each AI service tenant, different types of AI service resources associated with the AI service can be stored in different AI service resource isolation spaces for hard isolation; after isolating different types of AI service resources, an AI service can be created in a target application based on different types of AI service resources stored in each AI service resource isolation space. Through the above method, different types of AI service resources are isolated in different AI service resource isolation spaces for each AI service tenant, the AI service resources of multiple AI service tenants are isolated, data overflow between AI service tenants is prevented, the AI service relied on by the AI service tenant has high availability and more fine isolation, and the customized needs of different tenants are met. BRIEF DESCRIPTION OF DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the application or prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the application, and for those skilled in the art, other drawings can also be obtained without creative labor.
[0043] Figure 1 is one of the flowcharts of the method for storing resources based on multiple AI service tenants provided by the application;
[0044] Figure 2 is a schematic diagram of the resource isolation space corresponding to each tenant provided by the application.
[0045] Figure 3 is a flowchart of creating an AI service provided by the present application;
[0046] Figure 4 is a flowchart of a second method for storing resources based on a multi-AI service tenant provided by the present application;
[0047] Figure 5 is a structural diagram of a resource storage device based on a multi-AI service tenant provided by the present application;
[0048] Figure 6 is a structural diagram of an electronic device provided by the present application. DETAILED DESCRIPTION
[0049] To make the objectives, technical solutions, and advantages of the present application clearer, the technical solutions in the present application will be described clearly and completely below with reference to the drawings in the present application. Obviously, the described embodiments are some, but not all, of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the scope of protection of the present application.
[0050] To facilitate a clearer understanding of the embodiments of the present application, some related background knowledge will be introduced as follows.
[0051] In the face of AI service multi-tenant isolation, the resources that need to be isolated include algorithm files, model files, inference scripts, dataset files, AI service interfaces, and other resources. The operations of file isolation, data isolation, interface isolation, and running environment isolation for each independent AI service bring great challenges and complexity to the AI service platform.
[0052] Therefore, a comprehensive and deep AI service multi-tenant isolation method is needed to meet the independence, isolation, and security of AI services under different tenants. However, the traditional approach has the following problems:
[0053] 1) Relies on shared data
[0054] The common approach is to add a tenant identifier to each table in the database to distinguish the data of different tenants. This isolation level is the lowest, and the security is also the lowest. It is necessary to increase the development amount of security during design and development.
[0055] 2) Relies on shared processes
[0056] The common practice is that multiple tenants share the same AI service process, and the shared AI service is provided to multiple tenants simultaneously. The differentiation of different tenant customization requirements is only made within the shared AI service. If the service fails, it will affect the normal use of all tenants. Each tenant customization parameter needs to be integrated into the AI service, which increases the difficulty of maintaining the internal logic of the AI service.
[0057] Therefore, the method relying on shared data and shared processes cannot guarantee the security and resource isolation of the AI service. In summary, how to isolate the data resources of multiple tenants and ensure the security of the data resources of each tenant is a problem to be solved.
[0058] The terms related to the embodiments of the application are explained as follows:
[0059] 1. AI service: an independent container service that provides a Hyper Text Transfer Protocol (HTTP) interface.
[0060] 2. AI service gateway: the routing registration of the AI service is registered on the AI service gateway, and the gateway uniformly proxies access.
[0061] 3. AI service k8s deployment: an important pod controller on k8s, and the AI service pod is managed by deployment.
[0062] 4. AI service k8s service: it maps the specified port through a virtual IP to transfer the request from the proxy client to the AI service pod.
[0063] 5. AI service pv / pvc: a storage resource on k8s, mainly storing files under the AI service.
[0064] 6. Tenant independent database: an independent database for each tenant.
[0065] 7. Tenant k8s namespace: an independent namespace for each tenant.
[0066] The embodiments of the application are described below in combination with Figures 1 to 4 The resource storage method based on multiple AI service tenants provided by the application is specifically described. Figure 1 is one of the process flow diagrams of the resource storage method based on multiple AI service tenants provided by the application, as shown in Figure 1 The method comprises steps 101-104, wherein:
[0067] Step 101: obtaining the tenant identification of at least two AI service tenants.
[0068] First of all, it needs to be pointed out that the execution subject of the present application can be any electronic device capable of isolating the AI service resources of multiple tenants, such as a smart phone, a smart watch, a desktop computer, a laptop computer, etc.
[0069] In order to isolate the AI service resources of multiple AI service tenants, thereby ensuring that the AI services relied on by the AI service tenants have high availability and more fine isolation, in the present embodiment, first, the tenant identifier of at least two AI service tenants needs to be obtained.
[0070] The tenant identifier is a unique identifier of a tenant, used to represent the identity information of the tenant. When the tenant is opened, the execution subject assigns a unique identifier to it.
[0071] Considering that the tenant identifier not only has uniqueness, but also needs to consider that the tenant identifier can facilitate user's later search, identification, use and other operations, therefore, in actual application, the tenant identifier can be designed as a 10-digit short random number as a unique tenant identifier.
[0072] It can be understood that the tenant identifier can also be designed in other forms, such as combination of letters and numbers, special symbols, etc. The 10-digit short random number is only for preferred embodiment description, and the present application does not limit the form of the tenant identifier.
[0073] Step 102, based on the tenant identifier, determining at least one AI service resource isolation space corresponding to the AI service tenant; different AI service resource isolation spaces are used to store different types of AI service resources.
[0074] In the present embodiment, after generating the corresponding tenant identifier for each AI service tenant, at least one AI service resource isolation space needs to be determined for each AI service tenant, so that different types of AI service resources associated with the AI service can be isolated in different AI service resource isolation spaces.
[0075] Optionally, the type of the AI service resource includes at least one of the following:
[0076] a) AI service file resource, a file type resource required when creating the AI service;
[0077] Specifically, the AI service file resource may be, for example, an algorithm file, a model file, an inference script, a dataset file, etc. required when creating the AI service.
[0078] b) AI service data resource, a data type resource required when creating the AI service;
[0079] Specifically, the AI service data resource is the business data generated by the AI service when the AI service is created.
[0080] c) AI service interface, an application programming interface (API) required when running the AI service.
[0081] d) AI service running environment resources, running environment resources required when running the AI service.
[0082] Isolating different types of AI service resources associated with the AI service in different resource isolation spaces can achieve hard isolation between tenants and prevent data overflow between tenants.
[0083] Optionally, the resource isolation space includes at least a tenant-independent database, a Kubernetes namespace, an AI service workspace, and an AI service interface space; the tenant-independent database is used to store the AI service data resources, the Kubernetes namespace is used to store the AI service running environment resources, the AI service workspace is used to store the AI service file resources, and the AI service interface space is used to store the path information of the AI service interface.
[0084] It can be understood that Kubernetes, also known as k8s, is an open source used to manage containerized applications on multiple hosts in a cloud platform.
[0085] Figure 2 is a schematic diagram of the resource isolation space corresponding to each tenant provided by the present application. As shown in Figure 2 Tenant 1, tenant 2,..., and tenant N all have corresponding k8s namespaces and tenant-independent databases.
[0086] In the above embodiment, when creating an AI service tenant, an independent k8s namespace is allocated to each AI service tenant to manage AI service pod resources, and an independent database is created for each AI service tenant to store AI service data resources; based on the characteristics of k8s namespace isolation resources, AI service running environment resources of multiple AI service tenants are allocated to different k8s namespaces to achieve hard isolation of resources. The AI service on which the AI service tenant depends has high availability and more precise isolation to meet the customization needs of different tenants.
[0087] Step 103, based on the type of AI service resource and the AI service resource isolation space corresponding to the AI service resource, the AI service resource is stored.
[0088] In this embodiment, after determining at least one AI service resource isolation space for each AI service tenant, the different types of AI service resources associated with the AI service need to be stored in different AI service resource isolation spaces for hard isolation.
[0089] That is, different resource isolation strategies are adopted for different types of AI service resources, and different AI service resources are isolated in different AI service resource isolation spaces.
[0090] Step 104, creating the AI service in the target application based on the different types of AI service resources stored in each AI service resource isolation space.
[0091] After isolating different types of AI service resources, the AI service called by the tenant can be created in the target application.
[0092] The target application can be k8s or other applications for managing containerization on multiple hosts in a cloud platform.
[0093] The resource storage method and device based on multiple AI service tenants provided by the application can determine at least one AI service resource isolation space for each AI service tenant based on the tenant identifier corresponding to each AI service tenant, so that in the case of calling an AI service by any AI service tenant, the AI service resource can be stored based on the type of AI service resource and the AI service resource isolation space corresponding to the AI service resource; that is, for each AI service tenant, different types of AI service resources associated with the AI service can be stored in different AI service resource isolation spaces for hard isolation; after isolating different types of AI service resources, the AI service can be created in the target application based on the different types of AI service resources stored in each AI service resource isolation space; through the above method, different types of AI service resources are isolated in different AI service resource isolation spaces for each AI service tenant, which realizes the isolation of AI service resources of multiple AI service tenants, prevents data overflow between AI service tenants, ensures high availability and more precise isolation of AI services relied on by AI service tenants, and meets the customized needs of different tenants.
[0094] Optionally, in a possible implementation manner of the embodiment of the application, before the tenant identifier of each of the at least two AI service tenants is obtained, a tenant identifier needs to be generated for each AI service tenant; the generation can be implemented through the following steps 1) and 2):
[0095] Step 1), for each AI service tenant, obtaining a timestamp at the current time and M random numbers; M is a positive integer;
[0096] Step 2), converting the timestamp and the M random numbers into a base to generate the tenant identification.
[0097] In the embodiment, the timestamp at the current time is, for example, a 13-bit timestamp, and 2-bit random numbers are used considering the concurrent quantity of AI service tenants in actual application.
[0098] That is, for each AI service tenant, a 13-bit timestamp at the current time and 2-bit random numbers are obtained to obtain a 15-bit digital sequence; and the 15-bit digital sequence is converted into a base, for example, the 15-bit digital sequence is converted from decimal into thirty-two base to obtain a 10-bit short random number.
[0099] The thirty-two base symbols are composed of 0-9 and A-Y, which are 32 symbols in total.
[0100] In the above embodiment, the tenant identification generated based on the timestamp at the current time and the M random numbers can facilitate user's later operations such as searching, identifying, and using.
[0101] Optionally, in a possible implementation manner of the embodiment, the at least one AI service resource isolation space corresponding to the AI service tenant is determined based on the tenant identification, and the determination can be implemented through the following steps a)-e):
[0102] Step a), for each AI service tenant, a first name corresponding to the tenant independent database and a second name corresponding to the Kubernetes namespace are created based on the tenant identification;
[0103] Step b), it is inquired whether the first name exists, and in the case that the first name does not exist, the tenant independent database is determined based on the first name.
[0104] Step c), it is inquired whether the second name exists, and in the case that the second name does not exist, the Kubernetes namespace is determined based on the second name.
[0105] Step d), a workspace directory corresponding to the AI service is constructed based on the tenant identification; and the AI service workspace is determined based on the workspace directory.
[0106] Specifically, the workspace directory corresponding to the AI service is composed of ${workspace directory prefix}+${AI service Id}+${tenant identification}.
[0107] Step e), API path information is generated based on the tenant identification; and the AI service interface space is determined based on the API path information.
[0108] Specifically, since the API interfaces provided by the AI service runtime need to be isolated and not repeated, the tenant identifier needs to be added to the API interface prefix when generating the API interface address, and the API path information is generated. The format of the API path information is defined as follows: ${tenant identifier} / {custom path}.
[0109] In this embodiment, a database name variable (i.e., a first name) and a k8s namespace name variable (i.e., a second name) are defined.
[0110] That is, the database name variable is defined in the format of ${database prefix} - {tenant identifier}, and the k8s namespace name is defined in the format of ${namespace prefix} - {tenant identifier}.
[0111] After obtaining the database name variable, it is necessary to query whether the database name exists. In the case where the database name does not exist, a tenant-independent database is created based on the database name.
[0112] The specific implementation is to query whether the tenant-independent database with the name ${database prefix} - {tenant identifier} exists by calling a structured query language (SQL) statement. If the tenant-independent database with the name ${database prefix} - {tenant identifier} does not exist, a tenant-independent database with the name equal to ${database prefix} - {tenant identifier} is created by using the SQL statement.
[0113] After obtaining the k8s namespace name variable, it is necessary to query whether the k8s namespace name exists. In the case where the k8s namespace name does not exist, a k8s namespace is created based on the k8s namespace name.
[0114] The specific implementation is to query whether the k8s namespace with the name ${namespace prefix} - {tenant identifier} exists by using an http method to request a k8s API interface. If the k8s namespace with the name ${namespace prefix} - {tenant identifier} does not exist, a k8s namespace interface is called to create a k8s namespace with the name ${namespace prefix} - {tenant identifier}.
[0115] In the above embodiment, for each tenant, after creating the first name corresponding to the tenant-independent database and the second name corresponding to the k8s namespace, the first name of the tenant-independent database and the second name of the k8s namespace are created by querying whether the first name and the second name exist. In the case of not existing, the first name of the tenant-independent database and the second name of the k8s namespace are created. Through the above method, system resources are saved, and the creation efficiency of the resource isolation space is improved.
[0116] Optionally, when creating an AI service, an AI service tenant needs to select corresponding AI service file resources, AI service data resources, AI service interfaces, and AI service running environment resources, classify and store the above resources in the corresponding AI service resource isolation space. That is, when creating an AI service, an AI service tenant needs to select corresponding algorithm files, model files, inference scripts, dataset files, fill in AI service interface information, running parameters and other information, and classify and store them in the corresponding AI service resource isolation space according to the resource types used by the AI service.
[0117] The AI service resource isolation space corresponding to the type of the AI service resource and the AI service resource are stored, which can be realized by at least one of the following ways:
[0118] Method 1, in the case where the type of the AI service resource includes the AI service file resource, the AI service file resource is stored in the AI service workspace.
[0119] Method 2, in the case where the type of the AI service resource includes the AI service data resource, the AI service data resource is stored in the tenant-independent database.
[0120] Method 3, in the case where the type of the AI service resource includes the AI service interface, the API path information is stored in the AI service interface space.
[0121] Method 4, in the case where the type of the AI service resource includes the AI service running environment resource, the AI service running environment resource is stored in the Kubernetes namespace.
[0122] In the above embodiment, different types of AI service resources of each AI service tenant are isolated in different AI service resource isolation spaces, and the characteristics of k8s itself are used to isolate resources to realize hard isolation between AI service tenants, prevent data overflow between AI service tenants, and ensure that the AI service relied on by the AI service tenant has high availability and more fine isolation, and meets the customization needs of different AI service tenants.
[0123] Optionally, after isolating AI service resources of different types of AI service tenants in different AI service resource isolation spaces, the AI service can be created in k8s.
[0124] Figure 3 is a flowchart of creating an AI service provided by the present application, referring to Figure 3 As shown, specifically comprising steps 301 to 305:
[0125] Step 301, start creating an AI service.
[0126] Step 302, AI service addressing.
[0127] Step 303, create pv / pvc, AI service deployment resource (deployment), AI service service resource (service).
[0128] It should be noted that the above pv / pvc, AI service deployment, and AI service service are k8s resources required for creating an AI service in k8s. The k8s resources are created under different k8s namespaces to achieve hard isolation between tenants and prevent data overflow between tenants.
[0129] Step 304, register AI service gateway routing. That is, register the access method of the service on the gateway.
[0130] Step 305, AI service creation is successful.
[0131] Optionally, after creating the AI service in the target application, for any AI service tenant, when the AI service tenant calls the AI service, the AI service is run.
[0132] In this embodiment, the AI service tenant can call the service path generated by the AI service to access the AI service created by itself. The calling process is:
[0133] Request the AI service gateway through the http request method, route to the k8s service under the calling tenant k8s namespace through the gateway, and then access the pod service through the k8s service.
[0134] Figure 4 is a flowchart of a resource storage method based on multiple AI service tenants provided by the present application, referring to Figure 4 As shown, the method comprises steps 401-407, wherein:
[0135] Step 401, for each AI service tenant, obtain a timestamp and M random numbers at the current time; convert the timestamp and the M random numbers into a base to generate a tenant identifier; M is a positive integer.
[0136] Step 402, for each AI service tenant, based on the tenant identifier, create a first name corresponding to the tenant-independent database and a second name corresponding to the k8s namespace.
[0137] Step 403, query whether the first name exists, if the first name does not exist, determine the tenant-independent database based on the first name.
[0138] Step 404, query whether the second name exists, if the second name does not exist, determine the k8s namespace based on the second name.
[0139] Step 405, based on the tenant identifier, construct an AI service corresponding workspace directory; based on the workspace directory, determine an AI service workspace.
[0140] Step 406, based on the tenant identifier, generate API path information; based on the API path information, determine an AI service interface space.
[0141] It should be noted that the execution order of steps 402-404 and steps 405, 406 is not sequential.
[0142] Step 407, based on the type of AI service resource and the AI service resource isolation space corresponding to the AI service resource, store the AI service resource; wherein each AI service resource isolation space includes at least one of the following: AI service workspace, tenant-independent database, AI service interface space, k8s namespace.
[0143] Specifically, for each tenant, in the case that the type of AI service resource includes AI service file resource, the AI service file resource is stored to the AI service workspace;
[0144] In the case that the type of AI service resource includes AI service data resource, the AI service data resource is stored to the tenant-independent database;
[0145] In the case that the type of AI service resource includes AI service interface, the API path information is stored to the AI service interface space;
[0146] In the case that the type of AI service resource includes AI service running environment resource, the AI service running environment resource is stored to the k8s namespace.
[0147] Step 408, based on different types of AI service resources stored in each AI service resource isolation space, creating AI services in a target application.
[0148] Step 409, for any AI service tenant, running the AI service in the case that the AI service tenant calls the AI service.
[0149] The following describes the resource storage device based on multiple AI service tenants provided by the present application. The resource storage device based on multiple AI service tenants described below can be referred to in correspondence with the resource storage method based on multiple AI service tenants described above. Figure 5 is a structural schematic diagram of the resource storage device based on multiple AI service tenants provided by the present application. As shown in Figure 5 The resource storage device 500 based on multiple AI service tenants includes a first acquisition module 501, a determination module 502, a storage module 503, and a creation module 504, wherein:
[0150] The first acquisition module 501 is configured to acquire tenant identifiers of at least two AI service tenants.
[0151] The determination module 502 is configured to determine at least one AI service resource isolation space corresponding to the AI service tenant based on the tenant identifier. Different AI service resource isolation spaces are used to store different types of AI service resources.
[0152] The storage module 503 is configured to store the AI service resources based on the types of the AI service resources and the AI service resource isolation spaces corresponding to the AI service resources.
[0153] The creation module 504 is configured to create the AI services in a target application based on different types of AI service resources stored in each AI service resource isolation space.
[0154] The application provides a resource storage device based on multiple AI service tenants, determines at least one AI service resource isolation space for each AI service tenant based on a tenant identifier corresponding to each AI service tenant, and thus can store AI service resources based on the type of the AI service resources and the AI service resource isolation space corresponding to the AI service resources in the case of calling an AI service of any AI service tenant; that is, for each AI service tenant, different types of AI service resources associated with the AI service can be stored in different AI service resource isolation spaces for hard isolation; after isolating different types of AI service resources, an AI service can be created in a target application based on different types of AI service resources stored in each AI service resource isolation space; for each AI service tenant, different types of AI service resources are isolated in different AI service resource isolation spaces, which realizes the isolation of AI service resources of multiple AI service tenants, prevents data overflow between AI service tenants, guarantees the high availability and more fine isolation of AI services relied on by the AI service tenants, and meets the customized needs of different tenants.
[0155] Optionally, the type of the AI service resource includes at least one of the following:
[0156] The AI service file resource is a file type resource required for creating the AI service;
[0157] The AI service data resource is a data type resource required for creating the AI service;
[0158] The AI service interface is an application programming interface (API) required for running the AI service;
[0159] The AI service running environment resource is a running environment resource required for running the AI service.
[0160] The resource isolation space at least includes a tenant independent database, a Kubernetes namespace, an AI service workspace and an AI service interface space; the tenant independent database is used for storing the AI service data resource, the Kubernetes namespace is used for storing the AI service running environment resource, the AI service workspace is used for storing the AI service file resource, and the AI service interface space is used for storing path information of the AI service interface.
[0161] Optionally, the determination module 502 is further used for:
[0162] For each AI service tenant, a first name corresponding to the tenant independent database and a second name corresponding to the Kubernetes namespace are created based on the tenant identifier.
[0163] querying whether the first name exists, and in a case where the first name does not exist, determining the tenant-independent database based on the first name;
[0164] querying whether the second name exists, and in a case where the second name does not exist, determining the Kubernetes namespace based on the second name;
[0165] constructing a workspace directory corresponding to the AI service based on the tenant identifier, and determining the AI service workspace based on the workspace directory;
[0166] generating API path information based on the tenant identifier, and determining the AI service interface space based on the API path information.
[0167] Optionally, the storage module 503 is further used for:
[0168] in a case where the type of the AI service resource includes the AI service file resource, storing the AI service file resource to the AI service workspace;
[0169] in a case where the type of the AI service resource includes the AI service data resource, storing the AI service data resource to the tenant-independent database;
[0170] in a case where the type of the AI service resource includes the AI service interface, storing the API path information to the AI service interface space;
[0171] in a case where the type of the AI service resource includes the AI service running environment resource, storing the AI service running environment resource to the Kubernetes namespace.
[0172] Optionally, the apparatus further includes:
[0173] a second acquisition module configured to acquire, for each of the AI service tenants, a timestamp and M random numbers at a current time; M is a positive integer;
[0174] a generation module configured to perform a base conversion on the timestamp and the M random numbers to generate the tenant identifier.
[0175] Optionally, the apparatus further includes:
[0176] a running module configured to, for any of the AI service tenants, run the AI service in a case where the AI service tenant calls the AI service.
[0177] Figure 6This is a schematic diagram of the structure of the electronic device provided by the present invention, such as... Figure 6 As shown, the electronic device may include a processor 610, a communications interface 620, a memory 630, and a communication bus 640, wherein the processor 610, communications interface 620, and memory 630 communicate with each other via the communication bus 640. The processor 610 can invoke logical instructions in the memory 630 to execute a resource storage method based on multiple AI service tenants. This method includes: obtaining tenant identifiers of at least two AI service tenants; determining at least one AI service resource isolation space corresponding to the AI service tenant based on the tenant identifiers; using different AI service resource isolation spaces to store different types of AI service resources; storing the AI service resources based on their type and the corresponding AI service resource isolation space; and creating the AI service in a target application based on the different types of AI service resources stored in each of the AI service resource isolation spaces.
[0178] Furthermore, the logical instructions in the aforementioned memory 630 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0179] In another aspect, the present application also provides a computer program product, which comprises a computer program, the computer program being stored in a non-transitory computer readable storage medium, and the computer program being capable of executing the method for storing resources based on multiple AI service tenants provided by the above-mentioned methods when executed by a processor, the method comprising: obtaining tenant identifiers of at least two AI service tenants; determining at least one AI service resource isolation space corresponding to the AI service tenant based on the tenant identifiers; different AI service resource isolation spaces are used to store different types of AI service resources; storing the AI service resources based on the types of the AI service resources and the AI service resource isolation spaces corresponding to the AI service resources; and creating the AI service in a target application based on different types of AI service resources stored in each of the AI service resource isolation spaces.
[0180] In yet another aspect, the present application also provides a non-transitory computer readable storage medium, which stores a computer program, and the computer program is capable of executing the method for storing resources based on multiple AI service tenants provided by the above-mentioned methods when executed by a processor, the method comprising: obtaining tenant identifiers of at least two AI service tenants; determining at least one AI service resource isolation space corresponding to the AI service tenant based on the tenant identifiers; different AI service resource isolation spaces are used to store different types of AI service resources; storing the AI service resources based on the types of the AI service resources and the AI service resource isolation spaces corresponding to the AI service resources; and creating the AI service in a target application based on different types of AI service resources stored in each of the AI service resource isolation spaces.
[0181] The device embodiments described above are only schematic, wherein the units illustrated as separate components can or can not be physically separate, and the components illustrated as units can or can not be physical units, i.e., can be located in one place or distributed on a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the present embodiment. Those skilled in the art can understand and implement without creative labor.
[0182] Those skilled in the art can clearly understand the technical solutions of the various embodiments from the above description of the embodiments, and the various embodiments can be implemented by means of software with the necessary general hardware platforms, and of course, can also be implemented by hardware. Based on such understanding, the above technical solutions, essentially or in other words, the part of the prior art that makes a contribution, can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, and the like, and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0183] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for some technical features therein; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A resource storage method based on multi-AI service tenants, characterized in that, The method comprises the following steps: obtaining tenant identifiers of at least two AI service tenants; determining at least one AI service resource isolation space corresponding to the AI service tenant based on the tenant identifier; different AI service resource isolation spaces are used to store different types of AI service resources; storing the AI service resources based on the type of the AI service resources and the AI service resource isolation space corresponding to the AI service resources; creating the AI service in a target application based on different types of AI service resources stored in each AI service resource isolation space; the type of the AI service resource comprises at least one of the following: AI service file resources, which are file type resources required for creating the AI service; AI service data resources, which are data type resources required for creating the AI service; AI service interfaces, which are application programming interfaces (APIs) required for running the AI service; AI service running environment resources, which are running environment resources required for running the AI service; the resource isolation space at least comprises a tenant independent database, a Kubernetes namespace, an AI service workspace and an AI service interface space; the tenant independent database is used to store the AI service data resources, the Kubernetes namespace is used to store the AI service running environment resources, the AI service workspace is used to store the AI service file resources, and the AI service interface space is used to store path information of the AI service interface; the determination of the at least one AI service resource isolation space corresponding to the AI service tenant based on the tenant identifier comprises: for each AI service tenant, creating a first name corresponding to the tenant independent database and a second name corresponding to the Kubernetes namespace based on the tenant identifier; querying whether the first name exists, and determining the tenant independent database based on the first name if the first name does not exist; querying whether the second name exists, and determining the Kubernetes namespace based on the second name if the second name does not exist; constructing a workspace directory corresponding to the AI service based on the tenant identifier, and determining the AI service workspace based on the workspace directory; generating API path information based on the tenant identifier, and determining the AI service interface space based on the API path information. 2.The method of claim 1, wherein, the storage of the AI service resources based on the type of the AI service resources and the AI service resource isolation space corresponding to the AI service resources comprises: in the case where the type of the AI service resources comprises the AI service file resources, storing the AI service file resources in the AI service workspace; in the case where the type of the AI service resources comprises the AI service data resources, storing the AI service data resources in the tenant independent database; In a case where the type of the AI service resource includes the AI service interface, the API path information is stored to the AI service interface space; In a case where the type of the AI service resource includes the AI service running environment resource, the AI service running environment resource is stored to the Kubernetes namespace. 3.The method of claim 1, wherein, Before the tenant identifier of the at least two AI service tenants is acquired, the method further includes: For each of the AI service tenants, a timestamp and M random numbers at a current time are acquired; M is a positive integer; The timestamp and the M random numbers are converted to generate the tenant identifier. 4.The method of claim 1, wherein, After the AI service is created in the target application, the method further includes: For any of the AI service tenants, in a case where the AI service tenant calls the AI service, the AI service is run. 5.A resource storage device based on multi-AI service tenants, characterized in that, The method includes: A first acquisition module is configured to acquire a tenant identifier of at least two AI service tenants; A determination module is configured to determine, based on the tenant identifier, at least one AI service resource isolation space corresponding to the AI service tenant; different AI service resource isolation spaces are used to store different types of AI service resources; A storage module is configured to store, based on a type of an AI service resource and an AI service resource isolation space corresponding to the AI service resource, the AI service resource; A creation module is configured to create, based on different types of AI service resources stored in each of the AI service resource isolation spaces, the AI service in a target application; The type of the AI service resource includes at least one of the following: An AI service file resource is a file type resource required for creating the AI service; An AI service data resource is a data type resource required for creating the AI service; An AI service interface is an application programming interface (API) required for running the AI service; An AI service running environment resource is a running environment resource required for running the AI service; The resource isolation space includes at least a tenant independent database, a Kubernetes namespace, an AI service workspace, and an AI service interface space; the tenant independent database is used to store the AI service data resource, the Kubernetes namespace is used to store the AI service running environment resource, the AI service workspace is used to store the AI service file resource, and the AI service interface space is used to store path information of the AI service interface; The determination module is specifically configured to: For each of the AI service tenants, based on the tenant identifier, a first name corresponding to the tenant independent database and a second name corresponding to the Kubernetes namespace are created; It is queried whether the first name exists, and in a case where the first name does not exist, the tenant independent database is determined based on the first name; It is queried whether the second name exists, and in a case where the second name does not exist, the Kubernetes namespace is determined based on the second name; construct a workspace directory corresponding to the AI service based on the tenant identifier; and determine the AI service workspace based on the workspace directory; generate API path information based on the tenant identifier; determine the AI service interface space based on the API path information.
6. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor implements the resource storage method based on the multi-AI service tenant according to any one of claims 1 to 4 when executing the program.
7. A non-transitory computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program implements the resource storage method based on the multi-AI service tenant according to any one of claims 1 to 4 when executed by the processor.
8. A computer program product comprising a computer program, characterized in that, The computer program implements the resource storage method based on the multi-AI service tenant according to any one of claims 1 to 4 when executed by the processor.
Citation Information
Patent Citations
Cloud service method, device and equipment and storage medium
CN112637328A
Component cloud calling method and system based on micro-service architecture
CN114661493A