WO2023029961A1 - 任务执行方法、系统、电子设备及计算机存储介质 - Google Patents

任务执行方法、系统、电子设备及计算机存储介质 Download PDF

Info

Publication number
WO2023029961A1
WO2023029961A1 PCT/CN2022/112463 CN2022112463W WO2023029961A1 WO 2023029961 A1 WO2023029961 A1 WO 2023029961A1 CN 2022112463 W CN2022112463 W CN 2022112463W WO 2023029961 A1 WO2023029961 A1 WO 2023029961A1
Authority
WO
WIPO (PCT)
Prior art keywords
code
environment
execution
execution environment
cloud
Prior art date
Application number
PCT/CN2022/112463
Other languages
English (en)
French (fr)
Inventor
刘大鹏
雷飞尉
杨敬宇
朱红儒
Original Assignee
阿里巴巴(中国)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 阿里巴巴(中国)有限公司 filed Critical 阿里巴巴(中国)有限公司
Publication of WO2023029961A1 publication Critical patent/WO2023029961A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines

Definitions

  • the embodiments of the present application relate to the technical field of the Internet, and in particular, to a task execution method, system, electronic device, and computer storage medium.
  • Edge cloud technology also known as edge cloud computing technology, is a technology based on the core of cloud computing technology and edge computing capabilities, and a cloud computing platform built on the basis of edge facilities for data processing and computing.
  • edge cloud technology can provide edge cloud computing infrastructure services, such as computing, storage, network, accelerator, etc., as well as edge cloud computing platform services, such as container services, big data services, artificial intelligence services, instant messaging services RTC, video AI , audio and video communication, etc.
  • edge cloud technology In the current system based on edge cloud technology, the client is still responsible for a large number of data calculation and execution tasks. How to use edge cloud technology to reduce the task execution burden of the client, improve its running speed, and optimize the performance of the client , has become an urgent problem to be solved.
  • this embodiment of the present application provides a task execution solution to at least partially solve the above problem.
  • a method for executing a task which is applied to a client, and the method includes: during the process of executing the program code through the code execution environment, detecting the trigger execution code of the preset task; According to the trigger execution code, query the scheduling policy through the code execution environment to obtain the scheduling policy for the preset task; schedule the preset task to the obtained task through the environment communication interface of the code execution environment Execute in the code execution environment of the cloud target device indicated by the scheduling policy.
  • the scheduling the preset task to be executed in the code execution environment of the cloud target device indicated by the obtained scheduling policy through the environment communication interface of the code execution environment includes: through the code execution environment Execution environment, obtaining the environment execution code of the preset task, the environment execution code is a code that can be executed in the code execution environment; passing the environment execution code of the preset task through the environment of the code execution environment The communication interface is scheduled to be executed in the code execution environment of the cloud target device indicated by the obtained scheduling policy.
  • the scheduling the environment execution code of the preset task to be executed in the code execution environment of the cloud target device indicated by the obtained scheduling policy through the environment communication interface of the code execution environment includes: Send the environment parameters of the code execution environment of the client and the environment execution of the preset task to the environment communication interface of the code execution environment of the cloud target device indicated by the scheduling policy through the environment communication interface of the code execution environment code, so that the cloud target device initializes its own code execution environment according to the environment parameters, and executes the environment execution code of the preset task after the initialization is completed.
  • the step of executing the code according to the trigger, and querying the scheduling strategy through the code execution environment to obtain the scheduling strategy for the preset task includes: executing the code according to the trigger, through the code execution environment Sending a scheduling strategy query request for the preset task to the edge cloud and/or the central cloud; receiving a query result in response to the scheduling strategy query request, and obtaining a scheduling strategy for the preset task according to the query result.
  • the step of executing the code according to the trigger, and querying the scheduling strategy through the code execution environment to obtain the scheduling strategy for the preset task includes: executing the code according to the trigger, through the code execution environment Perform a local scheduling strategy query on the client, and obtain the scheduling strategy for the preset task.
  • the method further includes: receiving a system call instruction including calling the preset task ; Create a code execution environment for the program corresponding to the system call instruction, so that the preset task is executed in the code execution environment.
  • system call instruction is set in a link library of the programming language used by the application to which the preset task belongs.
  • the task execution method in the first aspect further includes: receiving the preset task returned by the cloud target device through the environment communication interface of its code execution environment to the environment communication interface of the client's code execution environment Results of the.
  • the code execution environment is a code execution environment based on the WEBASSEMBLY standard.
  • another task execution method is provided, which is applied to the cloud.
  • the method includes: receiving the preset task scheduling policy query request; in response to the scheduling policy query request, obtain the running status information of the cloud; determine the target device in the cloud that can execute the preset task according to the running status information, and according to the The target device determines a scheduling policy; and sends the scheduling policy to the code execution environment of the client through the environment communication interface of the cloud code execution environment.
  • the task execution method of the second aspect further includes: receiving the environment parameters of the client code execution environment and the preset task sent by the client through the environment communication interface of the code execution environment in the target device environment execution code, the environment execution code is a code that can be executed in the code execution environment: initialize the code execution environment of the target device according to the environment parameters, and execute the preset task after the initialization is completed The environment executes the code.
  • the task execution method of the second aspect further includes: returning the execution result of the preset task to the code execution environment of the client through the environment communication interface of the code execution environment in the target device.
  • the task execution method on the second aspect further includes: if it is determined according to the running state information that there is no target device capable of executing the preset task in the cloud, communicating through the environment of the code execution environment in the cloud An interface for returning task rejection information to the code execution environment of the client, so that the client executes the preset task in its own code execution environment.
  • the running status information of the cloud includes load status information and/or network connection status information.
  • the code execution environment is a code execution environment based on the WEBASSEMBLY standard.
  • a task execution system including at least: a client and a cloud; wherein: the client is configured to detect a predetermined Set the trigger execution code of the task; according to the trigger execution code, query the scheduling strategy to the cloud through the code execution environment to obtain the scheduling strategy for the preset task; pass the preset task through the code
  • the environment communication interface of the execution environment is scheduled to be executed in the code execution environment of the cloud target device indicated by the obtained scheduling policy; the cloud is used to receive the client through the environment communication interface of the cloud code execution environment
  • the scheduling policy query request sent for the preset task determine and return the scheduling policy to the code execution environment of the client; and, through the target device indicated by the scheduling policy
  • the code execution environment executes the preset task dispatched by the client.
  • the client obtains the environment execution code of the preset task through the code execution environment of the client, and the environment execution code is a code that can be executed in the code execution environment; the preset task The environment execution code is sent to the code execution environment of the target device for execution through the environment communication interface of the code execution environment.
  • the code execution environment is a code execution environment based on the WEBASSEMBLY standard.
  • an electronic device including: a processor, a memory, a communication interface, and a communication bus, and the processor, the memory, and the communication interface complete the mutual communication via the communication bus. communication among them; the memory is used to store at least one executable instruction, and the executable instruction causes the processor to execute the operation corresponding to the task execution method described in the first aspect or the second aspect.
  • a computer storage medium on which a computer program is stored, and when the program is executed by a processor, the task execution method as described in the first aspect or the second aspect is implemented.
  • a computer program product including computer instructions, where the computer instructions instruct a computing device to perform operations corresponding to the task execution method described in the first aspect or the second aspect.
  • the code execution environment in order to reduce the task execution burden of the client, can be configured in the client and the cloud device, and the code execution environment can be mainly used for the execution process of the program code.
  • the code execution environment in the cloud is usually the same, so that tasks that can be executed on the client can also be executed in the cloud.
  • the client detects the trigger execution code of the preset task, it indicates that the preset task needs to be executed.
  • the client still passes the The code executes the environment query and obtains the scheduling strategy for the preset task, so as to determine to schedule the preset task to a target device in the cloud for execution.
  • the performance of cloud devices is usually better than that of the client, executing the preset task through the cloud can not only reduce the task execution burden of the client, but also improve the execution efficiency and speed of the preset task, thereby optimizing the Client performance.
  • the client and the cloud interact directly through their code execution environments, so that preset tasks can be executed by the code execution environment of the cloud target device without additional processing, further improving the execution of preset tasks efficiency.
  • the client can perform task feedback based on the execution results of the preset tasks of the cloud device in the future. Because the preset task execution efficiency is high, the task feedback efficiency is also high, thereby improving the execution speed and efficiency of the preset tasks as a whole. It also improves the running speed of the client and optimizes the performance of the client.
  • FIG. 1 is a schematic diagram of an exemplary system applicable to the task execution method of the embodiment of the present application
  • FIG. 2A is a flow chart of steps of a task execution method according to Embodiment 1 of the present application.
  • FIG. 2B is a schematic diagram of a scenario example in the embodiment shown in FIG. 2A;
  • FIG. 3A is a flow chart of steps of a task execution method according to Embodiment 2 of the present application.
  • Fig. 3B is a schematic diagram of a task execution process in the embodiment shown in Fig. 3A;
  • FIG. 4 is a flow chart of steps of a task execution method according to Embodiment 3 of the present application.
  • FIG. 5 is a schematic structural diagram of an electronic device according to Embodiment 5 of the present application.
  • Fig. 1 shows an exemplary system applicable to the task execution method of the embodiment of the present application.
  • the edge cloud system 100 may include an edge cloud 102 , a communication network 1042 and/or one or more clients 106 , multiple clients are exemplified in FIG. 1 .
  • the edge cloud system can also be connected to the central cloud 108 through the communication network 1044 , and the client 106 in the edge cloud system 100 can communicate with the central cloud 108 through the edge cloud 102 or directly communicate with the central cloud.
  • Edge cloud 102 may be implemented as a server or cluster of servers for computational processing, storage of information, data, programs, and/or any other suitable type of content.
  • edge cloud 102 may perform any suitable function.
  • the edge cloud 102 can be used to share the data calculation and processing tasks of the client, so as to reduce the burden on the client, and can reduce the software and hardware performance requirements for the client, thereby reducing the implementation cost of the client.
  • the edge cloud 102 can be used to interact with the code execution environment of the client 106 through the code execution environment, and can receive some tasks to be executed by the client 106 to be executed on the edge cloud 102. executed in the code execution environment.
  • communication network 1042 may be any suitable combination of one or more wired and/or wireless networks.
  • communication network 1042 can include any one or more of the following: the Internet, an intranet, a wide area network (WAN), a local area network (LAN), a wireless network, a digital subscriber line (DSL) network, a frame relay network, Asynchronous Transfer Mode (ATM) network, Virtual Private Network (VPN) and/or any other suitable communication network.
  • Communications network 1044 may also be any suitable combination of one or more wired and/or wireless networks. For example, Internet, Wide Area Network (WAN), wireless network, etc.
  • Client 106 can connect to communication networks 1042 and 1044 via one or more communication links, which can be linked to edge cloud 102 and central cloud 108 via one or more communication links.
  • the communication link may be any communication link suitable for transferring data between the client 106 and the edge cloud 102 and the central cloud 108, such as a network link, a dial-up link, a wireless link, a hardwired link, any other A suitable communication link or any suitable combination of such links.
  • Client 106 may include any one or more clients that can perform tasks such as data processing and data calculation.
  • client 106 may comprise any suitable type of device.
  • clients 106 may include smart IoT (Internet of Things) devices, mobile devices, tablet computers, laptop computers, desktop computers, wearable computers, game consoles, media players, vehicle entertainment systems and/or any other suitable type of client.
  • the client 106 can be used to realize the interaction between the code execution environment in the edge cloud 102 and the central cloud 108 through its own code security environment, so as to implement task scheduling and execution.
  • edge cloud 102 and central cloud 108 are illustrated as one device, in some embodiments any suitable number of devices may be used to perform the functions performed by edge cloud 102 and central cloud 108 . For example, in some embodiments, multiple devices may be used to implement the functions performed by edge cloud 102 . Alternatively, multiple devices may be used to implement the functions performed by the central cloud 108 .
  • the code execution environment is used to serve the code operation, which can be realized through appropriate execution environment tools, such as WEBASSEMBLY RUNTIME, JAVASCRIPT RUNTIME, etc.
  • execution environment tools such as WEBASSEMBLY RUNTIME, JAVASCRIPT RUNTIME, etc.
  • the code execution environment in the embodiment of the present application can communicate with the code execution environment in other devices through the set environment communication interface.
  • the environment communication interface communicates directly, which greatly improves the communication efficiency and speed.
  • the subsequent code does not need to be converted between the environment and the environment, and can be directly transmitted from one device to another. device is running.
  • the code execution environment in the embodiment of this application has also expanded new functions, which can query and interact with scheduling policies for tasks, and based on the query and interaction results, transfer tasks to corresponding target devices for implementation.
  • the client 106 can send a scheduling policy query request to the code execution environment in the edge cloud 102 and/or the central cloud 108 through its own code security environment, and can send the corresponding task to be executed to the corresponding
  • the code execution environment in the edge cloud 102 and/or the central cloud 108 implements task scheduling.
  • an embodiment of the present application provides a method for executing a task, which will be described below through multiple embodiments.
  • FIG. 2A it shows a flowchart of steps of a task execution method according to Embodiment 1 of the present application.
  • This embodiment describes the task execution method of the embodiment of the present application from the perspective of the client of the edge cloud system.
  • the task execution method includes the following steps:
  • Step S202 During the process of executing the program code through the code execution environment, it is detected that the trigger of the preset task executes the code.
  • the client needs to be able to support the code execution environment, so as to run the program code in it.
  • the code execution environment can be preset and initialized when a program needs to be used, or can be created and initialized for the program when a program needs the code execution environment to support its operation. Provided to the program after initialization.
  • code execution environment can be implemented by those skilled in the art using appropriate tools according to the actual situation of the client, for example, through WEBASSEMBLY RUNTIME or JAVASCRIPT RUNTIME or other RUNTIME.
  • the code execution environment may be implemented as a code execution environment based on the WEBASSEMBLY standard.
  • WEBASSEMBLY is a standardized byte file format defined by W3C. It can compile programming languages such as C++ into WEBASSEMBLY byte format (also called bytecode), and run it in WEBASSEMBLY RUNTIME; it also supports calling WEBASSEMBLY in other languages, such as JAVASCRIPT code module. Its core is a virtual instruction architecture oriented to multiple application scenarios, which can be embedded in different application environments and support high-performance web applications. As a virtual machine and execution environment, WEBASSEMBLY allows loaded pages to run as natively compiled code, improving web performance and power consumption. As a result, WEBASSEMBLY can achieve performance close to native speed and optimize loading time.
  • WEBASSEMBLY RUNTIME is the runtime environment of WEBASSEMBLY, which can be a runtime environment such as a virtual machine running WEBASSEMBLY code.
  • WEBASSEMBLY provides a sandbox function.
  • the WASM code module runs in its private sandbox.
  • the standardized byte file format of WEBASSEMBLY can also be considered as a low-level programming language, but unlike machine language, it can use more characters, and has better flexibility and scalability than machine language. Because of its flexibility and scalability, corresponding function settings can be made based on this to meet different application requirements.
  • WEBASSEMBLY RUNTIME can also effectively isolate the code, so as to realize the security guarantee of the code execution environment.
  • WEBASSEMBLY standard is relatively mature, applying it to the implementation of the code execution environment can also greatly save the cost of solution implementation and save research and development costs.
  • the program code can be run. For example, if the code execution environment is set in the browser frame, the JS engine can be combined to execute the webpage code while parsing, that is, in the JS engine After parsing, the code will be run by the code execution environment. Similarly, codes in other languages can also be run by the code execution environment.
  • the code execution environment can detect these program codes to determine whether there is program code for preset tasks.
  • the program code of the preset task is usually the code that needs to be executed by the cloud (which may include at least one of the edge cloud 102 and the central cloud 108), such as the code that can be executed by the edge cloud 102, or The code executed by the central cloud 108 , or partly executed by the edge cloud 102 and partially executed by the central cloud 108 .
  • preset tasks can be set by those skilled in the art according to actual needs, for example, tasks that require more computing power or resources can be used as preset tasks. But not limited thereto, other types of tasks may also be applicable to the solutions of the embodiments of the present application.
  • the execution of preset tasks is usually triggered by certain codes, such as calling codes, instruction codes, trigger instructions, etc., in the process of executing program codes in the code execution environment, if these trigger execution codes corresponding to preset tasks are detected , it means that there is a preset task that needs to be executed and must be scheduled to the cloud for execution. Therefore, the code execution environment will be triggered to perform the following steps S204-S206.
  • Step S204 According to the trigger execution code, query the scheduling strategy through the code execution environment to obtain the scheduling strategy for the preset task.
  • the code execution environment not only has conventional code running support functions, but also has scheduling functions, including scheduling policy query and scheduling execution functions, wherein the scheduling policy is used to indicate the scheduling of preset tasks to a certain target device in the cloud run in.
  • scheduling strategy query can usually be queried by the client to the cloud (such as edge cloud and/or central cloud), but in some cases, the client can also configure the scheduling strategy locally, and in this case, the client can also perform local Scheduling policy queries.
  • Configuring scheduling policies in the cloud can not only effectively realize the scheduling and execution of preset tasks, but also realize the sharing of scheduling policies and save system resources.
  • the scheduling policy is also configured locally on the client, it can provide greater scheduling flexibility for client users and facilitate client users to realize personalized scheduling requirements.
  • the code execution environment of the client when querying the scheduling strategy, can send a query request to the cloud (which can be all or some devices in the cloud) through the environment communication interface, and the cloud can pass its own code
  • the environment communication interface of the execution environment determines the target device that can execute the preset task based on the preset rules, and then generates a scheduling policy based on the information of the determined target device, and executes the scheduling policy through the code in the cloud
  • the environment communication interface of the environment returns the code execution environment environment communication interface of the client to the client, thereby realizing the return of the scheduling policy to the client.
  • Step S206 Scheduling the preset task to the code execution environment of the cloud target device indicated by the obtained scheduling policy through the environment communication interface of the code execution environment for execution.
  • the scheduling policy includes the information of the target devices that can execute the preset tasks.
  • the target device is usually a device in the edge cloud or a device in the central cloud, and a code execution environment is also created in the device.
  • the information of the target device may include, but not limited to, the identity and address of the target device, information of the environment communication interface of the code execution environment, and the like. Based on this, the client can directly interact with the code execution environment.
  • the client After the client receives the scheduling policy, it can obtain the information of the target device, and based on the information of the target device, send it to the environment communication interface of the code execution environment of the target device through the environment communication interface of the code execution environment of the client. messages and data to deliver preset tasks directly to the target device.
  • the WEBASSEMBLY bytecode is directly executed by the WEBASSEMBLY RUNTIME of the target device without additional operations such as code conversion.
  • the client is a smart speaker
  • tasks that consume a lot of computing power and resources, such as face recognition will be implemented by the edge cloud that communicates with the smart speaker, so that the running speed of the smart speaker can be improved, its performance can be optimized, and the impact on the smart speaker can be reduced.
  • Software and hardware performance requirements are examples of the edge cloud that communicates with the smart speaker, so that the running speed of the smart speaker can be improved, its performance can be optimized, and the impact on the smart speaker can be reduced.
  • a smart speaker first collects a voice command through a voice collection device such as a microphone, such as "please turn on the air conditioner in the bedroom"; then, the smart speaker will collect the face in front of it through its camera.
  • a voice collection device such as a microphone
  • the smart speaker will collect the face in front of it through its camera.
  • the processing of the face image is executed through the local code execution environment of the smart speaker, and the face recognition operation in the face image processing is encapsulated as an API program (WASM program code in this example).
  • the program code corresponding to face image processing also includes an instruction code that instructs the API program of the face recognition operation to be scheduled through the code execution environment of the smart speaker (WEBASSEMBLY RUNTIME in this example).
  • the instruction code may notify the code execution environment in an appropriate manner in advance that the API program needs to be scheduled for execution. But not limited to this, other notification methods are also applicable.
  • the smart speaker will create a code execution environment such as WEBASSEMBLY RUNTIME-X to run the program code of face image processing in the WEBASSEMBLY RUNTIME-X.
  • WEBASSEMBLY RUNTIME-X determines that the API program needs to be dispatched to the cloud for execution based on the information known in advance. Then, WEBASSEMBLY RUNTIME-X sends scheduling policy query requests to the code execution environments in devices 1, 2 and 3 in the edge cloud, respectively WEBASSEMBLY RUNTIME-Y1, WEBASSEMBLY RUNTIME-Y2 and WEBASSEMBLY RUNTIME-Y3, through its environment communication interface.
  • WEBASSEMBLY RUNTIME-Y1, WEBASSEMBLY RUNTIME-Y2 and WEBASSEMBLY RUNTIME-Y3 respectively determine whether the API program of face recognition can be executed according to their own load and/or network conditions. If Y1 is executable, it can be determined that its corresponding device 1 is the target device. Furthermore, a scheduling strategy can be generated based on the information of the device 1, such as identification, address, and the environmental communication interface of WEBASSEMBLY RUNTIME-Y1. It should be noted that the generation of the scheduling policy may be generated by any device among devices 1 , 2 , and 3 , or may be designated to be generated by a device capable of executing preset tasks, such as device 1 .
  • the settings are generated by device 1.
  • device 1 After generating the scheduling policy, device 1 sends the scheduling policy to the environmental communication interface of WEBASSEMBLY RUNTIME-X through its WEBASSEMBLY RUNTIME-Y1 environment communication interface.
  • WEBASSEMBLY RUNTIME-X After WEBASSEMBLY RUNTIME-X receives the scheduling policy, it establishes a communication connection with the environment communication interface of WEBASSEMBLY RUNTIME-Y1 through the environment communication interface of WEBASSEMBLY RUNTIME-X, and sends the corresponding information and data for executing the API program to WEBASSEMBLY RUNTIME-Y1.
  • WEBASSEMBLY RUNTIME-X it is optional to send the running environment parameters of WEBASSEMBLY RUNTIME-X to WEBASSEMBLY RUNTIME-Y1, so that WEBASSEMBLY RUNTIME-Y1 can be initialized based on the environment parameters to form the same running environment as WEBASSEMBLY RUNTIME-X; then the WASM of the API program
  • the code is sent from WEBASSEMBLY RUNTIME-X to WEBASSEMBLY RUNTIME-Y1 through the environmental communication interface of both parties. After WEBASSEMBLY RUNTIME-Y1 receives the WASM code of the API program, it can be executed directly.
  • WEBASSEMBLY RUNTIME-Y1 will execute the API program to recognize the face image collected by the smart speaker, and after obtaining the recognition result, return the recognition result to WEBASSEMBLY RUNTIME-X through the environmental communication interface of both parties.
  • it is set that the face in the image determined by recognition is the face of user A, and WEBASSEMBLY RUNTIME-Y1 returns the result to WEBASSEMBLY RUNTIME-X.
  • WEBASSEMBLY RUNTIME-X After WEBASSEMBLY RUNTIME-X receives the result, it can As a result, follow-up processing is performed, such as returning a certain signal and instruction to the smart speaker, instructing the smart speaker to send an activation command to the bedroom air conditioner to turn on the connected bedroom air conditioner.
  • the smart speaker does not need to process program codes that consume a lot of computing power and resources such as face recognition, but only needs to have basic functions such as voice collection, recognition, image collection, and device control, which greatly reduces the need for smart speakers. Speaker performance requirements, and improve its data processing speed.
  • the smart speaker is used as an example to illustrate the above, but those skilled in the art should understand that other devices such as path planning of sweeping robots, AI processing of mobile terminals such as mobile phones, and other high-computing and high-consumption processing can all be processed through this application.
  • the method of the embodiment is run by the cloud.
  • the code execution environment can be configured in the client and the cloud device.
  • the code execution environment can be mainly used for the execution process of the program code.
  • the code execution environment of the client and the cloud is usually Similarly, tasks that can be executed on the client side can also be executed on the cloud.
  • the client detects the trigger execution code of the preset task, it indicates that the preset task needs to be executed.
  • the client still passes the The code executes the environment query and obtains the scheduling strategy for the preset task, so as to determine to schedule the preset task to a target device in the cloud for execution.
  • the performance of cloud devices is usually better than that of the client, executing the preset task through the cloud can not only reduce the task execution burden of the client, but also improve the execution efficiency and speed of the preset task, thereby optimizing the Client performance.
  • the client and the cloud interact directly through their code execution environments, so that preset tasks can be executed by the code execution environment of the cloud target device without additional processing, further improving the execution of preset tasks efficiency.
  • the client can perform task feedback based on the execution results of the preset tasks of the cloud device in the future. Because the preset task execution efficiency is high, the task feedback efficiency is also high, thereby improving the execution speed and efficiency of the preset tasks as a whole. It also improves the running speed of the client and optimizes the performance of the client.
  • FIG. 3A it shows a flowchart of steps of a task execution method according to Embodiment 2 of the present application.
  • This embodiment still describes the task execution method of the embodiment of the present application from the perspective of the client, and the task execution method includes the following steps:
  • Step S302 Determine a preset task for scheduling to the cloud for execution, and generate a system call instruction based on the preset task.
  • the preset tasks can be set by those skilled in the art according to the actual situation.
  • tasks that consume a lot of computing power and resources can be determined as preset tasks.
  • other tasks that perform better on the cloud or that help to affect terminal performance can be set as preset tasks.
  • a corresponding system call instruction can be generated based on the preset task.
  • the system call instruction can be used to call the function module where the preset task is located. If the preset task is packaged as an API program, the system call instruction can invoke the execution of the preset task by calling the API program to realize the corresponding function.
  • the system call instruction can also indicate that the called preset task needs to run in the code execution environment, and can be dispatched to the cloud for execution through the code execution environment.
  • the system call instruction can be implemented in an appropriate way, such as through SDK or through Library.
  • the system call instruction is set in a link library of the programming language used by the application to which the preset task belongs.
  • the extension function of the programming language Library used by the application of the preset task enables it to support the scheduling of the program code of the preset task to be executed on the edge cloud or the central cloud.
  • APIs that developers can call can be provided to load the program code that needs to be dispatched to the cloud for execution. It is only necessary to develop the relevant extended library (Library) according to the developer's programming language (such as JAVA, C++), etc. Realization, convenient and low cost.
  • Step S304 Receive a system call instruction including calling the preset task; create a code execution environment for the program corresponding to the system call instruction, so that the preset task is executed in the code execution environment.
  • system call instruction can instruct the program code to run through the code execution environment
  • a code execution environment can be created according to the system call instruction for the corresponding program code (such as preset task Some or all of the program code of the program) runs and uses.
  • the code execution environment is a code execution environment based on the WEBASSEMBLY standard.
  • the code execution environment using the WEBASSEMBLY standard not only allows the code to run, but also can effectively guarantee the security of the code run, and can realize the environmental requirements of the code run simply and at low cost.
  • a private WEBASSEMBLY sandbox for the preset task can be created according to the system call instruction, so that the program code of the preset task can be executed in the private sandbox.
  • relevant code segments including the preset task can be compiled into environment execution code in advance, that is, the code that can run in the code execution environment. Still taking the code execution environment as WEBASSEMBLY RUNTIME as an example, you can first compile the relevant code segment into WASM code (that is, WEBASSEMBLY bytecode), so that it can be run directly in WEBASSEMBLY RUNTIME.
  • Step S306 During the process of executing the program code through the code execution environment, it is detected that the trigger of the preset task executes the code.
  • step S202 For the specific implementation of this step, reference may be made to the relevant description in step S202 in the first embodiment, and details are not repeated here.
  • Step S308 According to the trigger execution code, query the scheduling strategy through the code execution environment to obtain the scheduling strategy for the preset task.
  • this step can be implemented as: according to the trigger execution code, send a scheduling policy query request for preset tasks to the edge cloud and/or central cloud through the code execution environment; receive a query in response to the scheduling policy query request As a result, a scheduling policy for preset tasks is obtained according to the query result.
  • the scheduling strategy query request is processed by the cloud to generate a scheduling strategy, which not only facilitates the sharing of data related to the scheduling strategy, but also reduces the data processing burden of the client and improves the running speed of the client.
  • this step can be implemented as: according to the trigger execution code, query the client's local scheduling strategy through the code execution environment, and obtain the scheduling strategy for the preset task.
  • the client also has the function of determining and generating scheduling policies, which provides greater flexibility for client users to schedule preset tasks.
  • Scheduling policy query can be implemented in any appropriate message manner, including but not limited to: http message, https message, RPC message, middleware message and so on.
  • the client may send a query request message through its code execution environment to the code execution environments in some or all of the devices in the cloud.
  • the cloud device After the cloud device receives the query request message through the code execution environment, it can determine the target device that can execute the preset task according to its own running status information, such as load status information, network status information, etc., based on the target device A scheduling policy is generated and can be sent to the client's code execution environment through the code execution environment of the target device.
  • the interaction between different code execution environments can send or receive data through the corresponding environment communication interface to realize the interaction.
  • the generated scheduling policy usually includes at least the information of the target device, including but not limited to: identification information, address information, information of the environment communication interface of the code execution environment of the target device, and the like.
  • Step S310 Scheduling the preset task to the code execution environment of the cloud target device indicated by the obtained scheduling policy through the environment communication interface of the code execution environment for execution.
  • the code execution environment of the client and the code execution environment of the cloud are the same type of environment, for example, both are WEBASSEMBLY RUNTIME, or both are JAVASCRIPT RUNTIME. Based on this, the program code of the preset task can be transmitted to the target device for direct execution.
  • the environment execution code of the preset task can be obtained through the code execution environment of the client, and the environment execution code can be executed in the code execution environment Executed code: the environment execution code of the preset task is scheduled to be executed in the code execution environment of the cloud target device indicated by the obtained scheduling policy through the environment communication interface of the code execution environment.
  • the preset task can be run in the code execution environment of the cloud target device without additional code processing and conversion.
  • the environment parameters of the code execution environment of the client and the environment execution of preset tasks can be sent to the environment communication interface of the code execution environment of the cloud target device indicated by the scheduling policy through the environment communication interface of the code execution environment of the client Code, so that the cloud target device initializes the code execution environment of the cloud target device itself according to the environment parameters, and executes the environment execution code of the preset task after the initialization is completed.
  • the consistency of the code execution environment of the cloud target device and the code execution environment of the client can be guaranteed, so as to facilitate the direct and seamless execution of preset tasks.
  • Step S312 Receive the execution result of the preset task returned by the cloud target device to the environment communication interface of the code execution environment of the client through the environment communication interface of the code execution environment.
  • the execution results are obtained, such as face recognition results, path planning results, semantic analysis results, etc.
  • the cloud target device sends the execution result to the environment communication interface of the code execution environment of the client through the environment communication interface of its code execution environment.
  • the client can perform subsequent operations based on the execution result, such as making subsequent program calls based on the execution result or directly feeding back the execution result to the corresponding program, etc. This embodiment of the present application does not limit this .
  • the client, the edge cloud and the central cloud are all equipped with a scheduling module.
  • the scheduling module of the client is used to query and execute scheduling policies.
  • the programming language Library used by the application to which the task belongs is set to be implemented by extending the function. For example, through the extended function, the target device that can execute the program code of the preset task can be determined, such as scheduling to the edge cloud for execution, or scheduling Go to the central cloud for execution, etc.
  • the programming language Library used by the application to which the preset task belongs can be extended to support the scheduling of the program code of the preset task to the edge cloud or the central cloud for execution.
  • APIs that can be called by developers can be provided to load program codes that need to be called to the cloud for execution, so that developers can develop related extension libraries (Library) according to specific developer programming languages (such as Java, C++).
  • the scheduling policy is deployed on the central cloud and the edge cloud, and the scheduling module of the client can query and obtain related scheduling policies through the edge cloud and/or the central cloud.
  • the client is also statically pre-configured with scheduling policies for local scheduling policy queries.
  • the client of this example is also equipped with a remote code invocation function module, which is responsible for sending the program code of the preset task of the client to the edge cloud or the central cloud for execution, and obtaining the execution result.
  • the functions that this function module can realize include: notifying the code execution environment of the cloud about the information and data of the preset tasks to be executed, sending the environment parameters of the local code execution environment to the cloud to enable the cloud to initialize its own code Execute the environment and execute preset tasks; after the execution in the cloud is completed, the execution result returned by the cloud is received through the environment communication interface between the code execution environments.
  • edge cloud Regardless of whether it is in the client, edge cloud or the center, it supports the code execution environment and sets up an environment communication interface between the code execution environments to be responsible for the communication function between the code execution environments of the client, edge cloud, and central cloud.
  • the code execution environment is still WEBASSEMBLY RUNTIME as an example, based on the above configuration, the task execution process is described.
  • the process includes:
  • WASM code can be considered as code that needs to be dispatched to the cloud for execution.
  • the JAVA source program code is taken as an example, and it is compiled into WASM code, which is the "offload wasm code" shown in the figure.
  • the scheduling module in the client's WEBASSEMBLY RUNTIME queries the scheduling module located in the edge cloud or the central cloud through the network, and decides which edge cloud or central cloud to execute the task according to the scheduling policy provided by the scheduling module of the edge cloud or the central cloud Offload's WEBASSEMBLY code module.
  • the scheduling module located in the edge cloud or the central cloud provides a response to the scheduling policy query sent by the client WEBASSEMBLY RUNTIME, and returns the scheduling policy to the client.
  • the scheduling policy can be determined according to parameters such as the operating load of the edge cloud or the central cloud, and the network connection between the client and the edge cloud or the central cloud.
  • the client sends the WEBASSEMBLY code module of Offload to the WEBASSEMBLY RUNTIME of the edge cloud or the central cloud through the network.
  • the WEBASSEMBLY RUNTIME of the edge cloud or the central cloud executes the WEBASSEMBLY code module of Offload, and returns the execution result to the client's WEBASSEMBLY RUNTIME through the network.
  • an asynchronous execution mechanism can be used, that is, the edge cloud or central cloud executes the WEBASSEMBLY code module of Offload without blocking the execution of the client program.
  • each execution can follow the above process, according to the network connection between the client and the edge cloud or the central cloud, the load of the edge cloud or the central cloud, etc. Flexibly determine the devices that can execute WEBASSEMBLY code modules.
  • the WEBASSEMBLY code module can fall back to the client's WEBASSEMBLY RUNTIME for execution. Therefore, through the flexible scheduling strategy, the operating efficiency of the client program can be improved, and the robustness and reliability can be improved.
  • the code execution environment can be configured in the device of the client and the cloud, and the code execution environment can be mainly used for the execution process of the program code, and the code execution of the client and the cloud
  • the environment is usually the same so that tasks that can be performed on the client side can also be performed on the cloud.
  • the client detects the trigger execution code of the preset task, it indicates that the preset task needs to be executed.
  • the client still passes the The code executes the environment query and obtains the scheduling strategy for the preset task, so as to determine to schedule the preset task to a target device in the cloud for execution.
  • the performance of cloud devices is usually better than that of the client, executing the preset task through the cloud can not only reduce the task execution burden of the client, but also improve the execution efficiency and speed of the preset task, thereby optimizing the Client performance.
  • the client and the cloud interact directly through their code execution environments, so that preset tasks can be executed by the code execution environment of the cloud target device without additional processing, further improving the execution of preset tasks efficiency.
  • the client can perform task feedback based on the execution results of the preset tasks of the cloud device in the future. Because the preset task execution efficiency is high, the task feedback efficiency is also high, thereby improving the execution speed and efficiency of the preset tasks as a whole. It also improves the running speed of the client and optimizes the performance of the client.
  • FIG. 4 shows a flow chart of steps of a task execution method according to Embodiment 3 of the present application.
  • This embodiment describes the task execution method of the embodiment of the present application from the perspective of the cloud (edge cloud or central cloud).
  • the task execution method includes:
  • Step S402 through the environment communication interface of the code execution environment, receive the scheduling policy query request for the preset task sent from the code security environment of the client.
  • the client When the client has a preset task that needs to be scheduled to the cloud for execution, it will send a scheduling policy query request to the code execution environment of some or all devices in the cloud through its own code execution environment, and the cloud device receives the scheduling policy query through the code execution environment ask.
  • the interaction between the client and the cloud device based on the code execution environment is realized through the environment communication interface of the respective code execution environment.
  • the code execution environments of both parties can be implemented as code execution environments based on the WEBASSEMBLY standard.
  • code execution environments based on the WEBASSEMBLY standard.
  • Step S404 Responding to the scheduling policy query request, obtain the running status information of the cloud.
  • the running status information of the cloud includes load status information and/or network connection status information of the cloud device.
  • the load status information is used to indicate the current load status of the cloud device, such as busy, idle, normal, or it can be represented by specific operating load data such as computing power, CPU usage, etc.
  • the network connection status information is used to indicate The network connection status between the cloud device and the client, such as the network connection is normal, blocked, stuck, etc.
  • the embodiment of the present application does not limit the specific expression forms of the load status information and the network connection status information. Through the load state information and/or network connection state information, it can be accurately judged whether a certain cloud device is suitable for executing the preset task of the client.
  • Step S406 Determine the target device in the cloud that can execute the preset task according to the running status information, and determine the scheduling strategy according to the target device.
  • the cloud device that executes the preset task can be accurately determined as the target device.
  • the corresponding scheduling strategy can be generated based on the information of the target device.
  • the scheduling strategy includes There is information about the target device, including but not limited to: identification information of the target device, address information, information about the environment communication interface of the code execution environment, and the like.
  • the scheduling policy may be generated by the target device, or may be generated by other devices that receive the scheduling policy query request from the client in the cloud.
  • Step S408 Send the scheduling policy to the code execution environment of the client through the environment communication interface of the code execution environment in the cloud.
  • the target device may send the scheduling policy to the client's code execution environment through the environment communication interface of its own code execution environment. If the scheduling policy is generated by other devices, the device generating the scheduling policy may send the scheduling policy to the code execution environment of the client through the environment communication interface of its own code execution environment. Of course, the code execution environment of the client also receives the scheduling policy through its own environment communication interface.
  • Step S410 through the environment communication interface of the code execution environment in the target device, receive the environment parameters of the client's code execution environment and the environment execution code of the preset task sent by the client.
  • the environment execution code is the code that can be executed in the code execution environment.
  • Step S412 Initialize the code execution environment of the target device according to the environment parameters, and execute the environment execution code of the preset task after the initialization is completed.
  • the client in order to maintain the consistency of the code execution environment, the client will send the environment parameters of its own code execution environment to the target device, so that the target device initializes the code execution environment of the target device according to the environment parameters, and then Executes code in an environment that is initialized to perform preset tasks.
  • the environment parameters and the environment execution code of the preset task can be sent by the client through a message, and the target device will process them separately after receiving it once to improve the transmission efficiency; or, the client can first send the environment parameters through a message , and then send the environment execution code of the preset task through another message to reduce the burden of network transmission.
  • Step S414 Return the execution result of the preset task to the code execution environment of the client through the environment communication interface of the code execution environment in the target device.
  • the interaction between the target device and the client is still based on the code execution environment through their respective environment communication interfaces, so as to completely execute and complete the preset tasks.
  • step S406 when step S406 is executed, if it is determined according to the running state information that there is no target device in the cloud that can execute the preset task (for example, the load status of the cloud devices is all busy), then through the environment communication interface of the code execution environment in the cloud, send The code execution environment of the client returns task rejection information, so that the client executes the preset task in its own code execution environment.
  • sending the rejection information to the client can be performed by any device in the cloud, usually it can be performed by a device with a better network connection status or a better load status, but it can also be performed by other devices, which is not limited in this embodiment of the present application.
  • the cloud cooperates with the client to transfer the preset tasks of the client to the cloud for execution.
  • the two Based on their respective code execution environments, the two interact through the environment communication interface to achieve efficient execution of preset tasks. Therefore, the execution speed and efficiency of preset tasks are improved overall, the running speed of the client is improved, and the performance of the client is optimized.
  • the task execution system of this embodiment is based on edge cloud technology, and the task execution system includes at least: a client 106 and a cloud, where the cloud may include an edge cloud 102 and/or a central cloud 108 .
  • the client 106 is used to detect the trigger execution code of the preset task in the process of executing the program code through the code execution environment; according to the trigger execution code, the code is executed to the cloud, that is, the edge cloud 102 and/or the central cloud 108 through the code execution environment. Scheduling strategy query to obtain the scheduling strategy for the preset task; the preset task is scheduled to be executed in the code execution environment of the cloud target device indicated by the obtained scheduling strategy through the environment communication interface of the code execution environment.
  • the cloud is the edge cloud 102 and/or the central cloud 108, which is used to receive the scheduling strategy query for the preset task sent by the client 106 through the environment communication interface of the code execution environment of the device in the edge cloud 102 and/or the central cloud 108 Request, in response to the scheduling policy query request, determine and return the scheduling policy to the code execution environment of the client 106; and execute the preset task scheduled by the client 106 through the code execution environment of the target device indicated by the scheduling policy.
  • the client 106 obtains the environment execution code of the preset task through the code execution environment of the client, and the environment execution code is a code that can be executed in the code execution environment; the environment execution code of the preset task is executed through the code The environment communication interface of the environment, the code sent to the target device is executed in the execution environment.
  • the code execution environment is a code execution environment based on the WEBASSEMBLY standard.
  • the task execution system of this embodiment can implement the corresponding task execution methods in the foregoing multiple method embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
  • the function realization of each part in the task execution system of this embodiment reference may be made to the description of the corresponding part in the foregoing method embodiments, and details are not repeated here.
  • FIG. 5 it shows a schematic structural diagram of an electronic device according to Embodiment 5 of the present application.
  • the specific embodiment of the present application does not limit the specific implementation of the electronic device.
  • the electronic device may include: a processor (processor) 502, a communication interface (Communications Interface) 504, a memory (memory) 506, and a communication bus 508.
  • processor processor
  • Communication interface Communication Interface
  • memory memory
  • the processor 502 , the communication interface 504 , and the memory 506 communicate with each other through the communication bus 508 .
  • the communication interface 504 is used for communicating with other electronic devices or servers.
  • the processor 502 is configured to execute the program 510, specifically, may execute the relevant steps in the above embodiments of the task execution method.
  • the program 510 may include program codes including computer operation instructions.
  • the processor 502 may be a central processing unit CPU, or an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present application.
  • the one or more processors included in the smart device may be of the same type, such as one or more CPUs, or may be different types of processors, such as one or more CPUs and one or more ASICs.
  • the memory 506 is used to store the program 510 .
  • the memory 506 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
  • the program 510 may be specifically configured to enable the processor 502 to execute the task execution method described in any one of the preceding embodiments 1 to 3.
  • each step in the program 510 refers to the corresponding description of the corresponding steps and units in the above-mentioned task execution method embodiment, and details are not repeated here.
  • the specific working process of the above-described devices and modules can refer to the corresponding process description in the foregoing method embodiments, and details are not repeated here.
  • the embodiment of the present application also provides a computer program product, including computer instructions, the computer instructions instruct the computing device to perform the operation corresponding to any task execution method in the above multiple method embodiments.
  • each component/step described in the embodiment of the present application can be divided into more components/steps, and two or more components/steps or partial operations of components/steps can also be combined into New components/steps to achieve the purpose of the embodiment of the present application.
  • the above-mentioned method according to the embodiment of the present application can be implemented in hardware, firmware, or as software or computer code that can be stored in a recording medium (such as CD ROM, RAM, floppy disk, hard disk, or magneto-optical disk), or implemented by Computer code downloaded from a network that is originally stored on a remote recording medium or a non-transitory machine-readable medium and will be stored on a local recording medium so that the methods described herein can be stored on a computer code using a general-purpose computer, a dedicated processor, or a programmable Such software processing on a recording medium of dedicated hardware such as ASIC or FPGA.
  • a recording medium such as CD ROM, RAM, floppy disk, hard disk, or magneto-optical disk
  • Computer code downloaded from a network that is originally stored on a remote recording medium or a non-transitory machine-readable medium and will be stored on a local recording medium so that the methods described herein can be stored on a computer code using a general-purpose computer, a
  • a computer, processor, microprocessor controller, or programmable hardware includes memory components (e.g., RAM, ROM, flash memory, etc.) that can store or receive software or computer code that, when When accessed and executed by a processor or hardware, the task execution methods described herein are implemented.
  • memory components e.g., RAM, ROM, flash memory, etc.
  • the execution of the code converts the general-purpose computer into a special-purpose computer for performing the task performance method shown here.

