A method and apparatus for orchestrating template resources
By reading template resources and determining their dependencies, the resource list is automatically orchestrated, solving the problem of template resources not being able to be automatically orchestrated and simplifying the deployment and upgrade process.
Patent Information
- Application Number
- CN202110584219.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-27
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2041-05-27
AI Technical Summary
In existing technologies, resources in templates cannot be automatically orchestrated, leading to complex deployment processes and difficulties in application upgrades.
By reading resources from the template, an orchestration resource list is obtained. Based on the attributes of the resources, the dependencies between resources are determined, and dependent resources are arranged first in the orchestration resource list to achieve automatic resource orchestration.
It enables automatic orchestration of template resources, simplifying the deployment process and improving the efficiency of application upgrades.
Smart Images

Figure CN113504983B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of cloud computing, and particularly relates to a method and device for orchestrating template resources. BACKGROUND
[0002] With the popularity and application of cloud computing technology, computer application programs begin to be deployed in large quantities in the infrastructure of cloud computing technology. The deployment of complex computer applications relies on manual deployment, or hard coding, or script cooperation with manual implementation, and there are problems of complex deployment process and difficult application upgrade.
[0003] An application orchestration cloud service (AOS) provides an automatic capability for enterprises to deploy applications in the cloud, and uniformly describes required basic resources, application systems, application upper supporting services and the relationship therebetween through a standard language (YAML / JSON). The uniform description is to write a resource body and a template according to resource declaration specifications and template declaration specifications, define required input parameters, cloud computing resources, a dependency relationship between resources, and output data bodies of executing the template in the template. Then, an orchestration parser can automatically complete resource opening, application deployment and application service loading in one key according to the dependency order defined in the template.
[0004] Therefore, how to automatically orchestrate each resource included in the template becomes a technical problem to be solved. SUMMARY
[0005] The present application provides a method and device for orchestrating template resources, to solve the problem that resources in a template cannot be automatically orchestrated in the prior art.
[0006] In a first aspect, the present application provides a method for orchestrating template resources, and the method comprises the following steps.
[0007] reading each resource included in a template to obtain an orchestration resource list;
[0008] determining a dependency relationship between the resources based on attributes of the resources;
[0009] orchestrating the resources in the orchestration resource list based on the dependency relationship between the resources, wherein if a first resource depends on a second resource, the second resource is orchestrated before the first resource in the orchestration resource list.
[0010] Optionally, after reading each resource included in a template, and before determining a dependency relationship between the resources based on attributes of the resources, the method further comprises the following steps.
[0011] De-duplicate the resources in the orchestration resource list.
[0012] Optionally, determining the dependency relationship between the resources based on the attributes of the resources comprises:
[0013] Traverse the orchestration resource list in sequence from the first resource in the orchestration resource list;
[0014] Take the currently traversed resource as a target resource;
[0015] Obtain the attributes of the target resource and traverse the attributes of the target resource in sequence to determine whether the attributes of the target resource depend on other resources.
[0016] Optionally, the step of arranging the resources in the orchestration resource list based on the dependency relationship between the resources comprises:
[0017] If it is determined that one attribute of the target resource depends on other resources, replace the arrangement positions of the target resource and the resources it depends on in the orchestration resource list;
[0018] Take the resources it depends on as new target resources and perform the step of determining whether the attributes of the new target resources depend on other resources;
[0019] If it is determined that the attributes of the target resource do not depend on other resources, determine the current arrangement position of the target resource as the arrangement position of the target resource in the orchestration resource list, take the next resource of the target resource in the orchestration resource list as a new target resource, and perform the step of determining whether the attributes of the new target resource depend on other resources.
[0020] Optionally, the method further comprises:
[0021] After determining that all resources in the orchestration resource list have been arranged and processed, output the orchestration resource list after the arrangement is completed.
[0022] In a second aspect, the application provides a device for arranging template resources, the device comprising:
[0023] A reading unit configured to read each resource included in a template and obtain an orchestration resource list;
[0024] A determining unit configured to determine a dependency relationship between the resources based on the attributes of the resources;
[0025] The arrangement unit is configured to arrange the resources in the arrangement resource list based on the dependency relationship between the resources, wherein if a first resource depends on a second resource, the second resource is arranged before the first resource in the arrangement resource list.
[0026] Optionally, the apparatus further comprises:
[0027] The deduplication unit is configured to perform deduplication processing on the resources in the arrangement resource list.
[0028] Optionally, when determining the dependency relationship between the resources based on the attributes of the resources, the determination unit is specifically configured to:
[0029] traverse the arrangement resource list in sequence from a first resource in the arrangement resource list;
[0030] take the currently traversed resource as a target resource;
[0031] obtain the attributes of the target resource, and traverse the attributes of the target resource in sequence to determine whether the attributes of the target resource depend on other resources.
[0032] Optionally, when arranging the resources in the arrangement resource list based on the dependency relationship between the resources, the arrangement unit is specifically configured to:
[0033] if it is determined that one attribute of the target resource depends on other resources, replace the arrangement positions of the target resource and the resources it depends on in the arrangement resource list;
[0034] take the resources it depends on as a new target resource, and perform the step of determining whether the attributes of the new target resource depend on other resources;
[0035] if it is determined that the attributes of the target resource do not depend on other resources, determine the current arrangement position of the target resource as the arrangement position of the target resource in the arrangement resource list, take the next resource of the target resource in the arrangement resource list as a new target resource, and perform the step of determining whether the attributes of the new target resource depend on other resources.
[0036] Optionally, the apparatus further comprises:
[0037] The output unit is configured to output the arrangement resource list after the arrangement is completed after determining that all resources in the arrangement resource list have been arranged and processed.
[0038] In a third aspect, an embodiment of the present application provides an apparatus for arranging template resources, and the apparatus comprises:
[0039] a memory for storing program instructions;
[0040] a processor for invoking the program instructions stored in the memory to perform the steps of the method according to any one of the first aspect.
[0041] In a fourth aspect, the embodiments of the present application further provide a computer readable storage medium, which stores computer executable instructions for causing the computer to perform the steps of the method according to any one of the first aspect.
[0042] In summary, the method for orchestrating template resources provided by the embodiments of the present application reads each resource included in the template, obtains an orchestration resource list, determines the dependency relationship between the resources based on the attributes of the resources, and performs orchestration processing on the resources in the orchestration resource list based on the dependency relationship between the resources, wherein if a first resource depends on a second resource, the second resource is orchestrated before the first resource in the orchestration resource list.
[0043] The method for orchestrating template resources provided by the embodiments of the present application can determine whether the current parsed resource depends on other resources according to all attributes of the resources by traversing each resource included in the template, and finally arrange the resources that are depended on in the front row of the resource list based on the dependency relationship between the resources, thereby realizing the automatic orchestration of template resources. BRIEF DESCRIPTION OF DRAWINGS
[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed in the description of the embodiments of the present application or the prior art. Obviously, the drawings in the following description are only some embodiments described in the present application, and other drawings can also be obtained by those skilled in the art according to these drawings.
[0045] Figure 1 A detailed flowchart of the method for orchestrating template resources provided by the embodiments of the present application;
[0046] Figure 2 A structural schematic diagram of the device for orchestrating template resources provided by the embodiments of the present application;
[0047] Figure 3 A structural schematic diagram of another device for orchestrating template resources provided by the embodiments of the present application. DETAILED DESCRIPTION
[0048] The terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting thereof. As used in the description of the application and the claims the singular forms "a," "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that the term "and / or," as used herein, refers to and encompasses any and all possible combinations of one or more of the associated listed items.
[0049] It is to be understood that, although the terms first, second, third, etc. can be used herein to describe various information, these terms are not intended to denote a particular order or hierarchy. These terms are used only to distinguish one type of information from another. For example, a first information can be termed a second information, and similarly, a second information can be termed a first information, without departing from the scope of the application. Furthermore, the word "if' can be interpreted to mean "when" or "upon" or "in response to determining" depending on the context.
[0050] For example, refer to Figure 1 A detailed flowchart of a method for orchestrating template resources is shown, which includes the following steps:
[0051] Step 100: Read each resource included in the template to obtain an orchestration resource list.
[0052] In the embodiments of the application, the resources included in the template need to be determined in advance, and specifically, the resources and the template can be written in advance according to the resource declaration specification and the template declaration specification. That is, the resources required by the template are edited and added to the template in advance.
[0053] Then, each resource included in the template is read to obtain an orchestration resource list. Further, the resources are de-duplicated.
[0054] That is, after reading each resource included in the template, the same resource is de-duplicated to prevent repeated orchestration and analysis of the same resource.
[0055] Step 110: Determine the dependency relationship between the resources based on the attributes of the resources.
[0056] In the embodiments of the application, when the dependency relationship between the resources is determined based on the attributes of the resources, a preferred implementation manner is to start from the first resource in the orchestration resource list, sequentially traverse the orchestration resource list, take the currently traversed resource as a target resource, obtain the attributes of the target resource, and sequentially traverse the attributes of the target resource to determine whether the attributes of the target resource depend on other resources.
[0057] Dependency refers to that if a value of an attribute of a resource needs to be obtained from another resource, the resource depends on the other resource.
[0058] In actual application, whether a resource depends on other resources can be determined according to whether each attribute of the resource depends on other resources in a manner of parsing all attributes of the resource.
[0059] For example, the corresponding resource body attribute is obtained according to the resource type, and whether each attribute of the resource depends on other resources is recursively parsed. The recursive algorithm is as follows: if all attributes of the resource are basic classes (such as STRING / NUMBER / BOOLEAN / PASSWORD / JSON), it is determined that the resource does not depend on other resources, and the resource is optionally added to the sorted resource list (i.e., the current position of the resource in the resource list is determined as the arrangement position of the resource); if the attribute of the resource contains an extended type (KVP / ARRAY / MAP / TABLE), the extended type attribute is obtained, and whether the resource depends on other resources is determined according to the extended attribute type. If the extended attribute is a basic class, it is determined that the resource does not depend on other resources; otherwise, the attribute of the extended type is continuously obtained, and the category of the obtained extended attribute is continuously determined.
[0060] Step 120: based on the dependency relationship between the resources, the resources are arranged in the arranged resource list, wherein if a first resource depends on a second resource, the second resource is arranged before the first resource in the arranged resource list.
[0061] In the embodiment of the application, when the resources are arranged in the arranged resource list, a preferred implementation manner is that if it is determined that an attribute of the target resource depends on other resources, the arrangement positions of the target resource and the resource it depends on are replaced in the arranged resource list; the resource it depends on is taken as a new target resource, and the step of determining whether each attribute of the new target resource depends on other resources is performed; if it is determined that each attribute of the target resource does not depend on other resources, the current arrangement position of the target resource is determined as the arrangement position of the target resource in the arranged resource list, and the next resource of the target resource in the arranged resource list is taken as a new target resource, and the step of determining whether each attribute of the new target resource depends on other resources is performed.
[0062] For example, assuming that the read template includes resources including resource 1, resource 2, resource 3 and resource 4, and the initial arrangement order of the resources in the resource list is resource 1, resource 2, resource 3 and resource 4, first, for resource 1, the attributes of resource 1 are acquired in sequence, and it is determined in sequence whether each attribute depends on other resources, if it is determined that each attribute of resource 1 does not depend on other resources, the current position of resource 1 in the resource list is determined as the arrangement position in the resource list, then, for resource 2, the determination of whether it depends on other resources is performed; if it is determined that one attribute of resource 1 depends on resource 3, the arrangement positions of resource 1 and resource 3 in the resource list are replaced, and for resource 3, the determination of whether it depends on other resources is performed, according to the above execution rule, until the arrangement position of the last resource in the resource list is determined, the arrangement processing of the template resources is determined to be completed.
[0063] As can be seen from the above, assuming that the initial arrangement order of the resources in the resource list is resource 1, resource 2, resource 3 and resource 4, when resource 1 is parsed, if it is determined that resource 1 depends on resource 3, the arrangement order of the resources in the resource list is resource 3, resource 2, resource 1 and resource 4; then, resource 3 is parsed, if it is determined that resource 3 does not depend on other resources, the arrangement position of resource 3 is fixed; then, resource 2 is parsed, if it is determined that resource 2 depends on resource 4, the arrangement order of the resources in the resource list is resource 3, resource 4, resource 1 and resource 2; then, resource 4 is parsed, if it is determined that resource 4 depends only on resource 3 and does not depend on other resources, since resource 3 is in front of resource 4, it is not necessary to exchange the positions of resource 3 and resource 4, and the arrangement position of resource 4 is fixed; then, resource 1 is parsed, if resource 1 depends only on resource 3 and does not depend on other resources, the arrangement position of resource 1 is fixed, at this time, only resource 2 is not parsed, and no matter whether resource 2 depends on other resources, the arrangement position of resource 2 can be fixed, and finally, the arrangement order of the resources in the resource list is resource 3, resource 4, resource 1 and resource 2.
[0064] Further, after it is determined that all the resources in the arranged resource list have been arranged and processed, the arranged resource list after the arrangement is output.
[0065] The method for arranging template resources provided by the embodiments of the present application will be described in detail below in combination with a specific application scenario.
[0066] Step 1: read the resources deployed in the virtual machine template from the War package, including five resources: APP.APPLICATION, APP.GROUP, APP.SPRINGCLOUD, APP.WAR and APP.INSTANCE.
[0067] Step 2: The five resources have no repetition, so the order of the five resources after deduplication is APP.APPLICATION, APP.GROUP, APP.SPRINGCLOUD, APP.WAR, and APP.INSTANCE. The five resources are parsed and sorted one by one.
[0068] Step 3: Get all attributes of the APP.APPLICATION resource body, including package, appgroup_uuid, and name. Recursively analyze whether these three attributes depend on other resources. The recursive process is as follows:
[0069] (1) According to the type of the package attribute, it depends on one of the APP.WAR and APP.IMAGE resources. The template contains the APP.WAR resource, and the sorted resource list does not contain this resource. The priority of this resource is raised, and the positions of resources APP.APPLICATION and APP.WAR in the sorted resource list are replaced. The order of the five resources is APP.WAR, APP.GROUP, APP.SPRINGCLOUD, APP.APPLICATION, and APP.INSTANCE.
[0070] (2) Get all attributes of the APP.WAR resource body, including env, containerEnv, apm, and vm_metadata. Recursively analyze whether these four attributes depend on other resources: the first attribute env is of the extended type KVP, so its key and value types are both STRING basic types. The second attribute containerEnv is of the extended type TABLE, so its column name and value types are both STRING basic types. The third attribute apm is of the BOOLEAN basic type. The fourth attribute vm_metadata is of the extended type MAP, so its attribute instance is of the extended type ARRAY, and its value type is APP.INSTANCE, which depends on the APP.INSTANCE resource. The template contains this resource, and the sorted resource list does not contain this resource. The priority of this resource is raised, and the positions of resources APP.WAR and APP.INSTANCE in the sorted resource list are replaced. The order of the five resources is APP.INSTANCE, APP.GROUP, APP.SPRINGCLOUD, APP.APPLICATION, and APP.WAR.
[0071] (3) Get all attributes of APP.INSTANCE resource body, including instanceId and password, recursively analyze the types of the two attributes, which are STRING and PASSWORD respectively, both of which are basic types, then add the resource to the sorted resource list, and the first resource in the list is APP.INSTANCE.
[0072] Step 4: Get all attributes of APP.GROUP resource body, including name and svc_engine_id, recursively analyze whether the two attributes depend on other resources, and the recursive process is as follows:
[0073] (1) The first attribute name is of STRING basic type; the second attribute is of APP.SPRINGCLOUD: svc_engine_id, which depends on the svc_engine_id attribute of APP.SPRINGCLOUD resource, and the template contains this resource and the sorted resource list does not contain this resource, so the priority of this resource is raised, and the positions of resources APP.WAR and APP.INSTANCE in the sorted resource list are replaced, and the order of the five resources is APP.INSTANCE, APP.SPRINGCLOUD, APP.GROUP, APP.APPLICATION, and APP.WAR.
[0074] (2) Get all attributes of APP.SPRINGCLOUD resource body, including svc_engine_id and type, recursively analyze the types of the two attributes, which are both STRING basic types, then add the resource to the sorted resource list, and the second resource in the list is APP.SPRINGCLOUD.
[0075] Step 5: Get all attributes of APP.GROUP resource body, including name and svc_engine_id, recursively analyze whether the two attributes depend on other resources, and the recursive process is as follows:
[0076] (1) The first attribute name is of STRING basic type; the second attribute is of APP.SPRINGCLOUD: svc_engine_id, which depends on the svc_engine_id attribute of APP.SPRINGCLOUD resource, and the template contains this resource, but the sorted resource list already contains this resource, so no operation is performed;
[0077] (2) APP.GROUP resource is completely parsed, then add the resource to the sorted resource list, and the third resource in the list is APP.GROUP.
[0078] Step 6: Get all attributes of APP.APPLICATION resource body, including: package, appgroup uuid and name, recursively analyze whether these three attributes depend on other resources, the recursive process is as follows:
[0079] (1) From the type of the package attribute, it is known that it depends on one of the APP.WAR and APP.IMAGE resources, the template contains the APP.WAR resource, and the sorted resource list does not contain this resource, so the priority of this resource is raised, and the positions of the resources APP.APPLICATION and APP.WAR in the sorted resource list are replaced, and the order of the five resources is APP.INSTANCE, APP.SPRINGCLOUD, APP.GROUP, APP.WAR, APP.APPLICATION;
[0080] (2) Get all attributes of APP.WAR resource body, including env, containerEnv, apm and vm_metadata, recursively analyze whether these four attributes depend on other resources: the first attribute env is of the extension type KVP, so the types of its key and value are both STRING basic types; the second attribute containerEnv is of the extension type TABLE, so the types of its column name and value are both STRING basic types; the third attribute apm is of the BOOLEAN basic type; the fourth attribute vm_metadata is of the extension type MAP, so its attribute instance is of the extension type ARRAY, and its value is of the type APP.INSTANCE, which means it depends on the APP.INSTANCE resource, the template contains this resource, but the sorted resource list already contains this resource, so no operation is performed;
[0081] (3) After the APP.WAR resource is completely parsed, the resource is added to the sorted resource list, and the fourth resource in the list is APP.WAR.
[0082] Step 7: Get all attributes of APP.APPLICATION resource body, including: package, appgroup uuid and name, recursively analyze whether these three attributes depend on other resources, the recursive process is as follows:
[0083] (1) From the type of the package attribute, it is known that it depends on one of the APP.WAR and APP.IMAGE resources, the template contains the APP.WAR resource, but the sorted resource list already contains this resource, so no operation is performed;
[0084] (2) From the type of the appgroup uuid attribute, it is known that it depends on the uuid attribute of the APP.GROUP resource, the template contains this resource, but the sorted resource list already contains this resource, so no operation is performed;
[0085] (3) The third attribute name is a STRING basic type, and the attributes of the resource APP.APPLICATION are all parsed, then the resource is added to the sorted resource list, and the fifth resource in the list is APP.APPLICATION.
[0086] Step 8: The template all resources have been parsed, then the sorted resource list is output: APP.INSTANCE, APP.SPRINGCLOUD, APP.GROUP, APP.WAR, APP.APPLICATION,
[0087] Based on the same inventive concept as the above method embodiment, for example, referring to Figure 2 The device provided by the embodiment of the application is shown in the structural schematic diagram of the device for arranging template resources, and the device comprises:
[0088] The reading unit 20 is configured to read each resource included in the template, and obtain an arranged resource list.
[0089] The determining unit 21 is configured to determine the dependency relationship between the resources based on the attributes of the resources.
[0090] The arranging unit 22 is configured to arrange the resources in the arranged resource list based on the dependency relationship between the resources, and if a first resource depends on a second resource, the second resource is arranged before the first resource in the arranged resource list.
[0091] Optionally, the device further comprises:
[0092] The deduplication unit is configured to perform deduplication processing on each resource in the arranged resource list.
[0093] Optionally, when the dependency relationship between the resources is determined based on the attributes of the resources, the determining unit 21 is specifically configured to:
[0094] Start from the first resource in the arranged resource list, and sequentially traverse the arranged resource list.
[0095] The current traversed resource is taken as a target resource.
[0096] Obtaining attributes of the target resource, and sequentially traversing the attributes of the target resource to determine whether the attributes of the target resource depend on other resources.
[0097] Optionally, based on the dependency relationship between the resources, when the arrangement unit 22 performs the arrangement processing on the resources in the arrangement resource list, the arrangement unit 22 is specifically configured to:
[0098] If it is determined that one attribute of the target resource depends on other resources, the arrangement unit 22 replaces the arrangement positions of the target resource and the dependent resources in the arrangement resource list;
[0099] The arrangement unit 22 takes the dependent resources as new target resources, and performs the step of determining whether the attributes of the new target resources depend on other resources;
[0100] If it is determined that the attributes of the target resource do not depend on other resources, the arrangement unit 22 determines the current arrangement position of the target resource as the arrangement position of the target resource in the arrangement resource list, takes the next resource of the target resource in the arrangement resource list as a new target resource, and performs the step of determining whether the attributes of the new target resource depend on other resources.
[0101] Optionally, the apparatus further includes:
[0102] An output unit configured to output the arrangement resource list after the arrangement is completed, after determining that all the resources in the arrangement resource list have been arranged and processed.
[0103] The above units can be one or more integrated circuits configured to implement the above method, for example, one or more application specific integrated circuits (ASICs), or one or more digital signal processors (DSPs), or one or more field programmable gate arrays (FPGAs), etc. For another example, when a certain unit above is implemented in the form of a processing element scheduling code, the processing element can be a general-purpose processor, such as a central processing unit (CPU) or other processor that can invoke program code. For another example, the units can be integrated together to implement a system-on-a-chip (SOC).
[0104] Further, the apparatus for arranging template resources provided by the embodiment of the present application, from the hardware layer, the hardware architecture diagram of the apparatus for arranging template resources can be referred to as follows:Figure 3 As shown, the apparatus for orchestrating template resources can include a memory 30 and a processor 31,
[0105] The memory 30 is configured to store program instructions; the processor 31 invokes the program instructions stored in the memory 30, and performs the above-mentioned method embodiments according to the obtained program instructions. The specific implementation and technical effects are similar, and will not be repeated here.
[0106] Optionally, the present application also provides an apparatus for orchestrating template resources, comprising at least one processing element (or chip) for executing the above-mentioned method embodiments.
[0107] Optionally, the present application also provides a program product, for example, a computer readable storage medium, which stores computer executable instructions for causing the computer to execute the above-mentioned method embodiments.
[0108] Here, the machine readable storage medium can be any electronic, magnetic, optical, or other physical storage apparatus, which can contain or store information, such as executable instructions, data, and the like. For example, the machine readable storage medium can be: RAM (Radom Access Memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard disk drive), solid state disk, any type of storage disk (such as optical disk, dvd, etc.), or similar storage medium, or combination thereof.
[0109] The system, apparatus, module or unit illustrated in the above embodiments can be specifically implemented by a computer chip or entity, or by a product with certain functions. A typical implementation device is a computer, and the specific form of the computer can be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0110] For the convenience of description, the above apparatus is described as various units respectively described in terms of functions. Of course, in the implementation of the present application, the functions of each unit can be implemented in the same or more software and / or hardware.
[0111] Those skilled in the art will appreciate that embodiments of the application can be devised for a method, a system, or a computer program product. Accordingly, the present application can be embodied in the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present application can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage devices, and the like) embodying computer readable program code.
[0112] The present application is described in reference to the flowchart illustrations and / or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams.
[0113] Also, these computer program instructions can be stored in a computer readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture including instructions which implement the functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams.
[0114] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams.
[0115] The above description is embodied in the application only and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the scope of the present application.
Claims
1. A method for arranging template resources, characterized in that, The method includes: Read the resources included in the template and obtain the orchestration resource list; Based on the attributes of each resource, the dependencies between the resources are determined; Based on the dependencies between the resources, the resources are arranged in the resource arrangement list. If the first resource depends on the second resource, the second resource is arranged before the first resource in the resource arrangement list. The steps for determining the dependencies between the resources based on their respective attributes include: Starting from the first resource in the orchestration resource list, traverse the orchestration resource list sequentially; Use the currently traversed resource as the target resource; Obtain each attribute of the target resource, and iterate through each attribute of the target resource in turn to determine whether each attribute of the target resource depends on other resources; Specifically, if all attributes of a resource are base classes, then the resource is determined not to depend on other resources. If the resource's attributes contain extended types, then the attributes of the extended types are obtained, and the resource is determined to depend on other resources based on the type of the extended attributes. If the extended attributes are base classes, then the resource is determined not to depend on other resources. Otherwise, the attributes of the extended types are obtained, and the category of the obtained extended attributes is determined.
2. The method as described in claim 1, characterized in that, After reading the resources included in the template, and before determining the dependencies between the resources based on their attributes, the method further includes: The resources in the orchestrated resource list are deduplicated.
3. The method as described in claim 1, characterized in that, Based on the dependencies between the resources, the steps for orchestrating the resources in the orchestration resource list include: If it is determined that an attribute of the target resource depends on other resources, then the positions of the target resource and its dependent resources are swapped in the orchestrated resource list; The resource it depends on is taken as the new target resource, and the step of determining whether each attribute of the new target resource depends on other resources is performed. If it is determined that the attributes of the target resource do not depend on other resources, then the current arrangement position of the target resource is determined as the arrangement position of the target resource in the arrangement resource list, and the next resource of the target resource in the arrangement resource list is taken as the new target resource, and the step of determining whether the attributes of the new target resource depend on other resources is executed.
4. The method as described in claim 1, characterized in that, The method further includes: After confirming that all resources in the orchestration resource list have been orchestrated, output the orchestrated resource list after orchestration is completed.
5. An apparatus for arranging template resources, characterized in that, The device includes: The reading unit is used to read the resources included in the template and obtain the list of orchestration resources; The determining unit is used to determine the dependency relationship between the resources based on the attributes of each resource; An orchestration unit is used to orchestrate the resources in the orchestration resource list based on the dependencies between the resources, wherein if a first resource depends on a second resource, the second resource is orchestrated before the first resource in the orchestration resource list. When determining the dependencies between the resources based on their attributes, the determining unit is specifically used for: Starting from the first resource in the orchestration resource list, traverse the orchestration resource list sequentially; Use the currently traversed resource as the target resource; Obtain each attribute of the target resource, and iterate through each attribute of the target resource in turn to determine whether each attribute of the target resource depends on other resources; Specifically, if all attributes of a resource are base classes, then the resource is determined not to depend on other resources. If the resource's attributes contain extended types, then the attributes of the extended types are obtained, and the resource is determined to depend on other resources based on the type of the extended attributes. If the extended attributes are base classes, then the resource is determined not to depend on other resources. Otherwise, the attributes of the extended types are obtained, and the category of the obtained extended attributes is determined.
6. The apparatus as claimed in claim 5, characterized in that, The device further includes: The deduplication unit is used to deduplicatize each resource in the orchestrated resource list.
7. The apparatus as claimed in claim 5, characterized in that, Based on the dependencies between the resources, when arranging the resources in the orchestration resource list, the orchestration unit is specifically used for: If it is determined that an attribute of the target resource depends on other resources, then the arrangement positions of the target resource and its dependent resources are replaced in the orchestrated resource list; The resource it depends on is taken as the new target resource, and the step of determining whether each attribute of the new target resource depends on other resources is performed. If it is determined that the attributes of the target resource do not depend on other resources, then the current arrangement position of the target resource is determined as the arrangement position of the target resource in the arrangement resource list, and the next resource of the target resource in the arrangement resource list is taken as the new target resource, and the step of determining whether the attributes of the new target resource depend on other resources is executed.
8. The apparatus as claimed in claim 5, characterized in that, The device further includes: The output unit is used to output the orchestrated resource list after it is determined that all resources in the orchestrated resource list have been orchestrated.
Citation Information
Patent Citations
Resource arrangement method and device, medium and computing device
CN107526639A