Abstract

本申请实施例提供了一种任务执行方法、系统、电子设备及计算机存储介质,其中,一种应用于客户端的任务执行方法包括:在通过代码执行环境执行程序代码的过程中,检测到预设任务的触发执行代码;根据所述触发执行代码,通过所述代码执行环境进行调度策略查询,获得针对所述预设任务的调度策略;将所述预设任务通过所述代码执行环境的环境通信接口,调度至获得的所述调度策略所指示的云端目标设备的代码执行环境中执行。通过本申请实施例,提升了预设任务的执行速度和效率,也提升了客户端的运行速度,优化了客户端性能。

Description

任务执行方法、系统、电子设备及计算机存储介质
本申请要求2021年08月30日递交的申请号为202111006428.3、发明名称为“任务执行方法、系统、电子设备及计算机存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请实施例涉及互联网技术领域,尤其涉及一种任务执行方法、系统、电子设备及计算机存储介质。
背景技术
随着互联网技术的发展,各种应用如直播应用、短视频应用、基于AI(人工智能)的应用对数据的处理和传输时延、吞吐率、计算能力等性能要求越来越高,传统依赖终端设备自身进行处理的方式已不能满足这些应用的需要。为此,边缘云技术应运而生,并且得到了越来越广泛的使用。
边缘云技术也称边缘云计算技术,是一种基于云计算技术的核心和边缘计算的能力,构筑在边缘设施基础上的云计算平台,来进行数据处理和计算的技术。通过边缘云技术,可提供边缘云计算基础设施服务,如计算、存储、网络、加速器等,以及边缘云计算平台服务,如容器服务、大数据服务、人工智能服务、即时通信服务RTC、视频AI、音视频通信等。
但在现在的基于边缘云技术的系统中,客户端仍承担着大量的数据计算和执行等任务,如何借助于边缘云技术,减轻客户端的任务执行负担,提升其运行速度,进而优化客户端的性能,成为亟待解决的问题。
发明内容
有鉴于此,本申请实施例提供一种任务执行方案,以至少部分解决上述问题。
根据本申请实施例的第一方面,提供了一种任务执行方法,应用于客户端,所述方法包括:在通过代码执行环境执行程序代码的过程中,检测到预设任务的触发执行代码;根据所述触发执行代码,通过所述代码执行环境进行调度策略查询,获得针对所述预设任务的调度策略;将所述预设任务通过所述代码执行环境的环境通信接口,调度至获得的所述调度策略所指示的云端目标设备的代码执行环境中执行。
可选地,所述将所述预设任务通过所述代码执行环境的环境通信接口,调度至获得的所述调度策略所指示的云端目标设备的代码执行环境中执行,包括:通过所述代码执行环境,获得所述预设任务的环境执行代码,所述环境执行代码为可在所述代码执行环境中执行的代码;将所述预设任务的环境执行代码通过所述代码执行环境的环境通信接口,调度至获得的所述调度策略所指示的云端目标设备的代码执行环境中执行。
可选地,所述将所述预设任务的环境执行代码通过所述代码执行环境的环境通信接口,调度至获得的所述调度策略所指示的云端目标设备的代码执行环境中执行,包括: 通过所述代码执行环境的环境通信接口,向所述调度策略所指示的云端目标设备的代码执行环境的环境通信接口发送客户端的所述代码执行环境的环境参数和所述预设任务的环境执行代码,以使所述云端目标设备根据所述环境参数初始化所述云端目标设备自身的代码执行环境,并在初始化完成后执行所述预设任务的环境执行代码。
可选地,所述根据所述触发执行代码,通过所述代码执行环境进行调度策略查询,获得针对所述预设任务的调度策略,包括:根据所述触发执行代码,通过所述代码执行环境向边缘云和/或中心云发送针对所述预设任务的调度策略查询请求;接收响应于所述调度策略查询请求的查询结果,根据所述查询结果获得针对所述预设任务的调度策略。
可选地,所述根据所述触发执行代码,通过所述代码执行环境进行调度策略查询,获得针对所述预设任务的调度策略,包括:根据所述触发执行代码,通过所述代码执行环境进行客户端本地的调度策略查询,并获得针对所述预设任务的调度策略。
可选地,在所述在通过代码执行环境执行程序代码的过程中,检测到预设任务的触发执行代码之前,所述方法还包括:接收到包含有调用所述预设任务的系统调用指令;为所述系统调用指令所对应的程序创建代码执行环境,以使所述预设任务在所述代码执行环境中执行。
可选地,所述系统调用指令设置于所述预设任务所属应用所使用的编程语言的链接库中。
可选地,第一方面的任务执行方法还包括:接收所述云端目标设备通过其代码执行环境的环境通信接口,向所述客户端的代码执行环境的环境通信接口返回的所述预设任务的执行结果。
可选地,所述代码执行环境为基于WEBASSEMBLY标准的代码执行环境。
根据本申请实施例的第二方面,提供了另一种任务执行方法,应用于云端,所述方法包括:通过代码执行环境的环境通信接口,接收从客户端的代码安全环境发送来的针对预设任务的调度策略查询请求;响应于所述调度策略查询请求,获取所述云端的运行状态信息;根据所述运行状态信息确定所述云端的可执行所述预设任务的目标设备,并根据所述目标设备确定调度策略;通过所述云端的代码执行环境的环境通信接口,将所述调度策略发送给所述客户端的代码执行环境。
可选地,第二面的任务执行方法还包括:通过所述目标设备中的代码执行环境的环境通信接口,接收所述客户端发送的客户端的代码执行环境的环境参数和所述预设任务的环境执行代码,所述环境执行代码为可在所述代码执行环境中执行的代码:根据所述环境参数初始化所述目标设备的代码执行环境,并在初始化完成后执行所述预设任务的环境执行代码。
可选地,第二面的任务执行方法还包括:通过所述目标设备中的代码执行环境的环境通信接口,向所述客户端的代码执行环境返回所述预设任务的执行结果。
可选地,第二面的任务执行方法还包括:若根据所述运行状态信息确定所述云端不存在可执行所述预设任务的目标设备,则通过所述云端的代码执行环境的环境通信接口,向所述客户端的代码执行环境返回任务拒绝信息,以使所述客户端在自身的代码执行环境中执行所述预设任务。
可选地,所述云端的运行状态信息包括负载状态信息和/或网络连接状态信息。
可选地,所述代码执行环境为基于WEBASSEMBLY标准的代码执行环境。
根据本申请实施例的第三方面,提供了一种任务执行系统,至少包括:客户端和云端;其中:所述客户端,用于在通过代码执行环境执行程序代码的过程中,检测到预设任务的触发执行代码;根据所述触发执行代码,通过所述代码执行环境向所述云端进行调度策略查询,获得针对所述预设任务的调度策略;将所述预设任务通过所述代码执行环境的环境通信接口,调度至获得的所述调度策略所指示的云端目标设备的代码执行环境中执行;所述云端,用于通过云端的代码执行环境的环境通信接口,接收所述客户端发送的针对所述预设任务的调度策略查询请求,响应于所述调度策略查询请求,确定并向所述客户端的代码执行环境返回调度策略;以及,通过所述调度策略所指示的目标设备的代码执行环境,执行所述客户端调度来的所述预设任务。
可选地,所述客户端通过客户端的代码执行环境,获得所述预设任务的环境执行代码,所述环境执行代码为可在所述代码执行环境中执行的代码;将所述预设任务的环境执行代码通过所述代码执行环境的环境通信接口,发送至所述目标设备的代码执行环境中执行。
可选地,所述代码执行环境为基于WEBASSEMBLY标准的代码执行环境。
根据本申请实施例的第四方面,提供了一种电子设备,包括:处理器、存储器、通信接口和通信总线,所述处理器、所述存储器和所述通信接口通过所述通信总线完成相互间的通信;所述存储器用于存放至少一可执行指令,所述可执行指令使所述处理器执行如第一方面或第二方面所述的任务执行方法对应的操作。
根据本申请实施例的第五方面,提供了一种计算机存储介质,其上存储有计算机程序,该程序被处理器执行时实现如第一方面或第二方面所述的任务执行方法。
根据本申请实施例的第六方面,提供了一种计算机程序产品,包括计算机指令,所述计算机指令指示计算设备执行如第一方面或第二方面所述的任务执行方法对应的操作。
根据本申请实施例提供的任务执行方案,为了减轻客户端的任务执行负担,客户端和云端的设备中均可配置代码执行环境,该代码执行环境可主要用于程序代码的执行过程,客户端和云端的代码执行环境通常相同,这样在客户端可执行的任务在云端也可被执行。基于此,一方面,客户端在通过其代码执行环境来执行程序代码的过程中,如果检测到了预设任务的触发执行代码,则表明预设任务需要被执行,此时,客户端仍然通 过该代码执行环境查询并获得针对预设任务的调度策略,以确定将该预设任务调度至云端的某个目标设备执行。因云端设备的性能通常都优于客户端,因此,通过云端执行该预设任务,在减轻客户端的任务执行负担的同时,还可以提升预设任务的执行效率,提升其运行速度,进而优化了客户端性能。另一方面,客户端与云端之间直接通过两者的代码执行环境进行交互,使得预设任务无需再经过额外处理即可被云端目标设备的代码执行环境执行,进一步提升了预设任务的执行效率。并且,客户端在后续可基于云端设备的预设任务的执行结果进行任务反馈,因预设任务执行效率高,则任务反馈效率也高,从而整体上提升了预设任务的执行速度和效率,也提升了客户端的运行速度,优化了客户端性能。
附图说明
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请实施例中记载的一些实施例,对于本领域普通技术人员来讲,还可以根据这些附图获得其他的附图。
图1为适用本申请实施例的任务执行方法的示例性系统的示意图;
图2A为根据本申请实施例一的一种任务执行方法的步骤流程图;
图2B为图2A所示实施例中的一种场景示例的示意图;
图3A为根据本申请实施例二的一种任务执行方法的步骤流程图;
图3B为图3A所示实施例中的一种任务执行过程示意图;
图4为根据本申请实施例三的一种任务执行方法的步骤流程图;
图5为根据本申请实施例五的一种电子设备的结构示意图。
具体实施方式
为了使本领域的人员更好地理解本申请实施例中的技术方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅是本申请实施例一部分实施例,而不是全部的实施例。基于本申请实施例中的实施例,本领域普通技术人员所获得的所有其他实施例,都应当属于本申请实施例保护的范围。
下面结合本申请实施例附图进一步说明本申请实施例具体实现。
图1示出了一种适用本申请实施例的任务执行方法的示例性系统。如图1所示,该边缘云系统100可以包括边缘云102、通信网络1042和/或一个或多个客户端106,图1中示例为多个客户端。此外,该边缘云系统还可与中心云108通过通信网络1044连接,边缘云系统100中的客户端106可通过边缘云102与中心云108通信,也可直接与中心云通信。
边缘云102可以实现为用于计算处理、存储信息、数据、程序和/或任何其他合适类 型的内容的服务器或服务器集群。在一些实施例中,边缘云102可以执行任何适当的功能。例如,在一些实施例中,边缘云102可以用于分担客户端的数据计算和处理任务,以减轻客户端的负担,并可降低对客户端的软硬件性能要求,从而降低客户端的实现成本。作为可选的示例,在一些实施例中,边缘云102可以被用于通过代码执行环境与客户端106的代码执行环境交互,并可接收客户端106的某些待执行任务以在边缘云102的代码执行环境中执行。
在一些实施例中,通信网络1042可以是一个或多个有线和/或无线网络的任何适当的组合。例如,通信网络1042能够包括以下各项中的任何一种或多种:互联网、内联网、广域网(WAN)、局域网(LAN)、无线网络、数字订户线路(DSL)网络、帧中继网络、异步转移模式(ATM)网络、虚拟专用网(VPN)和/或任何其它合适的通信网络。通信网络1044也可以是一个或多个有线和/或无线网络的任何适当的组合。例如,互联网、广域网(WAN)、无线网络等。客户端106能够通过一个或多个通信链路连接到通信网络1042和1044,该通信网络1042和1044能够经由一个或多个通信链路被链接到边缘云102和中心云108。通信链路可以是适合于在客户端106和边缘云102和中心云108之间传送数据的任何通信链路,诸如网络链路、拨号链路、无线链路、硬连线链路、任何其它合适的通信链路或此类链路的任何合适的组合。
客户端106可以包括可执行数据处理和数据计算等任务的任何一个或多个客户端。在一些实施例中,客户端106可以包括任何合适类型的设备。例如,在一些实施例中,客户端106可以包括智能IoT(物联网)设备、移动设备、平板计算机、膝上型计算机、台式计算机、可穿戴计算机、游戏控制台、媒体播放器、车辆娱乐系统和/或任何其他合适类型的客户端。在一些实施例中,客户端106可以用于实现通过其自身的代码安全环境与边缘云102和中心云108中的代码执行环境进行交互,以实现任务调度和执行的客户端。
尽管将边缘云102和中心云108均图示为一个设备,但是在一些实施例中,可以使用任何适当数量的设备来执行由边缘云102和中心云108执行的功能。例如,在一些实施例中,可以使用多个设备来实现由边缘云102执行的功能。或者,可以使用多个设备来实现由中心云108执行的功能。
上述系统中,代码执行环境用于为代码运行服务,可通过适当的执行环境工具实现,如WEBASSEMBLY RUNTIME、JAVASCRIPT RUNTIME等实现。但与常规的代码执行环境只能与本地的外环境(代码执行环境以外的环境)通信不同,本申请实施例中的代码执行环境可通过设置的环境通信接口与其它设备中的代码执行环境的环境通信接口直接通信,在极大地提高了通信效率和速度的同时,因是环境与环境之间的通信,所以后续的代码也无需进行环境内外的转换,可直接由一台设备传输到另一台设备运行。此外,本申请实施例中的代码执行环境还扩展了新的功能,可进行针对任务的调度策略查询和 交互,并可基于查询和交互结果,将任务传输至相应的目标设备中实现。例如,客户端106可以通过其自身的代码安全环境向边缘云102和/或中心云108中的代码执行环境发送调度策略查询请求,并可在获得结果后将相应的待执行任务发送至相应的边缘云102和/或中心云108中的代码执行环境中执行,从而实现任务调度。
基于上述系统,本申请实施例提供了一种任务执行方法,以下通过多个实施例进行说明。
实施例一
参照图2A,示出了根据本申请实施例一的一种任务执行方法的步骤流程图。
本实施例从边缘云系统的客户端的角度对本申请实施例的任务执行方法进行说明,该任务执行方法包括以下步骤:
步骤S202:在通过代码执行环境执行程序代码的过程中,检测到预设任务的触发执行代码。
本申请实施例中,客户端需要能够支持代码执行环境,以在其中运行程序代码。该代码执行环境可预先设置,在有程序需要使用时进行初始化,也可以在有程序需要代码执行环境支持其运行时,为该程序创建并初始化。在初始化后提供给程序使用。
在具体实现时,代码执行环境可根据客户端的实际情况,由本领域技术人员采用适当的工具实现,例如,通过WEBASSEMBLY RUNTIME或者JAVASCRIPT RUNTIME或者其它RUNTIME等实现。
在一种可行方式中,可将代码执行环境实现为基于WEBASSEMBLY标准的代码执行环境。
WEBASSEMBLY是由W3C定义的标准化字节文件格式,可以把C++等编程语言编译成WEBASSEMBLY字节格式(也称字节码),并在WEBASSEMBLY RUNTIME中运行;并支持通过其他语言,如JAVASCRIPT中调用WEBASSEMBLY代码模块。其核心是一种面向多应用场景的虚拟指令架构,能够嵌入到不同的应用环境,支持高性能的Web应用。作为虚拟机和执行环境,WEBASSEMBLY允许加载的页面作为本机编译代码运行,从而改善Web性能和功耗。由此,WEBASSEMBLY可以实现接近原生速度的性能、优化加载时间。WEBASSEMBLY RUNTIME是WEBASSEMBLY的运行时环境,可为运行WEBASSEMBLY代码的虚拟机等运行时环境。WEBASSEMBLY提供沙箱功能,当程序编译成WASM代码模块,再加载到WEBASSEMBLY RUNTIME时,该WASM代码模块运行在其私有的沙箱中。又因WEBASSEMBLY的标准化字节文件格式也可认为是一种低级程序设计语言,但与机器语言不同,它可以使用更多的字符,相较于机器语言具有更好的灵活性和可扩展性。因其灵活性和可扩展性,可基于此进行相应的功能设置,以满足不同的应用需求。又因不管是使用高级语言的代码还是使用解释型语言的代码均可通过WEBASSEMBLY转换为最终的机器语言代码执行,也即,高级语言代 码和解释型语言代码与WEBASSEMBLY字节码不具有直接相通性,因此,使得WEBASSEMBLY RUNTIME还可以对代码进行有效隔离,从而实现代码执行环境的安全性保障。又因WEBASSEMBLY标准较为成熟,将其应用于代码执行环境的实现还可大大节约方案实现成本,节省研发费用。
但如前所述,其它基于与WEBASSEMBLY标准类似的标准构建的代码执行环境,以及其它语言的代码执行环境同样可适用本申请实施例的方案。
基于构建完成的代码执行环境,即可进行程序代码的运行,例如,若该代码执行环境设置于浏览器框架中,则可结合JS引擎,进行网页代码的边解析边运行,即,在JS引擎解析后,代码将交由该代码执行环境运行。类似地,其它语言的代码也可以交由该代码执行环境运行。
但在该代码执行环境中运行的代码的本质仍为完成某些任务的程序代码,因此,代码执行环境可对这些程序代码进行检测,以确定是否存在预设任务的程序代码。本实施例中,预设任务的程序代码通常为需要交由云端(可以包括边缘云102和中心云108中的至少一种)执行的代码,如可以交由边缘云102执行的代码,或者交由中心云108执行的代码,或者部分交由边缘云102执行部分交由中心云108执行的代码。在实际应用中,预设任务可由本领域技术人员根据实际需求设置,如,可将需要消耗较多算力或资源的任务作为预设任务。但不限于此,其它类型的任务也可同样适用于本申请实施例的方案。
预设任务的执行通常会由一定的代码来触发,如,调用代码、指令代码、触发指令等等,在代码执行环境执行程序代码的过程中,如果检测到预设任务对应的这些触发执行代码,则表示有预设任务需要被执行,且需被调度至云端执行。因此,将会触发代码执行环境进行下述步骤S204-S206的操作。
步骤S204:根据触发执行代码,通过代码执行环境进行调度策略查询,获得针对预设任务的调度策略。
本申请实施例中,代码执行环境不仅具有常规的代码运行支持功能,且具有调度功能,包括调度策略查询和调度执行功能,其中,调度策略用于指示将预设任务调度至云端的某目标设备中运行。但具体调度至哪台设备,需要客户端通过调度策略查询获得。该调度策略查询通常可由客户端向云端(如边缘云和/或中心云)查询,但在某些情况下,客户端本地也可配置调度策略,则此种情况下,客户端也可进行本地调度策略查询。在云端配置调度策略,除可有效实现预设任务的调度执行外,还可实现调度策略的共享,节约系统资源。而如果在客户端本地也配置调度策略,则可为客户端用户提供更大的调度灵活性,便于客户端用户实现个性化的调度需求。
需要说明的是,在云端和客户端均配置有调度策略的情况下,可为两端的调度策略设置优先级,具体的设置规则可由本领域技术人员根据实际需求设定,本申请实施例对 此不作限制。
以云端配置有调度策略为例,在进行调度策略查询时,可由客户端的代码执行环境通过环境通信接口,向云端(可为云端的所有设备或部分设备)发送查询请求,云端通过其自身的代码执行环境的环境通信接口接收到该查询请求后,基于预设的规则确定可执行预设任务的目标设备,进而基于确定的目标设备的信息生成调度策略,并将该调度策略通过云端的代码执行环境的环境通信接口返回给客户端的代码执行环境的环境通信接口,由此,实现将调度策略返回给客户端。
步骤S206:将预设任务通过代码执行环境的环境通信接口,调度至获得的调度策略所指示的云端目标设备的代码执行环境中执行。
如上所述,调度策略中包含有可执行预设任务的目标设备的信息。目标设备通常为边缘云中的设备或中心云中的设备,且该设备中也创建有代码执行环境。目标设备的信息可以包括但不限于目标设备的标识、地址、代码执行环境的环境通信接口的信息等。基于此,客户端可直接进行基于代码执行环境的交互。
则,客户端在接收到调度策略后,即可从中获得目标设备的信息,基于该目标设备的信息,通过客户端的代码执行环境的环境通信接口,向目标设备的代码执行环境的环境通信接口发送消息和数据,以将预设任务直接交由目标设备执行。例如,直接将WEBASSEMBLY字节码交由目标设备的WEBASSEMBLY RUNTIME直接执行,而无需额外的代码转换等操作。
以下,以一个具体场景为示例对上述过程进行示例性说明,如图2B所示。
图2B中,假设客户端为一智能音箱,其需要通过人脸识别来确定对其发送指令的用户是否为特定用户,本示例中为用户A。若为特定用户即用户A,则根据该用户A的指令控制与其通信连接的多个智能家电进行所述指令所指示的操作。本示例中,诸如人脸识别等消耗大量算力和资源的任务将交由与智能音箱通信连接的边缘云实现,由此,可以提升智能音箱的运行速度,优化其性能,且可降低对其软硬件性能的要求。
例如,智能音箱首先通过语音采集设备如麦克风采集到语音指令,如“请打开卧室的空调”;接着,智能音箱将通过其摄像头进行其前方的人脸采集。本示例中,假设对人脸图像的处理通过智能音箱本地的代码执行环境执行,人脸图像处理中进行人脸识别的操作被封装为一个API程序(本示例中为WASM程序代码)。此外,在人脸图像处理对应的程序代码中还包括指示该人脸识别操作的API程序通过智能音箱的代码执行环境(本示例中为WEBASSEMBLY RUNTIME)进行调度的指示代码。在一种方式中,该指示代码可预先以适当方式通知代码执行环境该API程序需调度执行。但不限于此,其它通知方式也同样适用。
基于此,智能音箱会创建一个代码执行环境如WEBASSEMBLY RUNTIME-X,以在该WEBASSEMBLY RUNTIME-X中运行人脸图像处理的程序代码。当该程序代码被 运行至调用该API程序的代码段时,WEBASSEMBLY RUNTIME-X根据预先获知的信息,确定该API程序需要调度至云端执行。则,WEBASSEMBLY RUNTIME-X通过其环境通信接口向边缘云中的设备1、2和3中的代码执行环境,分别为WEBASSEMBLY RUNTIME-Y1、WEBASSEMBLY RUNTIME-Y2和WEBASSEMBLY RUNTIME-Y3发送调度策略查询请求。WEBASSEMBLY RUNTIME-Y1、WEBASSEMBLY RUNTIME-Y2和WEBASSEMBLY RUNTIME-Y3在接收到该查询请求后,分别根据自身的负载和/或网络情况确定是否可执行人脸识别的API程序,假设,最终确定WEBASSEMBLY RUNTIME-Y1可执行,则可确定其对应的设备1即为目标设备。进而,可基于设备1的信息,如标识、地址、WEBASSEMBLY RUNTIME-Y1的环境通信接口等信息生成调度策略。需要说明的是,该调度策略的生成可由设备1、2、3中的任一设备生成,也可指定由可执行预设任务的设备如设备1生成。本示例中,设定由设备1生成。在生成调度策略后,设备1通过其WEBASSEMBLY RUNTIME-Y1的环境通信接口向WEBASSEMBLY RUNTIME-X的环境通信接口发送该调度策略。WEBASSEMBLY RUNTIME-X在接收到该调度策略后,即通过WEBASSEMBLY RUNTIME-X的环境通信接口与WEBASSEMBLY RUNTIME-Y1的环境通信接口建立通信连接,并将用于执行API程序的相应信息和数据发送给WEBASSEMBLY RUNTIME-Y1。例如,可选将WEBASSEMBLY RUNTIME-X的运行环境参数发送给WEBASSEMBLY RUNTIME-Y1,以使WEBASSEMBLY RUNTIME-Y1基于该环境参数进行初始化,形成与WEBASSEMBLY RUNTIME-X相同的运行环境;再将API程序的WASM代码通过双方的环境通信接口,由WEBASSEMBLY RUNTIME-X发送给WEBASSEMBLY RUNTIME-Y1。在WEBASSEMBLY RUNTIME-Y1接收到API程序的WASM代码后,即可直接执行。本示例中,WEBASSEMBLY RUNTIME-Y1将执行该API程序,对智能音箱采集的人脸图像进行识别,并在获得识别结果后,将识别结果通过双方的环境通信接口返回给WEBASSEMBLY RUNTIME-X。本示例中,设定通过识别确定图像中的人脸即为用户A的人脸,WEBASSEMBLY RUNTIME-Y1将该结果返回给WEBASSEMBLY RUNTIME-X,WEBASSEMBLY RUNTIME-X接收到该结果后,即可基于该结果进行后续的处理,如向智能音箱返回一个确定的信号和指令,指示智能音箱向卧室空调发送开启指令,以打开其所连接的卧室空调。
可见,本示例中,智能音箱无需处理诸如人脸识别等耗费大量算力和资源的程序代码,只需具备基本的诸如语音采集、识别、图像采集、设备控制等功能,从而大大降低了对智能音箱的性能要求,且提升了其数据处理速度。
以上以智能音箱为示例进行了说明,但本领域技术人员应当明了,其它设备如扫地机器人的路径规划、手机等移动终端的AI处理及其它高算力高消耗处理等等,均可通过本申请实施例的方式交由云端运行。
通过本实施例,为了减轻客户端的任务执行负担,客户端和云端的设备中均可配置代码执行环境,该代码执行环境可主要用于程序代码的执行过程,客户端和云端的代码执行环境通常相同,这样在客户端可执行的任务在云端也可被执行。基于此,一方面,客户端在通过其代码执行环境来执行程序代码的过程中,如果检测到了预设任务的触发执行代码,则表明预设任务需要被执行,此时,客户端仍然通过该代码执行环境查询并获得针对预设任务的调度策略,以确定将该预设任务调度至云端的某个目标设备执行。因云端设备的性能通常都优于客户端,因此,通过云端执行该预设任务,在减轻客户端的任务执行负担的同时,还可以提升预设任务的执行效率,提升其运行速度,进而优化了客户端性能。另一方面,客户端与云端之间直接通过两者的代码执行环境进行交互,使得预设任务无需再经过额外处理即可被云端目标设备的代码执行环境执行,进一步提升了预设任务的执行效率。并且,客户端在后续可基于云端设备的预设任务的执行结果进行任务反馈,因预设任务执行效率高,则任务反馈效率也高,从而整体上提升了预设任务的执行速度和效率,也提升了客户端的运行速度,优化了客户端性能。
实施例二
参照图3A,示出了根据本申请实施例二的一种任务执行方法的步骤流程图。
本实施例仍然从客户端的角度对本申请实施例的任务执行方法进行说明,该任务执行方法包括以下步骤:
步骤S302:确定用于调度至云端执行的预设任务,并基于所述预设任务生成系统调用指令。
如前所述,所述预设任务可由本领域技术人员根据实际情况设定,为了减轻客户端负担,提升其运行速度,可将算力和资源消耗大的任务确定为预设任务。但不限于此,其它在云端执行效果更好或有助力于影响终端性能的任务都可设定为预设任务。
在确定了预设任务后,即可基于该预设任务生成相应的系统调用指令。一方面,系统调用指令可用于调用预设任务所在的功能模块,如预设任务被封装为API程序,则系统调用指令可通过调用该API程序来调用执行预设任务,以实现相应的功能。另一方面,系统调用指令还可指示被调用的预设任务需要代码执行环境运行,并可通过代码执行环境调度至云端执行。
系统调用指令可采用适当方式实现,如通过SDK或者通过Library方式等实现。可选地,系统调用指令设置于所述预设任务所属应用所使用的编程语言的链接库中。例如,针对预设任务所属应用所使用的编程语言Library扩展功能,使其支持将预设任务的程序代码调度到边缘云或中心云上执行。通过扩展的Library功能,可供给开发者可以调用的API,来加载需要调度至云端执行的程序代码,仅需根据开发者编程语言(如JAVA、C++)等来开发相关扩展库(Library)即可实现,实现方便,实现成本低。
步骤S304:接收到包含有调用所述预设任务的系统调用指令;为系统调用指令所对 应的程序创建代码执行环境,以使所述预设任务在代码执行环境中执行。
因系统调用指令可指示程序代码通过代码执行环境来运行,因此,在接收到该系统调用指令后,可根据该系统调用指令来创建代码执行环境,以供相应的程序代码(如,预设任务所在程序的部分或全部程序代码)运行使用。
在一种可行方式中,代码执行环境为基于WEBASSEMBLY标准的代码执行环境。采用WEBASSEMBLY标准的代码执行环境,除可供代码运行外,还可有效保障代码运行的安全性,以及可简单且低成本地实现代码运行的环境需求。
以WEBASSEMBLY RUNTIME为例,可根据系统调用指令创建一个针对预设任务的私有WEBASSEMBLY沙箱,以使预设任务的程序代码在该私有沙箱中执行。
因预设任务需要在代码执行环境中执行,因此,可预先将包含预设任务的相关代码段编译为环境执行代码,即可在代码执行环境中运行的代码。仍以代码执行环境为WEBASSEMBLY RUNTIME为例,则可先将相关代码段编译为WASM代码(即WEBASSEMBLY字节码),以可以直接在WEBASSEMBLY RUNTIME中运行。
步骤S306:在通过代码执行环境执行程序代码的过程中,检测到预设任务的触发执行代码。
本步骤的具体实现可参照实施例一中步骤S202中的相关描述,在此不再赘述。
步骤S308:根据触发执行代码,通过代码执行环境进行调度策略查询,获得针对预设任务的调度策略。
在一种可行方式中,本步骤可以实现为:根据触发执行代码,通过代码执行环境向边缘云和/或中心云发送针对预设任务的调度策略查询请求;接收响应于调度策略查询请求的查询结果,根据查询结果获得针对预设任务的调度策略。此种方式中,调度策略查询请求由云端处理并生成调度策略,既方便了与调度策略相关的数据的共享,又可减轻客户端的数据处理负担,提升客户端运行速度。
在另一种可行方式中,本步骤可以实现为:根据触发执行代码,通过代码执行环境进行客户端本地的调度策略查询,并获得针对预设任务的调度策略。此种方式中,客户端也具有调度策略确定和生成功能,为客户端用户进行预设任务调度提供了更大的灵活性。
调度策略查询可采用任意适当的消息方式实现,包括但不限于:http消息、https消息、RPC消息、中间件消息等等。
当采用上述第一种可行方式时,可由客户端通过其代码执行环境向云端的部分或全部设备中的代码执行环境发送查询请求消息。则云端设备在通过代码执行环境接收到该查询请求消息后,可根据自身的运行状态信息,如负载状态信息、网络状态信息等来确定可执行所述预设任务的目标设备,基于该目标设备生成调度策略,并可通过目标设备的代码执行环境发送给客户端的代码执行环境。需要说明的是,本申请实施例中,如无 特殊说明,不同代码执行环境之间的交互均可通过相应的环境通信接口来发送或接收数据,以实现交互。
在生成的调度策略中通常至少包括有目标设备的信息,包括但不限于:标识信息、地址信息、目标设备的代码执行环境的环境通信接口的信息等。
步骤S310:将预设任务通过代码执行环境的环境通信接口,调度至获得的调度策略所指示的云端目标设备的代码执行环境中执行。
因本申请实施例中,客户端的代码执行环境和云端的代码执行环境为相同类型的环境,如均为WEBASSEMBLY RUNTIME,或者均为JAVASCRIPT RUNTIME。基于此,可将预设任务的程序代码传输至目标设备中直接执行。
为保证预设任务的直接执行的高效实现,在一种可行方式中,可通过客户端的代码执行环境,获得预设任务的环境执行代码,所述环境执行代码为可在所述代码执行环境中执行的代码;将预设任务的环境执行代码通过代码执行环境的环境通信接口,调度至获得的调度策略所指示的云端目标设备的代码执行环境中执行。由此,无需额外的代码处理和转换,即可使得预设任务可运行于云端目标设备中的代码执行环境。
在具体实现时,可通过客户端的代码执行环境的环境通信接口,向调度策略所指示的云端目标设备的代码执行环境的环境通信接口发送客户端的代码执行环境的环境参数和预设任务的环境执行代码,以使云端目标设备根据环境参数初始化云端目标设备自身的代码执行环境,并在初始化完成后执行预设任务的环境执行代码。由此,可保证云端目标设备的代码执行环境与客户端的代码执行环境的一致性,以便于预设任务的直接、无缝执行。
步骤S312:接收云端目标设备通过其代码执行环境的环境通信接口,向客户端的代码执行环境的环境通信接口返回的预设任务的执行结果。
预设任务在云端目标设备的代码执行环境中执行完成后,获得执行结果,如人脸识别结果、路径规划结果、语义分析结果等等。云端目标设备通过其代码执行环境的环境通信接口向客户端的代码执行环境的环境通信接口发送该执行结果。客户端在接收到该执行结果后,可根据该执行结果进行后续的操作,如基于该执行结果进行后续的程序调用或直接反馈该执行结果给相应的程序等,本申请实施例对此不作限制。
以下,以一个预设任务的任务执行过程为示例,对上述过程进行说明,如图3B所示。
由图3B可见,客户端、边缘云和中心云中均设置有调度模块,本示例中,客户端的调度模块用于负责调度策略的查询与执行,该调度策略查询与执行可通过客户端的针对预设任务所属应用所使用的编程语言Library进行功能扩展所扩展出的功能来实现,例如,通过扩展功能可确定可执行预设任务的程序代码的目标设备,比如调度到边缘云上执行、或调度到中心云上执行等。具体地,可针对预设任务所属应用所使用的编程语言 Library的扩展功能,使其支持预设任务的程序代码调度到边缘云或中心云执行。如,可提供给开发者可以调用的API,来加载需要调用到云端执行的程序代码,以使开发者根据特定的开发者编程语言(如Java、C++)等来开发相关扩展库(Library)。
本示例中,一方面,调度策略部署在中心云和边缘云上,客户端的调度模块可以通过边缘云和/或中心云去查询获得相关调度策略。另一方面,客户端也静态预配置有调度策略,以进行本地调度策略查询。
此外,本示例的客户端中还配置有远程代码调用功能模块,负责把客户端的预设任务的程序代码发送给边缘云或中心云来执行,并获取执行结果。在实现时,该功能模块可实现的功能包括:通知云端的代码执行环境有关待执行的预设任务的信息和数据、将本地的代码执行环境的环境参数发送给云端以使云端初始化自身的代码执行环境并执行预设任务;在云端执行完毕后,通过代码执行环境之间的环境通信接口接收云端返回的执行结果。
不管是在客户端、边缘云还是中心去,都支持代码执行环境并设置有代码执行环境之间的环境通信接口,以负责客户端、边缘云、中心云的代码执行环境之间的通信功能。
本示例中,仍以代码执行环境为WEBASSEMBLY RUNTIME为例,基于上述配置,对任务执行过程进行说明。该过程包括:
(1)、将客户端的预设任务的程序代码如应用程序中计算复杂度高的任务代码等,编译成为WEBASSEMBLY代码模块,并通过针对此应用程序所使用的编程语言的Library的扩展功能提供的接口(API),加载WEBASSEMBLY代码模块,并指示此WEBASSEMBLY代码模块需要在云端执行(该操作也称为Offload)。
不管是JAVA源程序代码,还是C++源程序代码,或者其它编程语言的代码,可将它们编译成WASM代码,可以认为这部分代码是需要调度至云端执行的代码。
本示例中,以JAVA源程序代码为例,将其编译为WASM代码,即图中所示的“offload wasm code”。
(2)、客户端的WEBASSEMBLY RUNTIME中的调度模块通过网络查询位于边缘云或中心云的调度模块,根据边缘云或中心云的调度模块提供的调度策略,决策在哪个边缘云或中心云来执行此Offload的WEBASSEMBLY代码模块。
(3)、位于边缘云或中心云的调度模块提供对客户端WEBASSEMBLY RUNTIME发送来的调度策略查询的响应,并向客户端返回调度策略。其中,调度策略可以根据边缘云或中心去的运行负载情况、客户端与边缘云或中心云的网络连接情况等参数来确定。
(4)、客户端根据收到的调度策略,将Offload的WEBASSEMBLY代码模块通过网络发送给边缘云或中心云的WEBASSEMBLY RUNTIME中。
(5)、边缘云或中心云的WEBASSEMBLY RUNTIME对Offload的WEBASSEMBLY代码模块进行执行,并将执行结果通过网络返回给客户端的 WEBASSEMBLY RUNTIME。此步骤中,可采用异步执行机制,即边缘云或中心云执行Offload的WEBASSEMBLY代码模块不会阻塞客户端程序的执行。
此外,客户端中需要Offload的WEBASSEMBLY代码模块如果需要多次执行,每次执行均可按照上述过程,根据客户端与边缘云或中心云的网络连接情况、边缘云或中心云的负载情况等来灵活地确定可执行WEBASSEMBLY代码模块的设备。当客户端与边缘云或中心云的网络连接状况不佳,或边缘云或中心云无额外资源时,WEBASSEMBLY代码模块可以回退到客户端的WEBASSEMBLY RUNTIME中执行。由此,通过灵活的调度策略,可提升客户端程序运行效率,并提升鲁棒性及可靠性。
由上述可见,本示例中,提供基于WEBASSEMBLY代码模块为粒度的Offload,对原应用程序改动较小,便于部署;并且,能适合于各种不同设计架构的应用程序中,通用性好;此外,基于WEBASSEMBLY RUNTIME进行扩展,性能及成熟度好,可方便且容易地用于多种场景中。
此外,通过本实施例,为了减轻客户端的任务执行负担,客户端和云端的设备中均可配置代码执行环境,该代码执行环境可主要用于程序代码的执行过程,客户端和云端的代码执行环境通常相同,这样在客户端可执行的任务在云端也可被执行。基于此,一方面,客户端在通过其代码执行环境来执行程序代码的过程中,如果检测到了预设任务的触发执行代码,则表明预设任务需要被执行,此时,客户端仍然通过该代码执行环境查询并获得针对预设任务的调度策略,以确定将该预设任务调度至云端的某个目标设备执行。因云端设备的性能通常都优于客户端,因此,通过云端执行该预设任务,在减轻客户端的任务执行负担的同时,还可以提升预设任务的执行效率,提升其运行速度,进而优化了客户端性能。另一方面,客户端与云端之间直接通过两者的代码执行环境进行交互,使得预设任务无需再经过额外处理即可被云端目标设备的代码执行环境执行,进一步提升了预设任务的执行效率。并且,客户端在后续可基于云端设备的预设任务的执行结果进行任务反馈,因预设任务执行效率高,则任务反馈效率也高,从而整体上提升了预设任务的执行速度和效率,也提升了客户端的运行速度,优化了客户端性能。
实施例三
参照图4,示出了根据本申请实施例三的一种任务执行方法的步骤流程图。
本实施例从云端(边缘云或中心云)的角度对本申请实施例的任务执行方法进行说明,该任务执行方法包括:
步骤S402:通过代码执行环境的环境通信接口,接收从客户端的代码安全环境发送来的针对预设任务的调度策略查询请求。
客户端在有预设任务需要调度至云端执行时,会通过其自身的代码执行环境向云端的部分或全部设备的代码执行环境发送调度策略查询请求,云端设备通过代码执行环境接收该调度策略查询请求。
客户端与云端设备之间进行基于代码执行环境的交互时,通过各自代码执行环境的环境通信接口实现。
在一种可行方式中,双方的代码执行环境均可实现为基于WEBASSEMBLY标准的代码执行环境。该代码执行环境的具体实现方式及相应的效果均可参照前述实施例中相应部分的描述,在此不再赘述。
步骤S404:响应于调度策略查询请求,获取云端的运行状态信息。
其中,云端的运行状态信息包括云端设备的负载状态信息和/或网络连接状态信息。其中,负载状态信息用于指示云端设备的当前负载状态,如忙、空闲、一般,或者,可通过具体的运行负载数据如算力情况、CPU占用情况等数据表征;网络连接状态信息用于指示云端设备与客户端的网络连接状态,如网络连接正常、阻塞、卡断等等。本申请实施例对负载状态信息和网络连接状态信息的具体表达形式不作限制。通过负载状态信息和/或网络连接状态信息,可准确判断某个云端设备是否适于执行客户端的预设任务。
步骤S406:根据运行状态信息确定云端的可执行预设任务的目标设备,并根据目标设备确定调度策略。
如前所述,根据运行状态信息可准确地确定执行预设任务的云端设备作为目标设备,在确定了目标设备后,即可基于该目标设备的信息生成相应的调度策略,该调度策略中包含有该目标设备的信息,包括但不限于:目标设备的标识信息、地址信息、代码执行环境的环境通信接口的信息等等。
该调度策略可由目标设备生成,也可由云端接收到客户端的调度策略查询请求的其它设备生成。
步骤S408:通过云端的代码执行环境的环境通信接口,将调度策略发送给客户端的代码执行环境。
本步骤中,若调度策略由目标设备生成,则可由目标设备通过其自身的代码执行环境的环境通信接口,向客户端的代码执行环境发送调度策略。若调度策略由其它设备生成,则可由生成调度策略的设备通过其自身的代码执行环境的环境通信接口,向客户端的代码执行环境发送该调度策略。当然,客户端的代码执行环境也是通过其自身的环境通信接口进行调度策略的接收。
在上述基础上,可选地,还可执行以下步骤:
步骤S410:通过目标设备中的代码执行环境的环境通信接口,接收客户端发送的客户端的代码执行环境的环境参数和预设任务的环境执行代码。
其中,环境执行代码为可在代码执行环境中执行的代码。
步骤S412:根据环境参数初始化目标设备的代码执行环境,并在初始化完成后执行预设任务的环境执行代码。
如前述实施例中所述,为保持代码执行环境的一致性,客户端会将自身代码执行环 境的环境参数发送给目标设备,以使目标设备根据该环境参数初始化目标设备的代码执行环境,进而在初始化后可执行预设任务的环境执行代码。
需要说明的是,环境参数和预设任务的环境执行代码可由客户端通过一个消息发送,则目标设备一次接收后分别进行处理,以提高传输效率;或者,可由客户端先通过一个消息发送环境参数,再通过另一消息发送预设任务的环境执行代码,以减轻网络传输负担。
步骤S414:通过目标设备中的代码执行环境的环境通信接口,向客户端的代码执行环境返回预设任务的执行结果。
目标设备和客户端之间仍然通过双方各自的环境通信接口进行基于代码执行环境的交互,以完整执行和完成预设任务。
此外,在执行步骤S406时,若根据运行状态信息确定云端不存在可执行预设任务的目标设备(如云端设备的负载状态均为忙),则通过云端的代码执行环境的环境通信接口,向客户端的代码执行环境返回任务拒绝信息,以使客户端在自身的代码执行环境中执行预设任务。其中,向客户端发送拒绝信息可由云端的任意设备执行,通常可为网络连接状态较好或负载状态较好的设备执行,但也可由其它设备执行,本申请实施例对此不作限制。
通过本实施例,云端与客户端协作,将客户端的预设任务转由云端执行。两者基于各自的代码执行环境通过环境通信接口进行交互,实现预设任务的高效执行。从而,从整体上提升了预设任务的执行速度和效率,提升了客户端的运行速度,优化了客户端性能。
实施例四
再次参照图1,基于前述多个实施例中的描述,对本申请实施例的任务执行系统进行说明。
如前所述,本实施例的任务执行系统基于边缘云技术,该任务执行系统至少包括:客户端106和云端,该云端可以包括边缘云102和/或中心云108。
其中:
客户端106,用于在通过代码执行环境执行程序代码的过程中,检测到预设任务的触发执行代码;根据触发执行代码,通过代码执行环境向云端即边缘云102和/或中心云108进行调度策略查询,获得针对预设任务的调度策略;将预设任务通过代码执行环境的环境通信接口,调度至获得的调度策略所指示的云端目标设备的代码执行环境中执行。
云端即边缘云102和/或中心云108,用于通过边缘云102和/或中心云108中的设备的代码执行环境的环境通信接口,接收客户端106发送的针对预设任务的调度策略查询请求,响应于调度策略查询请求,确定并向客户端106的代码执行环境返回调度策略;以及,通过调度策略所指示的目标设备的代码执行环境,执行客户端106调度来的预设 任务。
可选地,客户端106通过客户端的代码执行环境,获得预设任务的环境执行代码,所述环境执行代码为可在代码执行环境中执行的代码;将预设任务的环境执行代码通过代码执行环境的环境通信接口,发送至目标设备的代码执行环境中执行。
可选地,代码执行环境为基于WEBASSEMBLY标准的代码执行环境。
需要说明的是,本实施例的系统的各个部分描述较为简单,相关部分的功能实现可参照前述多个方法实施例中的相关描述,在此不再赘述。
本实施例的任务执行系统可实现前述多个方法实施例中相应的任务执行方法,并具有相应的方法实施例的有益效果,在此不再赘述。此外,本实施例的任务执行系统中的各个部分的功能实现均可参照前述方法实施例中的相应部分的描述,在此亦不再赘述。
实施例五
参照图5,示出了根据本申请实施例五的一种电子设备的结构示意图,本申请具体实施例并不对电子设备的具体实现做限定。
如图5所示,该电子设备可以包括:处理器(processor)502、通信接口(Communications Interface)504、存储器(memory)506、以及通信总线508。
其中:
处理器502、通信接口504、以及存储器506通过通信总线508完成相互间的通信。
通信接口504,用于与其它电子设备或服务器进行通信。
处理器502,用于执行程序510,具体可以执行上述任务执行方法实施例中的相关步骤。
具体地,程序510可以包括程序代码,该程序代码包括计算机操作指令。
处理器502可能是中央处理器CPU,或者是特定集成电路ASIC(Application Specific Integrated Circuit),或者是被配置成实施本申请实施例的一个或多个集成电路。智能设备包括的一个或多个处理器,可以是同一类型的处理器,如一个或多个CPU;也可以是不同类型的处理器,如一个或多个CPU以及一个或多个ASIC。
存储器506,用于存放程序510。存储器506可能包含高速RAM存储器,也可能还包括非易失性存储器(non-volatile memory),例如至少一个磁盘存储器。
程序510具体可以用于使得处理器502执行前述实施例一至三中任一实施例所描述的任务执行方法。
程序510中各步骤的具体实现可以参见上述任务执行方法实施例中的相应步骤和单元中对应的描述,在此不赘述。所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的设备和模块的具体工作过程,可以参考前述方法实施例中的对应过程描述,在此不再赘述。
本申请实施例还提供了一种计算机程序产品,包括计算机指令,该计算机指令指示 计算设备执行上述多个方法实施例中的任一任务执行方法对应的操作。
需要指出,根据实施的需要,可将本申请实施例中描述的各个部件/步骤拆分为更多部件/步骤,也可将两个或多个部件/步骤或者部件/步骤的部分操作组合成新的部件/步骤,以实现本申请实施例的目的。
上述根据本申请实施例的方法可在硬件、固件中实现,或者被实现为可存储在记录介质(诸如CD ROM、RAM、软盘、硬盘或磁光盘)中的软件或计算机代码,或者被实现通过网络下载的原始存储在远程记录介质或非暂时机器可读介质中并将被存储在本地记录介质中的计算机代码,从而在此描述的方法可被存储在使用通用计算机、专用处理器或者可编程或专用硬件(诸如ASIC或FPGA)的记录介质上的这样的软件处理。可以理解,计算机、处理器、微处理器控制器或可编程硬件包括可存储或接收软件或计算机代码的存储组件(例如,RAM、ROM、闪存等),当所述软件或计算机代码被计算机、处理器或硬件访问且执行时,实现在此描述的任务执行方法。此外,当通用计算机访问用于实现在此示出的任务执行方法的代码时,代码的执行将通用计算机转换为用于执行在此示出的任务执行方法的专用计算机。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及方法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请实施例的范围。
以上实施方式仅用于说明本申请实施例,而并非对本申请实施例的限制,有关技术领域的普通技术人员,在不脱离本申请实施例的精神和范围的情况下,还可以做出各种变化和变型,因此所有等同的技术方案也属于本申请实施例的范畴,本申请实施例的专利保护范围应由权利要求限定。

Claims (14)

  1. 一种任务执行方法,应用于客户端,所述方法包括:
    在通过代码执行环境执行程序代码的过程中,检测到预设任务的触发执行代码;
    根据所述触发执行代码,通过所述代码执行环境进行调度策略查询,获得针对所述预设任务的调度策略;
    将所述预设任务通过所述代码执行环境的环境通信接口,调度至获得的所述调度策略所指示的云端目标设备的代码执行环境中执行。
  2. 根据权利要求1所述的方法,其中,所述将所述预设任务通过所述代码执行环境的环境通信接口,调度至获得的所述调度策略所指示的云端目标设备的代码执行环境中执行,包括:
    通过所述代码执行环境,获得所述预设任务的环境执行代码,所述环境执行代码为可在所述代码执行环境中执行的代码;
    将所述预设任务的环境执行代码通过所述代码执行环境的环境通信接口,调度至获得的所述调度策略所指示的云端目标设备的代码执行环境中执行。
  3. 根据权利要求2所述的方法,其中,所述将所述预设任务的环境执行代码通过所述代码执行环境的环境通信接口,调度至获得的所述调度策略所指示的云端目标设备的代码执行环境中执行,包括:
    通过所述代码执行环境的环境通信接口,向所述调度策略所指示的云端目标设备的代码执行环境的环境通信接口发送客户端的所述代码执行环境的环境参数和所述预设任务的环境执行代码,以使所述云端目标设备根据所述环境参数初始化所述云端目标设备自身的代码执行环境,并在初始化完成后执行所述预设任务的环境执行代码。
  4. 根据权利要求1或2所述的方法,其中,所述根据所述触发执行代码,通过所述代码执行环境进行调度策略查询,获得针对所述预设任务的调度策略,包括:
    根据所述触发执行代码,通过所述代码执行环境向边缘云和/或中心云发送针对所述预设任务的调度策略查询请求;接收响应于所述调度策略查询请求的查询结果,根据所述查询结果获得针对所述预设任务的调度策略;
    或者,
    根据所述触发执行代码,通过所述代码执行环境进行客户端本地的调度策略查询,并获得针对所述预设任务的调度策略。
  5. 根据权利要求1所述的方法,其中,在所述在通过代码执行环境执行程序代码的过程中,检测到预设任务的触发执行代码之前,所述方法还包括:
    接收到包含有调用所述预设任务的系统调用指令;
    为所述系统调用指令所对应的程序创建代码执行环境,以使所述预设任务在所述代码执行环境中执行。
  6. 根据权利要求1所述的方法,其中,所述代码执行环境为基于WEBASSEMBLY标准 的代码执行环境。
  7. 一种任务执行方法,应用于云端,所述方法包括:
    通过代码执行环境的环境通信接口,接收从客户端的代码安全环境发送来的针对预设任务的调度策略查询请求;
    响应于所述调度策略查询请求,获取所述云端的运行状态信息;
    根据所述运行状态信息确定所述云端的可执行所述预设任务的目标设备,并根据所述目标设备确定调度策略;
    通过所述云端的代码执行环境的环境通信接口,将所述调度策略发送给所述客户端的代码执行环境。
  8. 根据权利要求7所述的方法,其中,所述方法还包括:
    通过所述目标设备中的代码执行环境的环境通信接口,接收所述客户端发送的客户端的代码执行环境的环境参数和所述预设任务的环境执行代码,所述环境执行代码为可在所述代码执行环境中执行的代码:
    根据所述环境参数初始化所述目标设备的代码执行环境,并在初始化完成后执行所述预设任务的环境执行代码。
  9. 根据权利要求7所述的方法,其中,所述方法还包括:
    若根据所述运行状态信息确定所述云端不存在可执行所述预设任务的目标设备,则通过所述云端的代码执行环境的环境通信接口,向所述客户端的代码执行环境返回任务拒绝信息,以使所述客户端在自身的代码执行环境中执行所述预设任务。
  10. 根据权利要求7所述的方法,其中,所述代码执行环境为基于WEBASSEMBLY标准的代码执行环境。
  11. 一种任务执行系统,至少包括:客户端和云端;
    其中:
    所述客户端,用于在通过代码执行环境执行程序代码的过程中,检测到预设任务的触发执行代码;根据所述触发执行代码,通过所述代码执行环境向所述云端进行调度策略查询,获得针对所述预设任务的调度策略;将所述预设任务通过所述代码执行环境的环境通信接口,调度至获得的所述调度策略所指示的云端目标设备的代码执行环境中执行;
    所述云端,用于通过云端的代码执行环境的环境通信接口,接收所述客户端发送的针对所述预设任务的调度策略查询请求,响应于所述调度策略查询请求,确定并向所述客户端的代码执行环境返回调度策略;以及,通过所述调度策略所指示的目标设备的代码执行环境,执行所述客户端调度来的所述预设任务。
  12. 根据权利要求11所述的系统,其中,
    所述客户端通过客户端的代码执行环境,获得所述预设任务的环境执行代码,所述环境执行代码为可在所述代码执行环境中执行的代码;将所述预设任务的环境执行代码 通过所述代码执行环境的环境通信接口,发送至所述目标设备的代码执行环境中执行。
  13. 根据权利要求11或12所述的系统,其中,所述代码执行环境为基于WEBASSEMBLY标准的代码执行环境。
  14. 一种电子设备,包括:处理器、存储器、通信接口和通信总线,所述处理器、所述存储器和所述通信接口通过所述通信总线完成相互间的通信;
    所述存储器用于存放至少一可执行指令,所述可执行指令使所述处理器执行如权利要求1-6中任一项所述的任务执行方法对应的操作;或者,所述可执行指令使所述处理器执行如权利要求7-10中任一项所述的任务执行方法对应的操作。
PCT/CN2022/112463 2021-08-30 2022-08-15 任务执行方法、系统、电子设备及计算机存储介质 WO2023029961A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111006428.3 2021-08-30
CN202111006428.3A CN113656164B (zh) 2021-08-30 2021-08-30 任务执行方法、系统、电子设备及计算机存储介质

Publications (1)

Publication Number Publication Date
WO2023029961A1 true WO2023029961A1 (zh) 2023-03-09

Family

ID=78493285

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/112463 WO2023029961A1 (zh) 2021-08-30 2022-08-15 任务执行方法、系统、电子设备及计算机存储介质

Country Status (2)

Country Link
CN (1) CN113656164B (zh)
WO (1) WO2023029961A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113656164B (zh) * 2021-08-30 2024-05-03 阿里巴巴(中国)有限公司 任务执行方法、系统、电子设备及计算机存储介质
CN115664836B (zh) * 2022-11-07 2023-10-03 海光信息技术股份有限公司 数据传输方法、装置、计算机设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180150341A1 (en) * 2016-11-28 2018-05-31 Amazon Technologies, Inc. Remote invocation of code execution in a localized device coordinator
US10372499B1 (en) * 2016-12-27 2019-08-06 Amazon Technologies, Inc. Efficient region selection system for executing request-driven code
US10951521B2 (en) * 2017-09-01 2021-03-16 Maxlinear, Inc. Method for scheduling a computational task, a method for processing a computational task, a computer readable storage medium, a computer program, a residential gateway, and a server
US20210136142A1 (en) * 2018-07-27 2021-05-06 Huawei Technologies Co., Ltd. Task offloading and routing in mobile edge cloud networks
CN113656164A (zh) * 2021-08-30 2021-11-16 阿里巴巴(中国)有限公司 任务执行方法、系统、电子设备及计算机存储介质

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6804718B1 (en) * 1999-03-18 2004-10-12 Kent Ridge Digital Labs Computing system and method for migrating a mobile computing environment
US9658890B2 (en) * 2010-10-08 2017-05-23 Microsoft Technology Licensing, Llc Runtime agnostic representation of user code for execution with selected execution runtime
WO2018098443A1 (en) * 2016-11-28 2018-05-31 Amazon Technologies, Inc. On-demand code execution in a localized device coordinator
CN109117170B (zh) * 2017-06-22 2023-04-07 中兴通讯股份有限公司 一种运行环境搭建方法及装置、代码合入方法及系统

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180150341A1 (en) * 2016-11-28 2018-05-31 Amazon Technologies, Inc. Remote invocation of code execution in a localized device coordinator
US10372499B1 (en) * 2016-12-27 2019-08-06 Amazon Technologies, Inc. Efficient region selection system for executing request-driven code
US10951521B2 (en) * 2017-09-01 2021-03-16 Maxlinear, Inc. Method for scheduling a computational task, a method for processing a computational task, a computer readable storage medium, a computer program, a residential gateway, and a server
US20210136142A1 (en) * 2018-07-27 2021-05-06 Huawei Technologies Co., Ltd. Task offloading and routing in mobile edge cloud networks
CN113656164A (zh) * 2021-08-30 2021-11-16 阿里巴巴(中国)有限公司 任务执行方法、系统、电子设备及计算机存储介质

Also Published As

Publication number Publication date
CN113656164A (zh) 2021-11-16
CN113656164B (zh) 2024-05-03

Similar Documents

Publication Publication Date Title
WO2023029961A1 (zh) 任务执行方法、系统、电子设备及计算机存储介质
CN108540538B (zh) 一种基于sdn的云雾结合物联网应用构建系统
US11151010B2 (en) Resource configuration method, mobile terminal and storage medium
US10698717B2 (en) Accelerator virtualization method and apparatus, and centralized resource manager
EP3837604B1 (en) In situ triggered function as a service within a service mesh
CN108536538A (zh) 处理器核心调度方法、装置、终端及存储介质
AU2019256257B2 (en) Processor core scheduling method and apparatus, terminal, and storage medium
Verbelen et al. Adaptive deployment and configuration for mobile augmented reality in the cloudlet
CN112612536B (zh) 基于Linux系统中Android应用程序控制摄像的方法及装置
US11182210B2 (en) Method for resource allocation and terminal device
Orsini et al. CloudAware: empowering context‐aware self‐adaptation for mobile applications
CN111200606A (zh) 深度学习模型任务处理方法、系统、服务器及存储介质
CN111078316B (zh) 布局文件加载方法、装置、存储介质及电子设备
CN110738156A (zh) 一种基于消息中间件的人脸识别系统及方法
WO2022257247A1 (zh) 数据处理方法、装置及计算机可读存储介质
WO2023124657A1 (zh) 微应用的运行方法、装置、设备、存储介质及程序产品
US20080313309A1 (en) Client-server data transfer control
CN114546648A (zh) 任务处理方法及任务处理平台
CN114338830A (zh) 数据传输方法、装置、计算机可读存储介质及计算机设备
CN113992644A (zh) 一种基于无服务技术的物联网关系统及其数据处理方法
CN112165529A (zh) 一种低成本跨网络数据交换的方法、装置、设备和介质
Kemppainen Mobile computation offloading: A context-driven approach
CN115861775B (zh) 一种视频分析方法及系统
CN117319234A (zh) 基于GRPC和OpenDDS的分布式通信系统及通信方法
CN117155810A (zh) 基于grpc和udp广播的分布式通信系统及通信方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22863101

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE