TWI786527B - User code operation method of programming platform, electronic equipment and computer-readable storage medium - Google Patents

User code operation method of programming platform, electronic equipment and computer-readable storage medium Download PDF

Info

Publication number
TWI786527B
TWI786527B TW110102727A TW110102727A TWI786527B TW I786527 B TWI786527 B TW I786527B TW 110102727 A TW110102727 A TW 110102727A TW 110102727 A TW110102727 A TW 110102727A TW I786527 B TWI786527 B TW I786527B
Authority
TW
Taiwan
Prior art keywords
task
running
computing
task queue
node
Prior art date
Application number
TW110102727A
Other languages
Chinese (zh)
Other versions
TW202131171A (en
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 TW202131171A publication Critical patent/TW202131171A/en
Application granted granted Critical
Publication of TWI786527B publication Critical patent/TWI786527B/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/33Intelligent editors
    • 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/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • 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/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5022Mechanisms to release resources
    • 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/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Computer And Data Communications (AREA)
  • Telephonic Communication Services (AREA)
  • Electrically Operated Instructional Devices (AREA)
  • Electrophonic Musical Instruments (AREA)
  • Input Circuits Of Receivers And Coupling Of Receivers And Audio Equipment (AREA)

Abstract

The application discloses a user code operation method of a programming platform, electronic equipment and computer-readable storage medium. The programming platform includes a service node, a task queue and a computing node; the method includes: the service node obtains the user code used to represent the user terminal, and places the user code in the task queue as a running task; the computing node monitors the task queue to obtain the running task; the computing node calculates the running task and gets the calculation result; the service node obtains the calculation result from the computing node and feeds back the calculation result to the user terminal.

Description

程式設計平台的使用者代碼運行方法、電子設備和電腦可讀儲存介質User code running method of programming platform, electronic device and computer-readable storage medium

本發明關於程式設計技術領域,特別是關於一種程式設計平台的使用者代碼運行方法、電子設備和電腦可讀儲存介質。The present invention relates to the technical field of programming, in particular to a user code running method of a programming platform, electronic equipment and a computer-readable storage medium.

隨著人工智慧的快速發展,各種依賴於代碼運行的系統也應運而生。不僅代碼越來越多樣化,而且對系統可以提供的功能提出越來越高的要求。With the rapid development of artificial intelligence, various systems that rely on code operation have also emerged. Not only is the code more and more diverse, but there are also higher and higher requirements for the functions that the system can provide.

面對日益複雜的代碼,目前的程式設計平台中,Kernel(執行環境)等代碼的執行環境往往既要保持與使用者終端的連接關係,又要對使用者終端發出的代碼進行計算,導致系統能力不能滿足於代碼運行要求。In the face of increasingly complex codes, in the current programming platform, code execution environments such as the Kernel (execution environment) often need to maintain the connection relationship with the user terminal and calculate the code issued by the user terminal, resulting in system Capabilities cannot meet code running requirements.

基於此,如何提高程式設計平台的使用者代碼運行的併發能力,成為亟待解決的問題。Based on this, how to improve the concurrency capability of the user code running of the programming platform has become an urgent problem to be solved.

本發明提供一種程式設計平台的使用者代碼運行方法、電子設備和電腦可讀儲存介質。The invention provides a user code running method of a programming platform, electronic equipment and a computer-readable storage medium.

本發明程式設計平台包括:服務節點、任務佇列、計算節點。本發明第一方面提供了一種程式設計平台的使用者代碼運行方法,包括:所述服務節點獲取用於表徵使用者終端的使用者代碼,並將所述使用者代碼作為運行任務放置於所述任務佇列中;所述計算節點監控所述任務佇列,以獲取所述運行任務;所述計算節點計算所述運行任務,得到計算結果;所述服務節點從所述計算節點獲取所述計算結果,並將所述計算結果回饋至所述使用者終端。The programming platform of the present invention includes: service nodes, task queues, and computing nodes. The first aspect of the present invention provides a user code running method for a programming platform, including: the service node acquires a user code used to represent a user terminal, and places the user code as a running task in the In the task queue; the computing node monitors the task queue to obtain the running task; the computing node calculates the running task to obtain a calculation result; the service node obtains the computing node from the computing node result, and feed back the calculation result to the user terminal.

因此,服務節點實現與使用者終端的連接,並將使用者代碼放置於佇列中,由計算節點進行使用者代碼的計算,進而實現使用者代碼的運行。上述使用者代碼的運行過程中,服務節點與計算節點分離設置,使得使用者終端的連接與使用者代碼的計算分別由服務節點和計算節點完成,實現使用者代碼運行的非同步通信,提高系統的併發能力。Therefore, the service node realizes the connection with the user terminal, and places the user code in the queue, and the calculation node performs the calculation of the user code, and then realizes the operation of the user code. During the operation of the above user code, the service node and the computing node are set separately, so that the connection of the user terminal and the calculation of the user code are completed by the service node and the computing node respectively, realizing the asynchronous communication of the user code running and improving the system concurrent capabilities.

其中,所述計算節點的數量為至少兩個;所述計算節點監控所述任務佇列,以獲取所述運行任務,包括:至少兩個所述計算節點監控所述任務佇列,向所述任務佇列請求獲取所述運行任務;所述任務佇列將一個所述運行任務分配至一個所述計算節點。Wherein, the number of the computing nodes is at least two; the computing nodes monitor the task queue to obtain the running tasks, including: at least two of the computing nodes monitor the task queue, and send the The task queue requests to obtain the execution task; the task queue allocates one of the execution tasks to one of the computing nodes.

因此,多個計算節點均監控到任務佇列中的一運行任務時,多個計算節點均通過向任務佇列請求獲取運行任務,而任務佇列將該運行任務分配至一個計算節點,通過任務佇列可完成運行任務的合理分配。Therefore, when multiple computing nodes monitor a running task in the task queue, the multiple computing nodes obtain the running task by requesting the task queue, and the task queue assigns the running task to a computing node, through the task Queues can complete the reasonable distribution of running tasks.

其中,所述任務佇列包括第一任務佇列和第二任務佇列,至少兩個所述計算節點包括第一計算節點和第二計算節點;所述將所述使用者代碼作為運行任務放置於任務佇列中,包括:根據所述使用者代碼的計算特徵,將所述使用者代碼作為運行任務放置於第一任務佇列或第二任務佇列中;所述計算節點監控所述任務佇列,包括:所述第一計算節點監控所述第一任務佇列,所述第二計算節點監控所述第二任務佇列。Wherein, the task queue includes a first task queue and a second task queue, and at least two of the computing nodes include the first computing node and the second computing node; the placing the user code as a running task In the task queue, including: according to the calculation characteristics of the user code, placing the user code as a running task in the first task queue or the second task queue; the computing node monitors the task The queue includes: the first computing node monitors the first task queue, and the second computing node monitors the second task queue.

因此,服務節點可基於使用者代碼的計算特徵對使用者代碼進行區分,分別放置於第一任務佇列或第二任務佇列中,使得不同計算節點監控不同任務佇列,從而針對使用者代碼不同的運行要求對使用者代碼進行區別處理。Therefore, the service node can distinguish the user code based on the computing characteristics of the user code, and place them in the first task queue or the second task queue respectively, so that different computing nodes monitor different task queues, so as to target the user code Different operations require different processing of user code.

其中,所述服務節點的數量為至少兩個;所述服務節點獲取用於表徵使用者終端的使用者代碼,包括:至少兩個所述服務節點通過反向代理被分配所述使用者代碼。Wherein, the number of the service nodes is at least two; the service node obtaining the user code used to characterize the user terminal includes: at least two of the service nodes are assigned the user code through a reverse proxy.

因此,本發明可提供至少兩個服務節點,並且服務節點通過反向代理被分配使用者代碼,從而實現多個服務節點接收到使用者終端發出的使用者代碼,提高併發處理能力。Therefore, the present invention can provide at least two service nodes, and the service nodes are assigned user codes through the reverse proxy, so that multiple service nodes can receive the user codes sent by the user terminal, and the concurrent processing capability can be improved.

其中,所述計算節點在完成對所述運行任務的計算後,釋放對應的計算資源並繼續監控所述任務佇列。Wherein, after the computing node finishes computing the running task, it releases the corresponding computing resource and continues to monitor the task queue.

因此,計算節點完成計算後即釋放資源,繼續監控任務佇列,以獲取新的運行任務,計算節點執行完畢運行任務即釋放資源,使得計算和記憶體資源重複利用,充分並合理地利用硬體資源。Therefore, after the computing node completes the calculation, it will release resources and continue to monitor the task queue to obtain new running tasks. After the computing node executes the running tasks, it will release resources, so that computing and memory resources can be reused, and hardware can be fully and reasonably used resource.

其中,所述程式設計平台還包括訊息佇列;所述服務節點從所述計算節點獲取所述計算結果,以將所述計算結果回饋至所述使用者終端,包括:所述計算節點將所述計算結果放置於所述訊息佇列;所述服務節點監控所述訊息佇列,以獲取所述計算結果,並將所述計算結果回饋至所述使用者終端。Wherein, the programming platform further includes a message queue; the service node obtains the calculation result from the computing node to feed back the computing result to the user terminal, including: the computing node sends the The calculation result is placed in the message queue; the service node monitors the message queue to obtain the calculation result, and feeds back the calculation result to the user terminal.

因此,計算節點對任意使用者代碼對應的運行任務執行完畢後,均將計算結果統一放置於訊息佇列中,服務節點監控訊息佇列,即可得到計算節點的計算結果,使得計算結果也進行統一管理。Therefore, after the computing node executes the operation task corresponding to any user code, it will place the calculation results in the message queue uniformly. The service node monitors the message queue to obtain the calculation results of the computing nodes, so that the calculation results are also processed. Unified management.

其中,所述服務節點在獲取所述計算結果之前,保持與所述使用者終端的會話連接。Wherein, the service node maintains a session connection with the user terminal before obtaining the calculation result.

因此,服務節點在獲取所述計算結果之前,一直保持與使用者終端的會話連接,也即保持服務節點與使用者終端的聯繫,方便將計算結果回饋回使用者終端。Therefore, before obtaining the calculation result, the service node keeps the session connection with the user terminal, that is, maintains the connection between the service node and the user terminal, so as to feed back the calculation result to the user terminal.

本發明第二方面提供了一種程式設計平台的使用者代碼運行方法,該方法包括獲取用於表徵使用者終端的使用者代碼;將所述使用者代碼作為運行任務放置於任務佇列中,以由計算節點從所述任務佇列中獲取並計算所述運行任務;獲取所述計算節點的計算結果,並將所述計算結果回饋至所述使用者終端。The second aspect of the present invention provides a user code running method of a programming platform, the method includes acquiring a user code used to characterize a user terminal; placing the user code as a running task in a task queue, and The computing node obtains and calculates the running task from the task queue; obtains the computing result of the computing node, and feeds back the computing result to the user terminal.

因此,服務節點用於與使用者終端連接,並將使用者終端發出的使用者代碼作為運行任務放置於任務佇列中,使得獨立於服務節點的計算節點從任務佇列中獲取並計算運行任務得到計算結果後,服務節點獲取計算節點的計算結果,並將計算結果回饋至使用者終端,實現使用者代碼的運行。Therefore, the service node is used to connect with the user terminal, and place the user code sent by the user terminal as a running task in the task queue, so that the computing node independent of the service node obtains and calculates the running task from the task queue After obtaining the calculation result, the service node obtains the calculation result of the calculation node, and feeds back the calculation result to the user terminal to realize the operation of the user code.

其中,所述將所述使用者代碼作為運行任務放置於任務佇列中,以由計算節點從所述任務佇列中獲取並計算所述運行任務,包括:根據所述使用者代碼的計算特徵,將所述使用者代碼作為運行任務放置於第一任務佇列或第二任務佇列中,以由第一計算節點從所述第一任務佇列中獲取並計算所述運行任務,或由第二計算節點從所述第二任務佇列中獲取並計算所述運行任務。Wherein, the placing the user code as a running task in a task queue so that the computing node obtains and calculates the running task from the task queue includes: according to the calculation characteristics of the user code , placing the user code as a running task in the first task queue or the second task queue, so that the first computing node obtains and calculates the running task from the first task queue, or by The second calculation node acquires and calculates the running task from the second task queue.

因此,服務節點可基於使用者代碼的計算特徵對使用者代碼進行區分,分別放置於第一任務佇列或第二任務佇列中,使得不同計算節點監控不同任務佇列,從而針對使用者代碼不同的運行要求對使用者代碼進行區別處理。Therefore, the service node can distinguish the user code based on the computing characteristics of the user code, and place them in the first task queue or the second task queue respectively, so that different computing nodes monitor different task queues, so as to target the user code Different operations require different processing of user code.

其中,所述獲取用於表徵使用者終端的使用者代碼,包括:通過反向代理被分配所述使用者代碼。Wherein, said obtaining the user code used to characterize the user terminal includes: being assigned the user code through a reverse proxy.

因此,服務節點通過反向代理被分配使用者代碼,從而合理分配服務節點接收到使用者終端發出的使用者代碼。Therefore, the service node is assigned the user code through the reverse proxy, so that the service node is reasonably assigned to receive the user code sent by the user terminal.

其中,所述方法包括:在獲取所述計算結果之前,保持與所述使用者終端的會話連接。Wherein, the method includes: before obtaining the calculation result, maintaining a session connection with the user terminal.

因此,服務節點在獲取所述計算結果之前,一直保持與使用者終端的會話連接,也即保持服務節點與使用者終端的聯繫,方便將計算結果回饋回使用者終端。Therefore, before obtaining the calculation result, the service node keeps the session connection with the user terminal, that is, maintains the connection between the service node and the user terminal, so as to feed back the calculation result to the user terminal.

本發明第三方面提供了一種程式設計平台的使用者代碼運行方法,所述方法包括:監控任務佇列,以獲取運行任務;所述任務佇列中包括所述運行任務,所述運行任務對應所述使用者代碼;計算所述運行任務,得到計算結果。The third aspect of the present invention provides a user code running method of a programming platform, the method includes: monitoring the task queue to obtain running tasks; the running tasks are included in the task queue, and the running tasks correspond to The user code; calculating the running task to obtain a calculation result.

因此,任務佇列中包括運行任務,而運行任務對應使用者代碼,於是計算節點監控包括運行任務的任務佇列,從而獲取到對應使用者代碼的運行任務,進而計算運行任務得到計算結果,實現運行任務的獲取與計算。Therefore, the task queue includes the running task, and the running task corresponds to the user code, so the computing node monitors the task queue including the running task, thereby obtaining the running task corresponding to the user code, and then calculates the running task to obtain the calculation result, and realizes Acquisition and calculation of running tasks.

其中,程式設計平台的使用者代碼運行方法還包括:在完成對所述運行任務的計算後,釋放對應的計算資源並繼續監控所述任務佇列。Wherein, the user code running method of the programming platform further includes: after completing the calculation of the running task, releasing the corresponding computing resources and continuing to monitor the task queue.

因此,計算節點完成計算後即釋放資源,繼續監控任務佇列,以獲取新的運行任務,進而使得使用者代碼可以在不同計算節點中執行,且計算節點執行完畢運行任務即釋放資源,使得計算和記憶體資源重複利用,充分並合理地利用硬體資源。Therefore, after the computing node completes the calculation, it releases resources, and continues to monitor the task queue to obtain new running tasks, so that user code can be executed in different computing nodes, and the computing node releases resources after executing the running tasks, making computing And memory resources are reused, and hardware resources are fully and reasonably used.

本發明第四方面提供了一種程式設計平台,該程式設計平台包括:服務節點、任務佇列、計算節點;所述服務節點配置為獲取用於表徵使用者終端的使用者代碼,並將所述使用者代碼作為運行任務放置於所述任務佇列中;所述計算節點配置為監控所述任務佇列,以獲取所述運行任務;所述計算節點還配置為計算所述運行任務,得到計算結果;所述服務節點還配置為從所述計算節點獲取所述計算結果,以將所述計算結果回饋至所述使用者終端。The fourth aspect of the present invention provides a programming platform, which includes: a service node, a task queue, and a computing node; the service node is configured to obtain a user code used to represent a user terminal, and the User code is placed in the task queue as a running task; the computing node is configured to monitor the task queue to obtain the running task; the computing node is also configured to compute the running task to obtain the computed Result; the service node is further configured to obtain the calculation result from the calculation node, so as to feed back the calculation result to the user terminal.

其中,所述計算節點的數量為至少兩個;所述計算節點配置為監控所述任務佇列,以獲取所述運行任務時,至少兩個所述計算節點配置為監控所述任務佇列,向所述任務佇列請求獲取所述運行任務;所述任務佇列配置為將一個所述運行任務分配至一個所述計算節點。Wherein, the number of the computing nodes is at least two; the computing nodes are configured to monitor the task queue, so as to obtain the running tasks, at least two of the computing nodes are configured to monitor the task queue, requesting the execution task from the task queue; the task queue is configured to assign one of the execution tasks to one of the computing nodes.

其中,所述任務佇列包括第一任務佇列和第二任務佇列,至少兩個所述計算節點包括第一計算節點和第二計算節點;所述服務節點用於將所述使用者代碼作為運行任務放置於任務佇列中時,具體地,所述服務節點用於根據所述使用者代碼的計算特徵,將所述使用者代碼作為運行任務放置於第一任務佇列或第二任務佇列中;所述計算節點用於監控所述任務佇列,具體地,所述第一計算節點用於監控所述第一任務佇列,所述第二計算節點用於監控所述第二任務佇列。Wherein, the task queue includes a first task queue and a second task queue, and at least two of the computing nodes include a first computing node and a second computing node; the service node is used to use the user code When placing the user code as a running task in the task queue, specifically, the service node is configured to place the user code as a running task in the first task queue or the second task according to the calculation characteristics of the user code In the queue; the computing node is used to monitor the task queue, specifically, the first computing node is used to monitor the first task queue, and the second computing node is used to monitor the second task queue.

其中,所述服務節點的數量為至少兩個;所述服務節點配置為獲取用於表徵使用者終端的使用者代碼時,至少兩個所述服務節點配置為通過反向代理被分配所述使用者代碼。Wherein, the number of the service nodes is at least two; when the service nodes are configured to obtain the user code used to characterize the user terminal, at least two of the service nodes are configured to be assigned the usage code through the reverse proxy or code.

其中,所述計算節點配置為在完成所述運行任務的計算後,釋放對應的計算資源並繼續監控所述任務佇列。Wherein, the computing node is configured to release corresponding computing resources and continue to monitor the task queue after completing the computing of the running task.

其中,所述程式設計平台還包括訊息佇列;所述服務節點配置為從所述計算節點獲取所述計算結果,以將所述計算結果回饋至所述使用者終端時,所述計算節點配置為將所述計算結果放置於所述訊息佇列;所述服務節點配置為監控所述訊息佇列,以獲取所述計算結果,並將所述計算結果回饋至所述使用者終端。Wherein, the programming platform further includes a message queue; the service node is configured to obtain the calculation result from the computing node, so that when feeding the computing result back to the user terminal, the computing node is configured To place the calculation result in the message queue; the service node is configured to monitor the message queue to obtain the calculation result, and feed back the calculation result to the user terminal.

其中,所述服務節點在獲取所述計算結果之前,還配置為保持與所述使用者終端的會話連接。Wherein, the service node is further configured to maintain a session connection with the user terminal before obtaining the calculation result.

本發明第五方面提供了一種服務節點,包括接收單元、放置單元和獲取單元,所述接收單元配置為獲取用於表徵使用者終端的使用者代碼;所述放置單元配置為將所述使用者代碼作為運行任務放置於任務佇列中,以由計算節點從所述任務佇列中獲取並計算所述運行任務;所述獲取單元配置為獲取所述計算節點的計算結果,並將所述計算結果回饋至所述使用者終端。The fifth aspect of the present invention provides a service node, including a receiving unit, a placing unit, and an acquiring unit, the receiving unit is configured to acquire a user code used to represent a user terminal; the placing unit is configured to place the user The code is placed in the task queue as a running task, so that the computing node acquires and calculates the running task from the task queue; the obtaining unit is configured to obtain the calculation result of the computing node, and the computing node The result is fed back to the user terminal.

其中,所述放置單元配置為將所述使用者代碼作為運行任務放置於任務佇列中,以由計算節點從所述任務佇列中獲取並計算所述運行任務時,還配置為根據所述使用者代碼的計算特徵,將所述使用者代碼作為運行任務放置於第一任務佇列或第二任務佇列中,以由第一計算節點從所述第一任務佇列中獲取並計算所述運行任務,或由第二計算節點從所述第二任務佇列中獲取並計算所述運行任務。Wherein, the placing unit is configured to place the user code as a running task in the task queue, so that when the computing node obtains and calculates the running task from the task queue, it is also configured to The calculation feature of the user code, the user code is placed as a running task in the first task queue or the second task queue, so that the first computing node can obtain and calculate all The running task, or the second computing node obtains and calculates the running task from the second task queue.

其中,所述接收單元配置為獲取用於表徵使用者終端的使用者代碼時,還配置為通過反向代理被分配所述使用者代碼。Wherein, when the receiving unit is configured to obtain the user code used to characterize the user terminal, it is also configured to be assigned the user code through a reverse proxy.

其中,所述獲取單元在獲取所述計算結果之前,所述服務節點配置為保持與所述使用者終端的會話連接。Wherein, before the obtaining unit obtains the calculation result, the service node is configured to maintain a session connection with the user terminal.

本發明第六方面提供了一種計算節點,包括監控單元和計算單元,所述監控單元配置為監控任務佇列,以獲取運行任務;其中所述任務佇列中包括所述運行任務,所述運行任務對應所述使用者代碼;所述計算單元配置為計算所述運行任務,得到計算結果。The sixth aspect of the present invention provides a computing node, including a monitoring unit and a computing unit, and the monitoring unit is configured to monitor a task queue to acquire running tasks; wherein the running task is included in the task queue, and the running task The task corresponds to the user code; the calculation unit is configured to calculate the running task and obtain a calculation result.

其中,所述計算單元在完成所述運行任務的計算後,還配置為釋放對應的計算資源並繼續監控所述任務佇列。Wherein, after the computing unit completes the computing of the running task, it is further configured to release corresponding computing resources and continue to monitor the task queue.

本發明第七方面提供了一種電子設備,包括相互耦接的記憶體和處理器;所述處理器用於執行所述記憶體儲存的程式指令,以實現上述第一方面的程式設計平台的使用者代碼運行方法;和/或,以實現上述第二方面的程式設計平台的使用者代碼運行方法;和/或,以實現上述第三方面的程式設計平台的使用者代碼運行方法。The seventh aspect of the present invention provides an electronic device, including a memory and a processor coupled to each other; the processor is used to execute the program instructions stored in the memory, so as to realize the user of the programming platform of the first aspect above A code running method; and/or, to realize the user code running method of the programming platform of the second aspect above; and/or, to realize the user code running method of the programming platform of the third aspect above.

因此,服務節點用於實現與使用者終端的連接,並將使用者代碼放置於佇列中,由計算節點用於進行使用者代碼的計算,進而實現使用者代碼的運行。上述使用者代碼的運行過程中,服務節點與計算節點分離設置,使得使用者終端的連接與使用者代碼的計算分別由服務節點和計算節點完成,實現使用者代碼運行的非同步通信,提高系統的併發能力。Therefore, the service node is used to realize the connection with the user terminal, and puts the user code in the queue, and the calculation node is used to calculate the user code, and then realize the operation of the user code. During the operation of the above user code, the service node and the computing node are set separately, so that the connection of the user terminal and the calculation of the user code are completed by the service node and the computing node respectively, realizing the asynchronous communication of the user code running and improving the system concurrent capabilities.

本發明第八方面提供了一種電腦可讀儲存介質,其上儲存有能夠被處理器運行的程式指令,程式指令用於實現上述第一方面的程式設計平台的使用者代碼運行方法;和/或,實現上述第二方面的程式設計平台的使用者代碼運行方法;和/或,實現上述第三方面的程式設計平台的使用者代碼運行方法。The eighth aspect of the present invention provides a computer-readable storage medium, on which are stored program instructions that can be executed by a processor, and the program instructions are used to implement the user code running method of the programming platform of the first aspect above; and/or , realizing the user code running method of the programming platform of the second aspect above; and/or, realizing the user code running method of the programming platform of the third aspect above.

因此,上述使用者代碼的運行過程中,服務節點用於實現與使用者終端的連接,而計算節點用於實現使用者代碼的計算,實現使用者代碼運行的非同步通信,提高系統的併發能力。Therefore, during the operation of the above user code, the service node is used to realize the connection with the user terminal, and the computing node is used to realize the calculation of the user code, realize the asynchronous communication of the user code operation, and improve the concurrency capability of the system .

以下將參考附圖詳細說明本發明實施例的各種示例性實施例、特徵和方面。附圖中相同的附圖標記表示功能相同或相似的元件。儘管在附圖中示出了實施例的各種方面,但是除非特別指出,不必按比例繪製附圖。Various exemplary embodiments, features, and aspects of embodiments of the present invention will be described in detail below with reference to the accompanying drawings. The same reference numbers in the figures indicate functionally identical or similar elements. While various aspects of the embodiments are shown in drawings, the drawings are not necessarily drawn to scale unless specifically indicated.

下面結合說明書附圖,對本發明實施例的方案進行詳細說明。The solutions of the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings.

下面將結合本發明實施例中的附圖,對本發明實施例中的技術方案進行清楚、完整地描述,顯然,所描述的實施例僅是本發明的一部分實施例,而不是全部的實施例。基於本發明中的實施例,本領域普通技術人員在沒有做出創造性勞動前提下所獲得的所有其他實施例,都屬於本發明保護的範圍。本文中術語“第一”、“第二”僅用於描述目的,而不能理解為指示或暗示相對重要性或者隱含指明所指示的技術特徵的數量。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention. The terms "first" and "second" herein are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly specifying the quantity of indicated technical features.

在一些實施例中,隨著人工智慧的普及,機器學習和人工智慧程式設計教育也逐漸成為程式設計教育的一個重要組成部分。有別於常規的程式設計入門教育,人工智慧程式設計教育中學生執行的人工智慧代碼往往需要實現大量的計算,相應的資源開銷也較大,如(central processing unit,中央處理器)CPU/GPU(Graphics Processing Unit,圖形處理器)佔用率、記憶體空間等。在相關技術的程式設計教育平台中,為每一使用者創建一個獨立的Kernel,並留存於伺服器記憶體中,使得每一使用者在創建的獨立Kernel中進行程式設計實驗。這樣,由於人工智慧代碼需要的資源開銷大,導致每個Kernel佔用大量的CPU/GPU資源和記憶體空間,如果每個使用者的Kernel都常駐記憶體,則整體開銷巨大,資源利用率低下;而且每個使用者和Kernel是嚴格的一一對應關係,因此能夠同時進行線上程式設計學習的使用者數受限於伺服器所能支援的Kernel數量;由於每個使用者的Kernel進程的運行時環境是不變的,使得無法根據使用者代碼的資源佔用情況將其靈活調度到不同機器上去執行,在多機部署的情況下容易造成各資源配置的不合理,不利於提升系統併發能力。如此,在人工智慧線上程式設計教育中,使得伺服器成本開銷激增,難以推廣和普及。In some embodiments, with the popularization of artificial intelligence, machine learning and artificial intelligence programming education have gradually become an important part of programming education. Different from conventional introductory programming education, the artificial intelligence code executed by students in artificial intelligence programming education often needs to achieve a large amount of calculations, and the corresponding resource overhead is also relatively large, such as (central processing unit, central processing unit) CPU/GPU ( Graphics Processing Unit, graphics processor) occupancy rate, memory space, etc. In the programming education platform of the related technology, an independent Kernel is created for each user and stored in the server memory, so that each user can perform programming experiments in the created independent Kernel. In this way, due to the large resource overhead required by the artificial intelligence code, each Kernel occupies a large amount of CPU/GPU resources and memory space. If each user's Kernel is resident in memory, the overall overhead is huge and the resource utilization rate is low; Moreover, there is a strict one-to-one correspondence between each user and Kernel, so the number of users who can learn online programming at the same time is limited by the number of Kernels that the server can support; due to the runtime of each user's Kernel process The environment is constant, making it impossible to flexibly schedule user codes to be executed on different machines according to the resource occupation of the user code. In the case of multi-machine deployment, it is easy to cause unreasonable resource allocation, which is not conducive to improving the system's concurrency capability. In this way, in the artificial intelligence online programming education, the cost of the server has increased sharply, making it difficult to promote and popularize.

基於此,本發明實施例提供一種程式設計平台的使用者代碼運行方法,通過構建一組平等的服務節點和一組平等的計算節點,在使用者提交代碼後,通過websocket(全雙工通信的協議)技術將使用者代碼傳送到任一服務節點。該服務節點創建一個運行任務並將其放入任務佇列並維持當前會話連接,任意計算節點從任務佇列中獲取到運行任務後,執行使用者代碼,並將執行結果即時通過任務佇列回饋給對應的服務節點,計算節點隨即釋放資源。服務節點則從任務佇列讀取執行結果並通過全雙工通信的協議即時推送回使用者終端,推送完畢後結束當前會話。其中,服務節點支援多工併發連接,計算節點支援單任務執行。Based on this, the embodiment of the present invention provides a user code running method of a programming platform. By constructing a group of equal service nodes and a group of equal computing nodes, after the user submits the code, the user code is passed through websocket (full-duplex communication) protocol) technology to transmit the user code to any service node. The service node creates a running task and puts it into the task queue and maintains the current session connection. After any computing node obtains the running task from the task queue, it executes the user code and immediately returns the execution result through the task queue To the corresponding service node, the computing node releases the resource immediately. The service node reads the execution result from the task queue and pushes it back to the user terminal in real time through the full-duplex communication protocol, and ends the current session after the push is completed. Among them, the service node supports multiple concurrent connections, and the computing node supports single task execution.

所述方法的實現流程如圖1所示,圖1是本發明實施例提供的程式設計平台的使用者代碼運行方法一實現流程示意圖。具體而言,本發明實施例方法包括以下步驟。The implementation flow of the method is shown in FIG. 1 . FIG. 1 is a schematic diagram of an implementation flow of a user code running method of a programming platform provided by an embodiment of the present invention. Specifically, the method in the embodiment of the present invention includes the following steps.

步驟S101:服務節點獲取用於表徵使用者終端的使用者代碼,並將使用者代碼作為運行任務放置於任務佇列中。Step S101: the service node obtains the user code used to represent the user terminal, and places the user code as a running task in the task queue.

本發明實施例的程式設計平台包括服務節點、任務佇列以及計算節點。The programming platform of the embodiment of the present invention includes service nodes, task queues and computing nodes.

服務節點可獲取多個使用者終端中任意一個使用者終端的使用者代碼,並且可同時獲取多個使用者終端的使用者代碼,支援多使用者終端的併發連接。服務節點可以由伺服器、電腦等任意具有處理能力的電子設備實現。其中,電子設備還可以用於執行其他功能,例如,電子設備還用於執行計算節點獲取的運行任務的計算,即,服務節點和計算節點可由同一電子設備實現或者由不同電子設備實現。服務節點接收使用者代碼的方式包括但不限於websocket通信技術、HTTP(Hyper Text Transfer Protocol,超文字傳輸協定)通信技術,在此不作具體限定。服務節點接收的使用者代碼的來源可多樣化,例如,使用者終端自帶的代碼編輯視窗獲取到使用者編輯的代碼,形成使用者代碼,亦或者使用者終端接收到與其連接的代碼編輯設備傳輸的使用者代碼等。The service node can obtain the user code of any one of the multiple user terminals, and can simultaneously obtain the user codes of multiple user terminals, so as to support concurrent connections of multiple user terminals. A service node can be implemented by any electronic device with processing capabilities such as a server and a computer. Wherein, the electronic device can also be used to perform other functions, for example, the electronic device can also be used to perform the calculation of the operation task obtained by the computing node, that is, the service node and the computing node can be implemented by the same electronic device or by different electronic devices. The way the service node receives the user code includes but not limited to websocket communication technology, HTTP (Hyper Text Transfer Protocol, hypertext transfer protocol) communication technology, which is not specifically limited here. The source of the user code received by the service node can be diversified. For example, the code editing window that comes with the user terminal obtains the code edited by the user to form a user code, or the user terminal receives the code editing device connected to it. The transmitted user code, etc.

在本發明實施例中,服務節點的數量為至少兩個。服務節點獲取用於表徵使用者終端的使用者代碼時,至少兩個服務節點通過反向代理被分配使用者代碼。這些服務節點對前端應用開放服務,前端應用與服務節點之間採用全雙工通信的協定進行通信,服務節點接收反向代理伺服器分配的使用者終端的使用者代碼,其中,使用者終端的使用者代碼表徵該使用者終端的標識資訊,比如,表示該使用者終端的序號,或者該使用者終端的使用者帳號等。利用反向代理伺服器實現使用者終端與至少兩個服務節點之間的使用者代碼分配,當反向代理伺服器獲取到使用者終端的使用者代碼,即可將使用者代碼分配到至少兩個服務節點,使得每一服務節點通過反向代理被分配使用者代碼。同樣地,服務節點可同時接收多個使用者終端的使用者代碼,支援多使用者終端的併發連接。In the embodiment of the present invention, the number of service nodes is at least two. When the service node obtains the user code used to represent the user terminal, at least two service nodes are assigned the user code through the reverse proxy. These service nodes open services to the front-end applications. The full-duplex communication protocol is used for communication between the front-end applications and the service nodes. The service nodes receive the user codes of the user terminals assigned by the reverse proxy server. Among them, the user terminal The user code represents the identification information of the user terminal, for example, indicates the serial number of the user terminal, or the user account of the user terminal. Use the reverse proxy server to realize the user code distribution between the user terminal and at least two service nodes. When the reverse proxy server obtains the user code of the user terminal, it can distribute the user code to at least two service nodes. service nodes, so that each service node is assigned a user code through the reverse proxy. Likewise, the service node can receive user codes of multiple user terminals at the same time, supporting concurrent connections of multiple user terminals.

服務節點接收到使用者代碼後,為每個使用者代碼創建一運行任務,並將運行任務放置於任務佇列中,從而任務佇列中包括服務節點投放的所有與使用者代碼一一對應的運行任務。排隊佇列可以為Redis(Remote Dictionary Server,遠端字典服務)清單等儲存系統、RabbitMQ(Message Queue,訊息佇列)等面向消息的中介軟體。After the service node receives the user code, it creates a running task for each user code, and places the running task in the task queue, so that the task queue includes all the one-to-one correspondence with the user code released by the service node. Run the task. The queuing queue can be a storage system such as Redis (Remote Dictionary Server, remote dictionary service) list, and message-oriented intermediary software such as RabbitMQ (Message Queue, message queue).

在本發明實施例中,根據使用者代碼的資源依賴需求,將使用者代碼對應的運行任務分離放置。具體地,任務佇列包括第一任務佇列和第二任務佇列,第一任務佇列和第二任務佇列中的運行任務被計算時將依賴於不同的代碼資源,例如,第一任務佇列中的運行任務依賴CPU代碼運行環境資源,而第二任務佇列中的運行任務依賴GPU代碼運行環境資源。第一任務佇列和第二任務佇列中的運行任務的分配取決於使用者代碼的計算特徵,也即,計算特徵用於指示使用者代碼歸屬於第一任務佇列或第二任務佇列。其中,計算特徵的表現形式包括但不限於使用者代碼中的預設位元長的字串標識、二進位碼等。從而,服務節點將使用者代碼作為運行任務放置於任務佇列中時,根據使用者代碼的計算特徵,將使用者代碼作為運行任務放置於第一任務佇列或第二任務佇列中。In the embodiment of the present invention, according to the resource dependency requirements of the user code, the execution tasks corresponding to the user code are separated and placed. Specifically, the task queue includes a first task queue and a second task queue, and the running tasks in the first task queue and the second task queue will depend on different code resources when being calculated, for example, the first task The execution tasks in the queue depend on the CPU code execution environment resources, while the execution tasks in the second task queue depend on the GPU code execution environment resources. The allocation of running tasks in the first task queue and the second task queue depends on the calculation characteristic of the user code, that is, the calculation characteristic is used to indicate that the user code belongs to the first task queue or the second task queue . Wherein, the expression form of the calculation feature includes but not limited to a character string identifier with a preset bit length, a binary code, etc. in the user code. Therefore, when the service node places the user code as the running task in the task queue, it places the user code as the running task in the first task queue or the second task queue according to the computing characteristics of the user code.

在本發明實施例中,任務佇列可包括至少兩個子任務佇列,可預先建立服務節點與多個子任務佇列的關聯關係,服務節點獲取用於表徵使用者終端的使用者代碼,並將使用者代碼作為運行任務放置於不同的子任務佇列中,亦或者建立多個服務節點與多個子任務佇列的關聯關係,一部分服務節點將接收到的使用者代碼分配於與其建立關聯關係的一部分子任務佇列,另一部分服務節點將接收到的使用者代碼分配於與其建立關聯關係的另一部分子任務佇列,實現服務節點與任務佇列的對應關聯關係即可。In the embodiment of the present invention, the task queue may include at least two subtask queues, and the association relationship between the service node and multiple subtask queues may be established in advance, the service node obtains the user code used to represent the user terminal, and Place user codes as running tasks in different subtask queues, or establish associations between multiple service nodes and multiple subtask queues, and some service nodes assign received user codes to establish associations with them A part of the subtask queue, and another part of the service node assigns the received user code to another part of the subtask queue that establishes an association relationship with it, so as to realize the corresponding relationship between the service node and the task queue.

步驟S102:計算節點監控任務佇列,以獲取運行任務。Step S102: The computing node monitors the task queue to obtain running tasks.

任務佇列中包括運行任務,從而計算節點監控任務佇列,檢測到任務佇列中包含該計算節點可執行的運行任務時,即可獲取到運行任務。計算節點從任務佇列中獲取運行任務的方式,包括但不限於任務佇列主動將運行任務分配至計算節點,或者計算節點向任務佇列請求獲取運行任務,任務佇列根據請求將運行任務分配至計算節點。The task queue includes a running task, so that the computing node monitors the task queue, and when it detects that the computing node contains a running task that can be executed by the computing node, the running task can be obtained. The way the computing node obtains running tasks from the task queue, including but not limited to, the task queue actively assigns running tasks to computing nodes, or the computing node requests running tasks from the task queue, and the task queue assigns running tasks according to the request to compute nodes.

在本發明實施例中,計算節點的數量為至少兩個。計算節點監控任務佇列,以獲取運行任務時,至少兩個計算節點監控任務佇列,向任務佇列請求獲取運行任務;任務佇列將一個運行任務分配至一個計算節點,從而任務佇列完成運行任務的合理分配。任務佇列將運行任務分配至計算節點的規則可自訂設置,例如,預先儲存所有計算節點的優先等級,任務佇列同時收到多個計算節點對同一運行任務的獲取請求時,將運行任務分配至優先等級高的計算節點;或者將運行任務分配至預設時間內獲取運行任務最少的計算節點,在此不作具體限定。In the embodiment of the present invention, the number of computing nodes is at least two. When the computing node monitors the task queue to obtain the running task, at least two computing nodes monitor the task queue and request the running task from the task queue; the task queue assigns a running task to a computing node, so that the task queue is completed Reasonable distribution of running tasks. Task Queue The rules for assigning running tasks to computing nodes can be customized. For example, the priority levels of all computing nodes are stored in advance. When the task queue receives requests from multiple computing nodes for the same running task at the same time, the task will be run Allocation to computing nodes with high priority; or assigning running tasks to computing nodes that obtain the fewest running tasks within a preset time, which is not specifically limited here.

在本發明實施例中,任務佇列包括第一任務佇列和第二任務佇列、計算節點包括第一計算節點和第二計算節點的情況下,計算節點監控任務佇列具體為第一計算節點監控第一任務佇列,第二計算節點監控第二任務佇列,從而實現不同計算節點分別監控不同任務佇列,方便管理,提高運行任務的獲取效率。其中,第一計算節點和第二計算節點可分別位於不同配置的伺服器上,從而分別擁有不同的計算和儲存資源,可實現不同使用者代碼的計算。對於使用者代碼的計算,可由計算特徵獲知使用者代碼被計算時所依賴的計算和儲存資源,也即,使用者代碼的計算特徵用於指示使用者代碼歸屬於第一任務佇列或第二任務佇列,進而指示使用者代碼被位於不同配置的伺服器上第一計算節點或第二計算節點計算。In the embodiment of the present invention, when the task queue includes the first task queue and the second task queue, and the computing node includes the first computing node and the second computing node, the monitoring task queue of the computing node is specifically the first computing node The node monitors the first task queue, and the second computing node monitors the second task queue, so that different computing nodes monitor different task queues respectively, which facilitates management and improves the efficiency of obtaining running tasks. Wherein, the first computing node and the second computing node can be respectively located on servers with different configurations, so that they have different computing and storage resources respectively, and can realize computing of different user codes. For the calculation of the user code, the calculation and storage resources on which the user code is calculated can be obtained from the calculation feature, that is, the calculation feature of the user code is used to indicate that the user code belongs to the first task queue or the second The task queue further indicates that the user code is computed by the first computing node or the second computing node on servers of different configurations.

進一步的,第一計算節點設置於CPU伺服器上,第二計算節點設置於GPU伺服器上;第一任務佇列包括依賴CPU代碼運行環境資源的運行任務,第二任務佇列包括依賴GPU代碼運行環境資源的運行任務;從而CPU伺服器上的第一計算節點監控第一任務佇列,獲得運行任務,而GPU伺服器上的第二計算節點監控第二任務佇列,獲得運行任務。Further, the first computing node is set on the CPU server, and the second computing node is set on the GPU server; the first task queue includes running tasks that depend on CPU code execution environment resources, and the second task queue includes tasks that depend on GPU code Execute the running tasks of the environment resources; thus, the first computing node on the CPU server monitors the first task queue to obtain running tasks, and the second computing node on the GPU server monitors the second task queue to obtain running tasks.

步驟S103:計算節點計算運行任務,得到計算結果。Step S103: The computing node computes and runs the task, and obtains the computing result.

計算節點利用所處伺服器上可利用的計算和記憶體資源,計算所獲得的運行任務,即可得到計算結果。計算節點在完成運行任務的計算後,釋放對應的計算資源並繼續監控任務佇列,也即,計算節點完成當前的運行任務的計算後即釋放資源,繼續監控任務佇列,以獲取新的運行任務,使得計算節點最大限度地複用計算和記憶體資源。其中,本發明不論計算節點可獲取任務佇列中任意運行任務,還是第一計算節點和第二計算節點分別獲取第一任務佇列和第二任務佇列的運行任務,同一計算節點均可在執行完畢運行任務時即釋放資源,不斷獲取新的運行任務,只要計算節點的計算和記憶體資源符合使用者代碼的運行環境資源即可。因此,使用者代碼可以在不同計算節點中執行,使得計算節點的計算和記憶體資源重複利用,充分並合理地利用伺服器的硬體資源。Computing nodes use the computing and memory resources available on the server where they are located to calculate the obtained running tasks to obtain the calculation results. After the computing node completes the calculation of the running task, it releases the corresponding computing resources and continues to monitor the task queue, that is, after the computing node completes the calculation of the current running task, it releases resources and continues to monitor the task queue to obtain new running Tasks enable computing nodes to maximize the reuse of computing and memory resources. Wherein, in the present invention, regardless of whether the computing node can obtain any running task in the task queue, or the first computing node and the second computing node respectively obtain the running tasks in the first task queue and the second task queue, the same computing node can be When the execution of the running task is completed, the resources are released, and new running tasks are continuously obtained, as long as the computing and memory resources of the computing node conform to the running environment resources of the user code. Therefore, the user code can be executed in different computing nodes, so that the computing and memory resources of the computing nodes can be reused, and the hardware resources of the server can be fully and reasonably utilized.

呈前所述,服務節點根據使用者代碼的計算特徵將使用者代碼作為運行任務放置到第一任務佇列或第二任務佇列;第一計算節點和第二計算節點分別從第一任務佇列和第二任務佇列獲取運行任務;不同配置的伺服器上的第一計算節點和第二計算節點分別利用各自的計算和記憶體資源計算運行任務,得到計算結果。因此,任務佇列根據使用者代碼的實際需求將運行任務分發到計算節點運行,且計算節點歸屬於不同配置的伺服器,實現資源的合理利用。例如,第一任務佇列為CPU任務佇列,第二任務佇列為GPU任務佇列,第一計算節點和第二計算節點分別位於CPU伺服器和GPU伺服器上,第一計算節點從第一任務佇列獲取運行任務並計算,而第二計算節點從第二任務佇列獲取運行任務並計算。具體地,一使用者代碼的計算特徵指示對應的使用者代碼歸屬於第一任務佇列,第一計算節點從第一任務佇列獲取運行任務,利用CPU伺服器上的計算和記憶體資源計算運行任務,得到計算結果。CPU伺服器上的計算節點可以執行不依賴GPU伺服器資源的常規代碼,GPU伺服器上的計算節點可以執行包括但不限於神經網路模型訓練、影像處理等使用GPU伺服器資源的代碼。As mentioned above, the service node places the user code as a running task in the first task queue or the second task queue according to the calculation characteristics of the user code; the first computing node and the second computing node respectively start from the first task queue The first computing node and the second computing node on the servers with different configurations use their respective computing and memory resources to compute the running tasks and obtain computing results. Therefore, the task queue distributes the execution tasks to the computing nodes according to the actual needs of the user code, and the computing nodes belong to servers with different configurations, so as to realize the rational utilization of resources. For example, the first task queue is a CPU task queue, and the second task queue is a GPU task queue. The first computing node and the second computing node are respectively located on the CPU server and the GPU server. A task queue acquires and calculates running tasks, and a second computing node acquires and calculates running tasks from the second task queue. Specifically, the calculation feature of a user code indicates that the corresponding user code belongs to the first task queue, and the first computing node obtains the execution task from the first task queue, and uses the calculation and memory resources on the CPU server to calculate Run the task and get the calculation result. The computing nodes on the CPU server can execute regular codes that do not rely on GPU server resources, and the computing nodes on the GPU server can execute codes that use GPU server resources, including but not limited to neural network model training and image processing.

步驟S104:服務節點從計算節點獲取計算結果,並將計算結果回饋至使用者終端。Step S104: the service node obtains the calculation result from the calculation node, and feeds back the calculation result to the user terminal.

計算節點計算運行任務得到計算結果後,服務節點即可從計算節點獲取計算結果,並將計算結果回饋至使用者終端。服務節點從計算節點獲取計算結果的方式包括但不限於獲取請求、訂閱等,在此不做具體限定。服務節點從計算節點獲取計算結果的方式為獲取請求時,服務節點監控計算節點,向計算節點發送獲取計算結果的獲取請求,對應的計算節點根據獲取請求回饋計算結果至服務節點。服務節點從計算節點獲取計算結果的方式為訂閱時,計算節點計算運行任務得到計算結果後,直接將計算結果回饋回服務節點。After the computing node calculates and runs the task to obtain the calculation result, the service node can obtain the calculation result from the computing node and feed back the calculation result to the user terminal. Ways for service nodes to obtain calculation results from computing nodes include but are not limited to obtaining requests, subscriptions, etc., which are not specifically limited here. The service node obtains the calculation result from the computing node by obtaining a request. The service node monitors the computing node and sends an acquisition request to the computing node to obtain the calculation result, and the corresponding computing node returns the calculation result to the service node according to the acquisition request. When the service node obtains the calculation result from the calculation node by subscription, after the calculation node calculates and runs the task and obtains the calculation result, it directly feeds the calculation result back to the service node.

在本發明實施例中,程式設計平台還包括訊息佇列,並且訊息佇列用於暫存計算節點計算運行任務得到的計算結果。訊息佇列可以為Redis清單等儲存系統、RabbitMQ等面向消息的中介軟體。面向消息的服務節點從計算節點獲取計算結果,以將計算結果回饋至使用者終端時,計算節點將計算結果放置於訊息佇列;服務節點監控訊息佇列,以獲取計算結果,並將計算結果回饋至使用者終端。服務節點從計算節點獲取計算結果,以將計算結果回饋至使用者終端時,服務節點從訊息佇列中訂閱到計算節點的計算結果,並通過websocket等通信技術將計算結果回饋至使用者終端。In the embodiment of the present invention, the programming platform further includes a message queue, and the message queue is used for temporarily storing the calculation results obtained by the computing nodes running tasks. The message queue can be a storage system such as a Redis list, or a message-oriented intermediary software such as RabbitMQ. When the message-oriented service node obtains the calculation result from the calculation node to feed back the calculation result to the user terminal, the calculation node places the calculation result in the message queue; the service node monitors the message queue to obtain the calculation result, and the calculation result Feedback to the user terminal. When the service node obtains the calculation result from the computing node to feed back the calculation result to the user terminal, the service node subscribes to the calculation result of the computing node from the message queue, and feeds back the calculation result to the user terminal through communication technologies such as websocket.

本發明實施例中,服務節點獲取用於表徵使用者終端的使用者代碼後,即建立與使用者終端的會話連接;服務節點在獲取計算結果之前,保持與使用者終端的會話連接;服務節點獲取到計算節點的計算結果後,即斷開與相應使用者終端的會話連接。從而,服務節點在獲取所述計算結果之前,一直保持服務節點與使用者終端的聯繫,方便將計算結果回饋回使用者終端。使用者代碼的運行過程中,服務節點與計算節點分離設置,使用者終端的連接與使用者代碼的計算分別由服務節點和計算節點完成。其中,服務節點在與使用者終端維持會話的長連接的同時,計算節點完成運行任務的計算,釋放對應的計算資源並繼續監控任務佇列,使得計算節點不斷重複利用計算資源,使用者代碼的運行過程中不需要一直佔用計算節點,實現使用者代碼運行的非同步通信,提高系統的併發能力。計算節點獲取到運行任務並計算得到計算結果後,釋放對應的計算資源,並繼續獲取新的運行任務,使得計算節點的計算資源不被一直佔用,實現同一計算節點的計算資源得到重複利用,進而提高資源利用率。In the embodiment of the present invention, after the service node obtains the user code used to characterize the user terminal, it establishes a session connection with the user terminal; the service node maintains the session connection with the user terminal before obtaining the calculation result; the service node After obtaining the calculation result of the computing node, the session connection with the corresponding user terminal is disconnected. Therefore, before the service node obtains the calculation result, it keeps in touch with the user terminal, so as to conveniently feed back the calculation result to the user terminal. During the operation of the user code, the service node and the computing node are set separately, and the connection of the user terminal and the calculation of the user code are respectively completed by the service node and the computing node. Among them, while the service node maintains a long-term connection with the user terminal, the computing node completes the calculation of the running task, releases the corresponding computing resources and continues to monitor the task queue, so that the computing node continues to reuse computing resources, and the user code It does not need to occupy computing nodes all the time during the running process, realizes asynchronous communication of user code running, and improves the concurrency capability of the system. After the computing node obtains the running tasks and calculates the calculation results, it releases the corresponding computing resources and continues to obtain new running tasks, so that the computing resources of the computing nodes are not occupied all the time, and the computing resources of the same computing node are reused, and then Improve resource utilization.

通過上述方式,程式設計平台包括服務節點、任務佇列以及計算節點,從而服務節點和計算節點分離設置,服務節點獲取用於表徵使用者終端的使用者代碼,並將使用者代碼作為運行任務放置於任務佇列中;計算節點監控任務佇列,以獲取運行任務;計算節點計算運行任務,得到計算結果;服務節點從計算節點獲取計算結果,以將計算結果回饋至使用者終端,從而服務節點實現與使用者終端的連接,而計算節點實現使用者代碼的計算,進而實現使用者代碼的運行。另外,使用者代碼的運行過程中,服務節點與計算節點分離設置,使得使用者終端的連接與使用者代碼的計算分別由服務節點和計算節點完成,實現使用者代碼運行的非同步通信,提高系統的併發能力。Through the above method, the programming platform includes service nodes, task queues and computing nodes, so that the service nodes and computing nodes are set separately, and the service nodes obtain the user code used to represent the user terminal, and place the user code as a running task In the task queue; the computing node monitors the task queue to obtain the running task; the computing node calculates the running task and obtains the calculation result; the service node obtains the calculation result from the computing node to feed back the calculation result to the user terminal, so as to serve the node The connection with the user terminal is realized, and the calculation node realizes the calculation of the user code, and then realizes the operation of the user code. In addition, during the operation of the user code, the service node and the computing node are set separately, so that the connection of the user terminal and the calculation of the user code are completed by the service node and the computing node respectively, realizing the asynchronous communication of the user code running and improving The concurrent capability of the system.

本發明還提供一種服務節點,同樣能夠執行程式設計平台的使用者代碼運行方法。請參閱圖2,圖2是本發明實施例提供的程式設計平台的使用者代碼運行方法另一實現流程示意圖。具體而言,本發明實施例方法包括以下步驟。The invention also provides a service node, which can also execute the user code running method of the programming platform. Please refer to FIG. 2 . FIG. 2 is a schematic flowchart of another realization of the user code running method of the programming platform provided by the embodiment of the present invention. Specifically, the method in the embodiment of the present invention includes the following steps.

步驟S201:獲取用於表徵使用者終端的使用者代碼。Step S201: Obtain a user code used to represent a user terminal.

本發明實施例執行程式設計平台的使用者代碼運行方法為上述程式設計平台的使用者代碼運行方法任一實施例中的服務節點。程式設計平台包括服務節點、任務佇列以及計算節點。The embodiment of the present invention executes the user code running method of the programming platform as the service node in any embodiment of the above-mentioned user code running method of the programming platform. The programming platform includes service nodes, task queues and computing nodes.

服務節點可接收多個使用者終端中任意一個使用者終端的使用者代碼,並且可同時接收多個使用者終端的使用者代碼,支援多使用者終端的併發連接。服務節點接收使用者代碼的方式包括但不限於websocket通信技術、HTTP通信技術,在此不作具體限定。服務節點接收的使用者代碼的來源可多樣化。例如,使用者終端自帶的代碼編輯視窗獲取到使用者編輯的代碼,形成使用者代碼,亦或者使用者終端接收到與其連接的代碼編輯設備傳輸的使用者代碼等。The service node can receive the user code of any one of the multiple user terminals, and can simultaneously receive the user codes of multiple user terminals to support concurrent connections of multiple user terminals. The way the service node receives the user code includes but not limited to websocket communication technology and HTTP communication technology, which are not specifically limited here. The source of the user code received by the service node can be diversified. For example, the code editing window of the user terminal obtains the code edited by the user to form a user code, or the user terminal receives the user code transmitted by the code editing device connected to it.

在本發明實施例中,服務節點通過反向代理被分配使用者代碼,使得使用者終端與服務節點不必建立一一對應的關聯關係,由反向代理伺服器進行使用者終端的使用者代碼的分配。In the embodiment of the present invention, the service node is assigned the user code through the reverse proxy, so that the user terminal and the service node do not need to establish a one-to-one correspondence relationship, and the reverse proxy server performs the user code of the user terminal. distribute.

步驟S202:將使用者代碼作為運行任務放置於任務佇列中,以由計算節點從任務佇列中獲取並計算運行任務。Step S202: Put the user code as a running task in the task queue, so that the computing node can obtain and calculate the running task from the task queue.

服務節點將使用者代碼作為運行任務放置於任務佇列中,使得任務佇列中的運行任務被統一分配,可通過排隊機制提升系統的併發回應能力。服務節點獲取到使用者終端的使用者代碼,並保持與使用者終端的會話連接,實現與使用者終端的連接即可,而對於使用者代碼,則將使用者代碼作為運行任務放置於任務佇列後,以由計算節點從任務佇列獲取並計算運行任務,使得使用者終端的連接與使用者代碼的計算分別由服務節點和計算節點完成,實現使用者代碼運行的非同步通信,提高系統的併發能力。The service node places the user code as a running task in the task queue, so that the running tasks in the task queue are uniformly allocated, and the concurrent response capability of the system can be improved through the queuing mechanism. The service node obtains the user code of the user terminal, and maintains the session connection with the user terminal to realize the connection with the user terminal. For the user code, the user code is placed in the task queue as a running task. After the queue, the calculation node obtains and calculates the running task from the task queue, so that the connection of the user terminal and the calculation of the user code are completed by the service node and the calculation node respectively, so as to realize the asynchronous communication of the user code operation and improve the system concurrent capabilities.

在本發明實施例中,任務佇列包括第一任務佇列和第二任務佇列,計算節點包括第一計算節點和第二計算節點。服務節點將使用者代碼作為運行任務放置於任務佇列中,以由計算節點從任務佇列中獲取並計算運行任務時,根據使用者代碼的計算特徵,將使用者代碼作為運行任務放置於第一任務佇列或第二任務佇列中,以由第一計算節點從第一任務佇列中獲取並計算運行任務,或由第二計算節點從第二任務佇列中獲取並計算運行任務。In the embodiment of the present invention, the task queue includes a first task queue and a second task queue, and the computing nodes include the first computing node and the second computing node. The service node puts the user code as a running task in the task queue, so that when the computing node obtains and calculates the running task from the task queue, according to the calculation characteristics of the user code, the user code is placed as the running task in the first In the first task queue or the second task queue, the first computing node acquires and calculates the running tasks from the first task queue, or the second computing node acquires and calculates the running tasks from the second task queue.

其餘有關步驟S201和S202的描述可參閱上述步驟S101至步驟S103,在此不再贅述。For other descriptions of steps S201 and S202, reference may be made to the above steps S101 to S103, which will not be repeated here.

步驟S203:獲取計算節點的計算結果,並將計算結果回饋至使用者終端。Step S203: Obtain the calculation result of the calculation node, and feed back the calculation result to the user terminal.

計算節點得到計算結果後,服務節點即可從計算節點獲取計算結果,並將計算結果回饋至使用者終端。在本發明實施例中,程式設計平台還包括訊息佇列,並且訊息佇列用於暫存計算節點計算運行任務得到的計算結果。服務節點從計算節點獲取計算結果,以將計算結果回饋至使用者終端時,服務節點監控訊息佇列,以獲取計算結果,並將計算結果回饋至使用者終端。其中,服務節點獲取的計算結果是計算節點將計算結果放置於訊息佇列的。After the calculation node obtains the calculation result, the service node can obtain the calculation result from the calculation node, and feed back the calculation result to the user terminal. In the embodiment of the present invention, the programming platform further includes a message queue, and the message queue is used for temporarily storing the calculation results obtained by the computing nodes running tasks. When the service node obtains the calculation result from the calculation node to feed back the calculation result to the user terminal, the service node monitors the message queue to obtain the calculation result and feeds back the calculation result to the user terminal. Wherein, the calculation result obtained by the service node is the calculation result that the calculation node puts in the message queue.

本發明實施例中,服務節點獲取用於表徵使用者終端的使用者代碼後,即建立與使用者終端的會話連接;服務節點在獲取計算結果之前,保持與使用者終端的會話連接;服務節點獲取到計算節點的計算結果後,即斷開與相應使用者終端的會話連接。從而,服務節點在獲取所述計算結果之前,一直保持服務節點與使用者終端的聯繫,方便將計算結果回饋回使用者終端。In the embodiment of the present invention, after the service node obtains the user code used to characterize the user terminal, it establishes a session connection with the user terminal; the service node maintains the session connection with the user terminal before obtaining the calculation result; the service node After obtaining the calculation result of the computing node, the session connection with the corresponding user terminal is disconnected. Therefore, before the service node obtains the calculation result, it keeps in touch with the user terminal, so as to conveniently feed back the calculation result to the user terminal.

通過上述方式,服務節點獲取用於表徵使用者終端的使用者代碼;將使用者代碼作為運行任務放置於任務佇列中,以由計算節點從任務佇列中獲取並計算運行任務;獲取計算節點的計算結果,並將計算結果回饋至使用者終端,實現使用者代碼的運行。服務節點用於與使用者終端連接,並將使用者終端發出的使用者代碼作為運行任務放置於任務佇列中,使得獨立於服務節點的計算節點從任務佇列中獲取並計算運行任務得到計算結果後,服務節點獲取計算節點的計算結果,並將計算結果回饋至使用者終端,實現使用者代碼的運行。Through the above method, the service node obtains the user code used to represent the user terminal; puts the user code as a running task in the task queue, so that the computing node can obtain and calculate the running task from the task queue; obtain the computing node The calculation result is fed back to the user terminal to realize the operation of the user code. The service node is used to connect to the user terminal, and place the user code sent by the user terminal as a running task in the task queue, so that the computing node independent of the service node obtains and calculates the running task from the task queue to get the calculation After the result, the service node obtains the calculation result of the computing node, and feeds back the calculation result to the user terminal to realize the operation of the user code.

本發明還提供一種計算節點,同樣能夠執行程式設計平台的使用者代碼運行方法。請參閱圖3,圖3是本發明實施例提供的程式設計平台的使用者代碼運行方法再一實現流程示意圖。具體而言,本發明實施例方法包括以下步驟。The invention also provides a computing node, which can also execute the user code running method of the programming platform. Please refer to FIG. 3 . FIG. 3 is a schematic flowchart of another realization of the user code running method of the programming platform provided by the embodiment of the present invention. Specifically, the method in the embodiment of the present invention includes the following steps.

步驟S301:監控任務佇列,以獲取運行任務。Step S301 : Monitor the task queue to obtain running tasks.

本發明實施例執行程式設計平台的使用者代碼運行方法為上述程式設計平台的使用者代碼運行方法任一實施例中的計算節點。任務佇列中包括運行任務,並且運行任務對應使用者代碼。The embodiment of the present invention executes the user code running method of the programming platform as the computing node in any embodiment of the above-mentioned user code running method of the programming platform. The task queue includes running tasks, and the running tasks correspond to user codes.

計算節點監控包括運行任務的任務佇列,從任務佇列中獲取與使用者代碼一一對應的運行任務。Computing node monitoring includes the task queue of running tasks, and obtains the running tasks corresponding to the user code one-to-one from the task queue.

計算節點包括第一計算節點和第二計算節點,並且第一計算節點和第二計算節點分別位於CPU伺服器和GPU伺服器上,從而第一計算節點監控任務佇列中的依賴CPU伺服器中的計算和記憶體資源的運行任務,而第二計算節點監控任務佇列中的依賴GPU伺服器中的計算和記憶體資源的運行任務。具體地,任務佇列可包括第一任務佇列和第二任務佇列,第一計算節點和第二計算節點分別監控第一任務佇列和第二任務佇列,以獲取運行任務。The computing nodes include a first computing node and a second computing node, and the first computing node and the second computing node are located on the CPU server and the GPU server respectively, so that the first computing node monitors the dependent CPU servers in the task queue The computing and memory resources of the second computing node monitor the running tasks in the task queue that depend on the computing and memory resources of the GPU server. Specifically, the task queue may include a first task queue and a second task queue, and the first computing node and the second computing node respectively monitor the first task queue and the second task queue to obtain running tasks.

也即,使用者代碼與任務佇列相對應,本發明實施例的計算節點為第一計算節點時,從第一任務佇列中獲取CPU伺服器中的計算和記憶體資源的運行任務;計算節點為第二計算節點時,從第二任務佇列中獲取GPU伺服器中的計算和記憶體資源的運行任務。That is to say, the user code corresponds to the task queue, and when the computing node in the embodiment of the present invention is the first computing node, the running tasks of computing and memory resources in the CPU server are obtained from the first task queue; computing When the node is the second computing node, the running tasks of computing and memory resources in the GPU server are obtained from the second task queue.

步驟S302:計算運行任務,得到計算結果。Step S302: Calculate and run the task, and obtain the calculation result.

計算節點利用所歸屬的伺服器上的計算和記憶體資源計算運行任務,得到計算結果。計算節點在完成運行任務的計算後,釋放對應的計算資源並繼續監控任務佇列,也即,計算節點完成當前的運行任務的計算後即釋放資源,繼續監控任務佇列,以獲取新的運行任務,使得計算節點最大限度地複用計算和記憶體資源。Computing nodes use the computing and memory resources on the servers they belong to to compute and run tasks and obtain computing results. After the computing node completes the calculation of the running task, it releases the corresponding computing resources and continues to monitor the task queue, that is, after the computing node completes the calculation of the current running task, it releases resources and continues to monitor the task queue to obtain new running Tasks enable computing nodes to maximize the reuse of computing and memory resources.

通過上述方式,監控任務佇列,以獲取運行任務;任務佇列中包括運行任務,運行任務對應使用者代碼;計算運行任務,得到計算結果,實現有序進行計算節點運行任務的獲取。任務佇列中包括運行任務,而運行任務對應使用者代碼,於是計算節點監控包括運行任務的任務佇列,從而獲取到對應使用者代碼的運行任務,進而計算運行任務得到計算結果,實現運行任務的獲取與計算。Through the above method, the task queue is monitored to obtain running tasks; the task queue includes running tasks, and the running tasks correspond to user codes; the running tasks are calculated to obtain calculation results, and the orderly acquisition of computing node running tasks is realized. The task queue includes the running task, and the running task corresponds to the user code, so the computing node monitors the task queue including the running task, thereby obtaining the running task corresponding to the user code, and then calculates the running task to obtain the calculation result, and realizes the running task acquisition and calculation.

本發明還提供一種程式設計平台,如圖4所示,圖4是本發明實施例提供的程式設計平台的結構示意圖。具體而言,本發明實施例中程式設計平台40包括服務節點41、任務佇列42、計算節點43。服務節點41用於獲取用於表徵使用者終端的使用者代碼,並將使用者代碼作為運行任務放置於任務佇列42中;計算節點43用於監控任務佇列42,以獲取運行任務;計算節點43還用於計算運行任務,得到計算結果;服務節點41還用於從計算節點43獲取計算結果,以將計算結果回饋至使用者終端。The present invention also provides a programming platform, as shown in FIG. 4 , which is a schematic structural diagram of the programming platform provided by an embodiment of the present invention. Specifically, the programming platform 40 in the embodiment of the present invention includes a service node 41 , a task queue 42 , and a computing node 43 . The service node 41 is used to obtain the user code used to characterize the user terminal, and place the user code as a running task in the task queue 42; the computing node 43 is used to monitor the task queue 42 to obtain the running task; The node 43 is also used to calculate and run the task to obtain the calculation result; the service node 41 is also used to obtain the calculation result from the calculation node 43 to feed back the calculation result to the user terminal.

在本發明實施例中,計算節點43的數量為至少兩個;計算節點43用於監控任務佇列42,以獲取運行任務時,至少兩個計算節點43用於監控任務佇列42,向任務佇列42請求獲取運行任務;任務佇列42用於將一個運行任務分配至一個計算節點43。In the embodiment of the present invention, the number of computing nodes 43 is at least two; the computing nodes 43 are used to monitor the task queue 42, so that when running tasks, at least two computing nodes 43 are used to monitor the task queue 42, and send The queue 42 requests to obtain the running task; the task queue 42 is used to assign a running task to a computing node 43 .

在本發明實施例中,任務佇列42包括第一任務佇列和第二任務佇列,至少兩個計算節點43包括第一計算節點和第二計算節點;服務節點41用於將使用者代碼作為運行任務放置於任務佇列42中時,進一步用於根據使用者代碼的計算特徵,將使用者代碼作為運行任務放置於第一任務佇列或第二任務佇列中;計算節點43用於監控任務佇列42,具體地,第一計算節點監控第一任務佇列,第二計算節點監控第二任務佇列。In the embodiment of the present invention, the task queue 42 includes a first task queue and a second task queue, and at least two computing nodes 43 include the first computing node and the second computing node; the service node 41 is used to convert the user code When placed in the task queue 42 as a running task, it is further used to place the user code as a running task in the first task queue or the second task queue according to the calculation characteristics of the user code; the computing node 43 is used for The task queue 42 is monitored. Specifically, the first computing node monitors the first task queue, and the second computing node monitors the second task queue.

在本發明實施例中,服務節點41的數量為至少兩個;服務節點41用於獲取用於表徵使用者終端的使用者代碼時,至少兩個服務節點41通過反向代理被分配使用者代碼。In the embodiment of the present invention, the number of service nodes 41 is at least two; when the service node 41 is used to obtain the user code used to characterize the user terminal, at least two service nodes 41 are assigned the user code through the reverse proxy .

在本發明實施例中,計算節點43還用於在完成運行任務的計算後,釋放對應的計算資源並繼續監控任務佇列42。In the embodiment of the present invention, the computing node 43 is further configured to release corresponding computing resources and continue to monitor the task queue 42 after completing the computing of the running task.

在本發明實施例中,程式設計平台40還包括訊息佇列44;服務節點41用於從計算節點43獲取計算結果,以將計算結果回饋至使用者終端時,計算節點43還用於將計算結果放置於訊息佇列44;服務節點41還用於監控訊息佇列42,以獲取計算結果,並將計算結果回饋至使用者終端。In the embodiment of the present invention, the programming platform 40 also includes a message queue 44; the service node 41 is used to obtain the calculation result from the calculation node 43, and when the calculation result is fed back to the user terminal, the calculation node 43 is also used to send the calculation result to the user terminal. The result is placed in the message queue 44; the service node 41 is also used to monitor the message queue 42 to obtain the calculation result, and feed back the calculation result to the user terminal.

在本發明實施例中,服務節點41還用於在獲取計算結果之前,保持與使用者終端的會話連接。In the embodiment of the present invention, the service node 41 is also used to maintain the session connection with the user terminal before obtaining the calculation result.

圖4中的程式設計平台40中的服務節點41還用於執行程式設計平台的使用者代碼運行方法。具體地,如圖5所示,圖5是本發明程式設計平台服務節點41一實施例的結構示意圖。服務節點41包括接收單元411、放置單元412和獲取單元413。其中,接收單元411用於獲取用於表徵使用者終端的使用者代碼;放置單元412用於將使用者代碼作為運行任務放置於任務佇列中,以由計算節點從任務佇列中獲取並計算運行任務;獲取單元413用於獲取計算節點的計算結果,並將計算結果回饋至使用者終端。The service node 41 in the programming platform 40 in FIG. 4 is also used to execute the user code running method of the programming platform. Specifically, as shown in FIG. 5 , FIG. 5 is a schematic structural diagram of an embodiment of the programming platform service node 41 of the present invention. The service node 41 includes a receiving unit 411 , a placement unit 412 and an acquisition unit 413 . Wherein, the receiving unit 411 is used to obtain the user code used to characterize the user terminal; the placement unit 412 is used to place the user code as a running task in the task queue, so that the computing node can obtain and calculate the user code from the task queue. Run the task; the obtaining unit 413 is used to obtain the calculation result of the computing node, and feed back the calculation result to the user terminal.

在本發明實施例中,放置單元412用於將使用者代碼作為運行任務放置於任務佇列中,以由計算節點從任務佇列中獲取並計算運行任務時,還用於根據使用者代碼的計算特徵,將使用者代碼作為運行任務放置於第一任務佇列或第二任務佇列中,以由第一計算節點從第一任務佇列中獲取並計算運行任務,或由第二計算節點從第二任務佇列中獲取並計算運行任務。In the embodiment of the present invention, the placing unit 412 is used to place the user code as a running task in the task queue, so that when the computing node obtains and calculates the running task from the task queue, it is also used to Computing features, placing the user code as a running task in the first task queue or the second task queue, so that the first computing node can obtain and calculate the running task from the first task queue, or the second computing node Obtain and calculate running tasks from the second task queue.

在本發明實施例中,接收單元411用於獲取用於表徵使用者終端的使用者代碼時,通過反向代理被分配使用者代碼。In the embodiment of the present invention, when the receiving unit 411 is used to obtain the user code used to characterize the user terminal, the user code is assigned through a reverse proxy.

在本發明實施例中,獲取單元413用於在獲取計算結果之前,服務節點41保持與使用者終端的會話連接。In the embodiment of the present invention, the acquiring unit 413 is configured to keep the service node 41 maintaining a session connection with the user terminal before acquiring the calculation result.

圖4中的程式設計平台40的計算節點43還用於執行程式設計平台的使用者代碼運行方法。具體地,如圖6所示,圖6是本發明程式設計平台計算節點43一實施例的結構示意圖。計算節點43包括監控單元431和計算單元432,監控單元431用於監控任務佇列,以獲取運行任務,其中,任務佇列中包括運行任務,運行任務對應使用者代碼;計算單元432用於計算運行任務,得到計算結果。The computing node 43 of the programming platform 40 in FIG. 4 is also used to execute the user code running method of the programming platform. Specifically, as shown in FIG. 6 , FIG. 6 is a schematic structural diagram of an embodiment of the computing node 43 of the programming platform of the present invention. The computing node 43 includes a monitoring unit 431 and a computing unit 432. The monitoring unit 431 is used to monitor the task queue to obtain running tasks, wherein the task queue includes running tasks, and the running tasks correspond to user codes; the computing unit 432 is used for computing Run the task and get the calculation result.

在本發明實施例中,計算單元432用於完成運行任務的計算後,計算節點43釋放對應的計算資源並繼續監控任務佇列。In the embodiment of the present invention, after the computing unit 432 completes the computing of the running task, the computing node 43 releases the corresponding computing resource and continues to monitor the task queue.

為進一步說明本發明的程式設計平台,請參閱圖7所示,圖7是本發明實施例提供的程式設計平台的另一結構示意圖。To further illustrate the programming platform of the present invention, please refer to FIG. 7 , which is another schematic structural diagram of the programming platform provided by the embodiment of the present invention.

本發明實施例中程式設計平台70包括服務節點71、任務佇列72、計算節點73和訊息佇列74,任務佇列72包括第一任務佇列721和第二任務佇列722,計算節點73包括第一計算節點731和第二計算節點732,第一計算節點731位於CPU伺服器701上,而第二計算節點732位於GPU伺服器702上。In the embodiment of the present invention, the programming platform 70 includes a service node 71, a task queue 72, a computing node 73, and a message queue 74. The task queue 72 includes a first task queue 721 and a second task queue 722. The computing node 73 It includes a first computing node 731 and a second computing node 732 , the first computing node 731 is located on the CPU server 701 , and the second computing node 732 is located on the GPU server 702 .

具體應用時,服務節點71可接收多個使用者終端中任意一個使用者終端的使用者代碼,並且可同時接收多個使用者終端的使用者代碼,實現獲取用於表徵使用者終端的使用者代碼;服務節點71與使用者終端進行websocket連接,即服務節點71通過websocket通信方式獲取使用者終端的使用者代碼。將使用者代碼作為運行任務放置於任務佇列72時,若根據使用者代碼的計算特徵,判定使用者代碼歸屬於第一任務佇列721並將利用CPU伺服器701的代碼運行資源,則將該使用者代碼作為運行任務放置於第一任務佇列721中,第一計算節點731監控第一任務佇列721獲取並計算運行任務,得到計算結果;或者,若根據使用者代碼的計算特徵,判定使用者代碼歸屬於第二任務佇列722並將利用GPU伺服器702的代碼運行資源,則將該使用者代碼作為運行任務放置於第二任務佇列722中,第二計算節點732監控第二任務佇列722獲取並計算運行任務,得到計算結果;第一計算節點731和第二計算節點732均將計算結果放置於訊息佇列74中,服務節點71監控訊息佇列74,以獲取計算結果,並將計算結果回饋至對應的使用者終端。本發明實施例中有關服務節點71、任務佇列72、計算節點73和訊息佇列74的描述,可參閱上述程式設計平台一實施例,在此不再贅述。In specific applications, the service node 71 can receive the user code of any one of the multiple user terminals, and can receive the user codes of multiple user terminals at the same time, so as to realize the acquisition of the user code used to characterize the user terminal. Code; the service node 71 performs a websocket connection with the user terminal, that is, the service node 71 acquires the user code of the user terminal through websocket communication. When the user code is placed in the task queue 72 as an execution task, if it is determined according to the calculation characteristics of the user code that the user code belongs to the first task queue 721 and will utilize the code execution resources of the CPU server 701, then the The user code is placed in the first task queue 721 as a running task, and the first computing node 731 monitors the first task queue 721 to obtain and calculate the running task to obtain the calculation result; or, if according to the calculation characteristics of the user code, If it is determined that the user code belongs to the second task queue 722 and uses the code running resources of the GPU server 702, then the user code is placed in the second task queue 722 as an execution task, and the second computing node 732 monitors the second task queue 722. The second task queue 722 obtains and calculates the running task to obtain the calculation result; both the first computing node 731 and the second computing node 732 place the calculation result in the message queue 74, and the service node 71 monitors the message queue 74 to obtain the calculation result. result, and feed back the calculation result to the corresponding user terminal. For the description of the service node 71 , the task queue 72 , the computing node 73 and the message queue 74 in the embodiment of the present invention, please refer to the above-mentioned embodiment of the programming platform, and will not repeat them here.

通過上述方式,服務節點將接收到的使用者代碼作為運行任務分別放置於不同任務佇列;然後不同伺服器上的計算節點分別監控不同任務佇列,獲取對應的運行任務,從而利用不同的計算和儲存資源計算運行任務,得到計算結果,並且計算節點均將計算結果統一放置於訊息佇列;最後,服務節點從訊息佇列獲取到計算節點的計算結果,並將計算結果回饋至使用者終端。整個使用者代碼的運行過程中,服務節點與計算節點分離設置,使得使用者終端的連接與使用者代碼的計算分別由服務節點和計算節點完成,計算節點的計算資源可不斷重複利用,並且不同的計算節點對應不同的訊息佇列、從而獲取依賴不同計算和儲存資源的使用者代碼進行計算,實現使用者代碼運行的非同步通信,提高系統的併發能力。Through the above method, the service node places the received user code as a running task in different task queues; then the computing nodes on different servers monitor different task queues to obtain the corresponding running tasks, so as to use different computing and storage resources to calculate and run tasks to obtain calculation results, and the calculation nodes place the calculation results in the message queue; finally, the service node obtains the calculation results of the calculation nodes from the message queue, and feeds back the calculation results to the user terminal . During the entire running process of the user code, the service node and the computing node are set separately, so that the connection of the user terminal and the calculation of the user code are completed by the service node and the computing node respectively, and the computing resources of the computing node can be continuously reused, and different The computing nodes correspond to different message queues, so as to obtain user codes that rely on different computing and storage resources for calculation, realize asynchronous communication of user code operation, and improve the concurrency capability of the system.

在本發明實施例中,程式設計平台可以為線上程式設計教育平台、人工智慧平台。例如,程式設計平台為線上程式設計教育平台,其面向學校或培訓機構等,使用者終端為訪問線上程式設計教育平台的學生終端,實現使用者代碼的運行。線上程式設計教育平台包括服務節點、任務佇列和計算節點,其中任務佇列為redis清單。學生通過學生終端的程式設計介面輸入使用者代碼,服務節點可接收學生終端的使用者代碼,並且可同時接收多個學生終端的使用者代碼,實現接收線上程式設計教育平台中學生髮出的使用者代碼;服務節點將使用者代碼作為運行任務放置於為任務佇列的redis清單中。計算節點監控redis列表,以獲取運行任務;並計算運行任務,得到計算結果。服務節點從計算節點獲取計算結果,以將計算結果回饋至學生終端。In the embodiment of the present invention, the programming platform may be an online programming education platform or an artificial intelligence platform. For example, the programming platform is an online programming education platform, which is oriented to schools or training institutions, etc., and the user terminal is a student terminal accessing the online programming education platform to realize the operation of user codes. The online programming education platform includes service nodes, task queues and computing nodes, where the task queue is a redis list. Students enter the user code through the programming interface of the student terminal, and the service node can receive the user code of the student terminal, and can receive the user codes of multiple student terminals at the same time, so as to receive the user code sent by the students in the online programming education platform Code; the service node places the user code as a running task in the redis list for the task queue. The calculation node monitors the redis list to obtain the running tasks; and calculates the running tasks to obtain the calculation results. The service node obtains the calculation results from the computing nodes to feed back the calculation results to the student terminals.

在本發明實施例中,程式設計平台為線上程式設計教育平台,使用者終端為訪問線上程式設計教育平台的學生終端。線上程式設計教育平台包括服務節點、任務佇列、計算節點和訊息佇列,其中,任務佇列為redis清單且包括第一任務佇列和第二任務佇列;計算節點包括第一計算節點和第二計算節點;訊息佇列為RabbitMQ。線上程式設計教育平台的服務節點根據使用者代碼的計算特徵,判定使用者代碼歸屬於第一任務佇列並將利用CPU伺服器的代碼運行資源,則將該使用者代碼作為運行任務放置於第一任務佇列中,第一計算節點監控第一任務佇列獲取並計算運行任務,得到計算結果;或者,服務節點根據使用者代碼的計算特徵,判定使用者代碼歸屬於第二任務佇列並將利用GPU伺服器的代碼運行資源,則將該使用者代碼作為運行任務放置於第二任務佇列中,第二計算節點監控第二任務佇列獲取並計算運行任務,得到計算結果;第一計算節點和第二計算節點均將計算結果放置於訊息佇列RabbitMQ中,服務節點監控RabbitMQ,以獲取計算結果,並將計算結果回饋至對應的學生終端。In the embodiment of the present invention, the programming platform is an online programming education platform, and the user terminal is a student terminal accessing the online programming education platform. The online programming education platform includes a service node, a task queue, a computing node and a message queue, wherein the task queue is a redis list and includes the first task queue and the second task queue; the computing node includes the first computing node and The second computing node; the message queue is RabbitMQ. The service node of the online programming education platform determines that the user code belongs to the first task queue according to the calculation characteristics of the user code and uses the code running resources of the CPU server, then puts the user code as the running task in the first task queue In a task queue, the first calculation node monitors the first task queue to obtain and calculate the running tasks, and obtains the calculation result; or, the service node determines that the user code belongs to the second task queue according to the calculation characteristics of the user code and To use the code of the GPU server to run resources, the user code is placed in the second task queue as a running task, and the second computing node monitors the second task queue to obtain and calculate the running task, and obtain the calculation result; the first Both the calculation node and the second calculation node place the calculation results in the message queue RabbitMQ, and the service node monitors the RabbitMQ to obtain the calculation results, and feeds back the calculation results to the corresponding student terminals.

通過上述方式,面向學校或培訓機構等,線上程式設計教育平台可滿足更多數量的學生在線上程式設計教育平台上同時進行線上程式設計學習,實現充分利用算力資源,節約成本。Through the above method, for schools or training institutions, etc., the online programming education platform can satisfy a larger number of students to simultaneously learn online programming on the online programming education platform, realize full use of computing power resources, and save costs.

請參閱圖8,圖8為本發明電子設備一實施例的框架示意圖。具體而言,本發明實施例中電子設備800包括相互耦接的記憶體810和處理器820。其中,記憶體810用於儲存的程式指令以及處理器820處理時所需儲存的資料。Please refer to FIG. 8 . FIG. 8 is a schematic frame diagram of an embodiment of the electronic device of the present invention. Specifically, the electronic device 800 in the embodiment of the present invention includes a memory 810 and a processor 820 coupled to each other. Wherein, the memory 810 is used for storing program instructions and data required to be stored by the processor 820 during processing.

處理器820控制記憶體810及其自身以實現上述程式設計平台的使用者代碼運行方法任一實施例的步驟。處理器820還可以稱為CPU(Central Processing Unit,中央處理單元)。處理器820可能是一種積體電路晶片,具有信號的處理能力。處理器820還可以是通用處理器、數位訊號處理器(Digital Signal Processor,DSP)、專用積體電路(Application Specific Integrated Circuit,ASIC)、現場可程式設計閘陣列(Field-Programmable Gate Array,FPGA)或者其他可程式設計邏輯器件、分立門或者電晶體邏輯器件、分立硬體元件。通用處理器可以是微處理器或者該處理器也可以是任何常規的處理器等。另外,處理器820可以由多個成電路晶片共同實現。The processor 820 controls the memory 810 and itself to implement the steps of any embodiment of the above-mentioned user code running method of the programming platform. The processor 820 may also be referred to as a CPU (Central Processing Unit, central processing unit). The processor 820 may be an integrated circuit chip with signal processing capability. The processor 820 can also be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field-programmable gate array (Field-Programmable Gate Array, FPGA) Or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. A general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like. In addition, the processor 820 may be jointly implemented by multiple circuit chips.

請參閱圖9,圖9是本發明儲存裝置一實施例的框架示意圖。本發明儲存裝置900儲存有能夠被處理器運行的程式指令901,程式指令901用於實現上述任一程式設計平台的使用者代碼運行方法的實施例中步驟。Please refer to FIG. 9 . FIG. 9 is a schematic frame diagram of an embodiment of the storage device of the present invention. The storage device 900 of the present invention stores program instructions 901 that can be executed by the processor, and the program instructions 901 are used to implement the steps in the embodiments of the user code running method of any programming platform described above.

該儲存裝置900具體可以為U盤、移動硬碟、唯讀記憶體(ROM,Read-Only Memory)、隨機存取記憶體(RAM,Random Access Memory)、磁碟或者光碟等可以儲存程式指令901的介質(包括易失性儲存介質或非易失性儲存介質),或者也可以為儲存有該程式指令901的伺服器,該伺服器可將儲存的程式指令901發送給其他設備運行,或者也可以自運行該儲存的程式指令901。The storage device 900 can specifically be a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, etc., which can store program instructions 901 media (including volatile storage media or non-volatile storage media), or a server that stores the program instructions 901, and the server can send the stored program instructions 901 to other devices for execution, or The stored program instructions 901 can be self-executed.

在本發明所提供的幾個實施例中,應該理解到,所揭露的方法和裝置,可以通過其它的方式實現。例如,以上所描述的裝置實施方式僅僅是示意性的,例如,模組或單元的劃分,僅僅為一種邏輯功能劃分,實際實現時可以有另外的劃分方式,例如多個單元或元件可以結合或者可以集成到另一個系統,或一些特徵可以忽略,或不執行。另一點,所顯示或討論的相互之間的耦合或直接耦合或通信連接可以是通過一些介面,裝置或單元的間接耦合或通信連接,可以是電性,機械或其它的形式。In the several embodiments provided by the present invention, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementations described above are only illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or elements can be combined or May be integrated into another system, or some features may be ignored, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.

作為分離部件說明的單元可以是或者也可以不是物理上分開的,作為單元顯示的部件可以是或者也可以不是物理單元,即可以位於一個地方,或者也可以分佈到多個網路單元上。可以根據實際的需要選擇其中的部分或者全部單元來實現本實施方式方案的目的。A unit described as a separate component may or may not be physically separated, and a component displayed as a unit may or may not be a physical unit, that is, it may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

另外,在本發明各個實施例中的各功能單元可以集成在一個處理單元中,也可以是各個單元單獨物理存在,也可以兩個或兩個以上單元集成在一個單元中。上述集成的單元既可以採用硬體的形式實現,也可以採用軟體功能單元的形式實現。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented not only in the form of hardware, but also in the form of software functional units.

集成的單元如果以軟體功能單元的形式實現並作為獨立的產品銷售或使用時,可以儲存在一個電腦可讀取儲存介質中。基於這樣的理解,本發明的技術方案本質上或者說對現有技術做出貢獻的部分或者該技術方案的全部或部分可以以軟體產品的形式體現出來,該電腦軟體產品儲存在一個儲存介質中,包括若干指令用以使得一台電腦設備(可以是個人電腦,伺服器,或者網路設備等)或處理器(processor)執行本發明各個實施方式方法的全部或部分步驟。而前述的儲存介質包括:U盤、移動硬碟、唯讀記憶體(ROM,Read-Only Memory)、隨機存取記憶體(RAM,Random Access Memory)、磁碟或者光碟等各種可以儲存程式碼的介質。If the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the essence of the technical solution of the present invention or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium. Several instructions are included to make a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) execute all or part of the steps of the methods in various embodiments of the present invention. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk, etc., which can store program codes. medium.

工業實用性 本發明公開了一種程式設計平台的使用者代碼運行方法、電子設備和電腦可讀儲存介質。其中,程式設計平台包括服務節點、任務佇列、計算節點;程式設計平台的使用者代碼運行方法包括:服務節點獲取用於表徵使用者終端的使用者代碼,並將使用者代碼作為運行任務放置於任務佇列中;計算節點監控任務佇列,以獲取運行任務;計算節點計算運行任務,得到計算結果;服務節點從計算節點獲取計算結果,以將計算結果回饋至使用者終端。Industrial Applicability The invention discloses a user code running method of a program design platform, electronic equipment and a computer-readable storage medium. Among them, the programming platform includes service nodes, task queues, and computing nodes; the user code running method of the programming platform includes: the service node obtains the user code used to represent the user terminal, and places the user code as a running task In the task queue; the computing node monitors the task queue to obtain the running task; the computing node calculates the running task and obtains the calculation result; the service node obtains the calculation result from the computing node to feed back the calculation result to the user terminal.

40:程式設計平台 41:服務節點 411:接收單元 412:放置單元 413:獲取單元 42:任務佇列 43:計算節點 431:監控單元 432:計算單元 44:訊息佇列 70:程式設計平台 701:CPU伺服器 702:GPU伺服器 71:服務節點 72:任務佇列 721:第一任務佇列 722:第二任務佇列 73:計算節點 731:第一計算節點 732:第二計算節點 74:訊息佇列 800:電子設備 810:記憶體 820:處理器 900:儲存裝置 901:程式指令 S101~S104,S201~S203,S301~S302:步驟40:Programming platform 41: service node 411: receiving unit 412: Place unit 413:Get unit 42: Task Queue 43:Compute node 431: Monitoring unit 432: Calculation unit 44: Message queue 70:Programming platform 701: CPU server 702:GPU server 71: service node 72: Task Queue 721: The first task queue 722: The second task queue 73:Compute node 731: The first computing node 732: The second computing node 74: Message queue 800: Electronic equipment 810: Memory 820: Processor 900: storage device 901: Program instruction S101~S104, S201~S203, S301~S302: steps

此處的附圖被併入說明書中並構成本說明書的一部分,這些附圖示出了符合本發明的實施例,並與說明書一起用於說明本發明實施例的技術方案。 圖1是本發明實施例提供的程式設計平台的使用者代碼運行方法一實現流程示意圖; 圖2是本發明實施例提供的程式設計平台的使用者代碼運行方法另一實現流程示意圖; 圖3是本發明實施例提供的程式設計平台的使用者代碼運行方法再一實現流程示意圖; 圖4是本發明實施例提供的程式設計平台的結構示意圖; 圖5是本發明實施例提供的程式設計平台服務節點41的結構示意圖; 圖6是本發明實施例提供的程式設計平台計算節點43的結構示意圖; 圖7是本發明實施例提供的程式設計平台的另一結構示意圖; 圖8是本發明實施例提供的電子設備的框架示意圖; 圖9是本發明實施例提供的儲存裝置的框架示意圖。The accompanying drawings here are incorporated into the specification and constitute a part of the specification. These drawings show embodiments consistent with the present invention, and are used together with the description to illustrate the technical solutions of the embodiments of the present invention. FIG. 1 is a schematic flow diagram of a user code running method of a programming platform provided by an embodiment of the present invention; FIG. 2 is a schematic diagram of another implementation flow of the user code running method of the programming platform provided by the embodiment of the present invention; FIG. 3 is a schematic flow diagram of another realization of the user code running method of the programming platform provided by the embodiment of the present invention; Fig. 4 is a schematic structural diagram of a programming platform provided by an embodiment of the present invention; FIG. 5 is a schematic structural diagram of a programming platform service node 41 provided by an embodiment of the present invention; FIG. 6 is a schematic structural diagram of a programming platform computing node 43 provided by an embodiment of the present invention; Fig. 7 is another structural schematic diagram of the programming platform provided by the embodiment of the present invention; Fig. 8 is a schematic frame diagram of an electronic device provided by an embodiment of the present invention; Fig. 9 is a schematic frame diagram of a storage device provided by an embodiment of the present invention.

S101~S104:步驟S101~S104: steps

Claims (12)

一種程式設計平台的使用者代碼運行方法,所述程式設計平台包括:服務節點、任務佇列、計算節點;所述方法包括:所述服務節點獲取用於表徵使用者終端的使用者代碼,並根據所述使用者代碼的計算特徵,將所述使用者代碼作為運行任務放置於第一任務佇列或第二任務佇列中;所述第一任務佇列和所述第二任務佇列中的運行任務被計算時依賴於不同的代碼資源;第一計算節點監控所述第一任務佇列,第二計算節點監控所述第二任務佇列,以獲取所述運行任務;所述第一計算節點和所述第二計算節點分別擁有不同的計算資源和儲存資源;所述第一計算節點或所述第二計算節點計算所述運行任務,得到計算結果;所述服務節點從從所述第一計算節點或所述第二計算節點獲取所述計算結果,並將所述計算結果回饋至所述使用者終端。 A user code running method of a programming platform, the programming platform includes: a service node, a task queue, and a computing node; the method includes: the service node obtains a user code used to characterize a user terminal, and According to the calculation characteristics of the user code, the user code is placed as a running task in the first task queue or the second task queue; in the first task queue and the second task queue The running tasks of are calculated depending on different code resources; the first computing node monitors the first task queue, and the second computing node monitors the second task queue to obtain the running tasks; the first The computing node and the second computing node respectively have different computing resources and storage resources; the first computing node or the second computing node calculates the running task and obtains a calculation result; the service node obtains a calculation result from the The first calculation node or the second calculation node obtains the calculation result, and feeds the calculation result back to the user terminal. 根據請求項1所述的方法,其中,所述服務節點的數量為至少兩個;所述服務節點獲取用於表徵使用者終端的使用者代碼,包括:至少兩個所述服務節點通過反向代理被分配所述使用者代碼。 According to the method described in claim 1, wherein, the number of the service nodes is at least two; the service node obtains the user code used to characterize the user terminal, including: at least two of the service nodes pass the reverse Agents are assigned the user code. 根據請求項1或2所述的方法,其中,所 述第一計算節點或所述第二計算節點在完成對所述運行任務的計算後,釋放對應的計算資源並繼續監控對應的任務佇列。 According to the method described in claim 1 or 2, wherein, the After the first computing node or the second computing node finishes computing the running task, it releases the corresponding computing resource and continues to monitor the corresponding task queue. 根據請求項1所述的方法,其中,所述程式設計平台還包括訊息佇列;所述服務節點從所述第一計算節點或所述第二計算節點獲取所述計算結果,並將所述計算結果回饋至所述使用者終端,包括:所述第一計算節點或所述第二計算節點將所述計算結果放置於所述訊息佇列;所述服務節點監控所述訊息佇列,以獲取所述計算結果,並將所述計算結果回饋至所述使用者終端。 The method according to claim 1, wherein the programming platform further includes a message queue; the service node obtains the calculation result from the first computing node or the second computing node, and sends the The calculation result is fed back to the user terminal, including: the first calculation node or the second calculation node places the calculation result in the message queue; the service node monitors the message queue to The calculation result is obtained, and the calculation result is fed back to the user terminal. 根據請求項4所述的方法,其中,所述服務節點在獲取所述計算結果之前,保持與所述使用者終端的會話連接。 The method according to claim 4, wherein the service node maintains a session connection with the user terminal before obtaining the calculation result. 一種程式設計平台的使用者代碼運行方法,所述方法包括:獲取用於表徵使用者終端的使用者代碼;根據所述使用者代碼的計算特徵,將所述使用者代碼作為運行任務放置於第一任務佇列或第二任務佇列中,以由第一計算節點從所述第一任務佇列中獲取並計算所述運行任務,或由第二計算節點從所述第二任務佇列中獲取並計算所述運行任務;所述第一任務佇列和所述第二任務佇列中的運行任務被計算時依賴於不同的代碼資源;所述第一計算節點和所述第二計算節點分別擁有不同的計算資源和 儲存資源;獲取所述第一計算節點或所述第二計算節點的計算結果,並將所述計算結果回饋至所述使用者終端。 A method for running a user code on a programming platform, the method comprising: obtaining a user code used to characterize a user terminal; according to the calculation characteristics of the user code, placing the user code as an execution task in the first A task queue or a second task queue, so that the first computing node obtains and calculates the running task from the first task queue, or the second computing node obtains and calculates the running task from the second task queue Acquire and calculate the running tasks; the running tasks in the first task queue and the second task queue are calculated depending on different code resources; the first computing node and the second computing node have different computing resources and storing resources; obtaining calculation results of the first computing node or the second computing node, and feeding back the computing results to the user terminal. 根據請求項6所述的方法,其中,所述獲取用於表徵使用者終端的使用者代碼,包括:通過反向代理被分配所述使用者代碼。 The method according to claim 6, wherein said acquiring a user code used to characterize the user terminal comprises: being assigned the user code through a reverse proxy. 根據請求項6所述的方法,其中,所述方法包括:在獲取所述計算結果之前,保持與所述使用者終端的會話連接。 The method according to claim 6, wherein the method includes: maintaining a session connection with the user terminal before obtaining the calculation result. 一種程式設計平台的使用者代碼運行方法,所述方法包括:監控對應的任務佇列,以獲取運行任務;所述對應的任務佇列中包括所述運行任務,所述運行任務對應所述使用者代碼;不同任務佇列與不同計算節點一一對應;不同任務佇列中的運行任務被計算時依賴於不同的代碼資源;不同計算節點分別擁有不同的計算資源和儲存資源;計算所述運行任務,得到計算結果。 A user code running method for a programming platform, the method comprising: monitoring a corresponding task queue to obtain a running task; the corresponding task queue includes the running task, and the running task corresponds to the use or codes; different task queues correspond to different computing nodes; the running tasks in different task queues depend on different code resources when being calculated; different computing nodes have different computing resources and storage resources; task to get the calculation result. 根據請求項9所述的方法,其中,所述方法包括:在完成對所述運行任務的計算後,釋放對應的計算資源並繼續監控所述對應的任務佇列。 The method according to claim 9, wherein the method includes: after the calculation of the running task is completed, releasing the corresponding computing resource and continuing to monitor the corresponding task queue. 一種電子設備,包括相互耦接的記憶體和處理器;所述處理器用於執行所述記憶體儲存的程式指令,以實現請求項1至5任一項所述的方法;和/或,以實現請求項 6至8任一項所述的方法;和/或,以實現請求項9或10所述的方法。 An electronic device, comprising a memory and a processor coupled to each other; the processor is used to execute the program instructions stored in the memory to implement the method described in any one of claims 1 to 5; and/or, with Implement the requested item The method described in any one of 6 to 8; and/or, to realize the method described in claim 9 or 10. 一種電腦可讀儲存介質,儲存有能夠被運行以實現如請求項1至5中任一項所述程式設計平台的使用者代碼運行方法的電腦程式;和/或,儲存有能夠被運行以實現如請求項6至8中任一項所述程式設計平台的使用者代碼運行方法的電腦程式;和/或,儲存有能夠被運行以實現如請求項9或10所述程式設計平台的使用者代碼運行方法的電腦程式。 A computer-readable storage medium, storing a computer program that can be executed to implement the user code execution method of the programming platform as described in any one of claims 1 to 5; and/or, storing a computer program that can be executed to implement The computer program of the user code running method of the programming platform as described in any one of claim items 6 to 8; and/or, storing the user that can be executed to realize the programming platform as described in claim item 9 or 10 A computer program whose code runs the method.
TW110102727A 2020-02-14 2021-01-25 User code operation method of programming platform, electronic equipment and computer-readable storage medium TWI786527B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010093681.6A CN111427551A (en) 2020-02-14 2020-02-14 User code operation method of programming platform, equipment and storage medium
CN202010093681.6 2020-02-14

Publications (2)

Publication Number Publication Date
TW202131171A TW202131171A (en) 2021-08-16
TWI786527B true TWI786527B (en) 2022-12-11

Family

ID=71547088

Family Applications (1)

Application Number Title Priority Date Filing Date
TW110102727A TWI786527B (en) 2020-02-14 2021-01-25 User code operation method of programming platform, electronic equipment and computer-readable storage medium

Country Status (6)

Country Link
JP (1) JP2022522609A (en)
KR (1) KR20210105378A (en)
CN (1) CN111427551A (en)
SG (1) SG11202108352TA (en)
TW (1) TWI786527B (en)
WO (1) WO2021159831A1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111427551A (en) * 2020-02-14 2020-07-17 深圳市商汤科技有限公司 User code operation method of programming platform, equipment and storage medium
CN113157420A (en) * 2021-04-27 2021-07-23 上海临视人工智能科技有限公司 Cross-platform distributed task scheduling system and scheduling method
CN113905083A (en) * 2021-10-15 2022-01-07 上海商汤临港智能科技有限公司 User code operation method and device, electronic equipment and storage medium
CN116560658B (en) * 2023-06-29 2024-02-06 睿思芯科(深圳)技术有限公司 Cloud technology-based chip integrated development system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW201822017A (en) * 2016-12-13 2018-06-16 大陸商騰訊科技(深圳)有限公司 Information processing method, system, and apparatus, server, and mobile terminal device
CN108228349A (en) * 2017-12-26 2018-06-29 北京市商汤科技开发有限公司 For handling the method for task, system and storage medium
CN109644191A (en) * 2016-09-07 2019-04-16 云端物联有限公司 System and method for configuring connected equipment connection
US20190278928A1 (en) * 2018-03-06 2019-09-12 Amazon Technologies, Inc. Pre-deployment security analyzer service for virtual computing resources
CN110516738A (en) * 2019-08-23 2019-11-29 佳都新太科技股份有限公司 It is a kind of distributed to compare clustering method, device, electronic equipment and storage medium

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7467387B2 (en) * 2002-05-31 2008-12-16 International Business Machines Corporation Method for off-loading user queries to a task manager
CN100547973C (en) * 2007-05-23 2009-10-07 华中科技大学 A kind of high performance computing system based on peer-to-peer network
JP2009258803A (en) * 2008-04-11 2009-11-05 Hitachi Ltd Interactive processing system and interactive processing method
US9778961B2 (en) * 2015-09-14 2017-10-03 Qualcomm Incorporated Efficient scheduling of multi-versioned tasks
CN106874109A (en) * 2016-12-29 2017-06-20 朗新科技股份有限公司 A kind of distributed job distribution processing method and system
CN106874067B (en) * 2017-01-24 2020-10-02 华南理工大学 Parallel computing method, device and system based on lightweight virtual machine
CN108182111B (en) * 2018-01-23 2022-07-15 百度在线网络技术(北京)有限公司 Task scheduling system, method and device
CN109246151B (en) * 2018-11-05 2021-03-30 国家电网有限公司 Intelligent video inspection analysis scheduling method for power transmission line
CN110032364B (en) * 2019-04-11 2023-08-15 上海商汤智能科技有限公司 Data processing method, device, electronic equipment and computer storage medium
CN110275778B (en) * 2019-06-14 2021-07-27 上海商汤智能科技有限公司 Online program running method and device, electronic equipment and computer storage medium
CN111427551A (en) * 2020-02-14 2020-07-17 深圳市商汤科技有限公司 User code operation method of programming platform, equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109644191A (en) * 2016-09-07 2019-04-16 云端物联有限公司 System and method for configuring connected equipment connection
TW201822017A (en) * 2016-12-13 2018-06-16 大陸商騰訊科技(深圳)有限公司 Information processing method, system, and apparatus, server, and mobile terminal device
CN108228349A (en) * 2017-12-26 2018-06-29 北京市商汤科技开发有限公司 For handling the method for task, system and storage medium
US20190278928A1 (en) * 2018-03-06 2019-09-12 Amazon Technologies, Inc. Pre-deployment security analyzer service for virtual computing resources
CN110516738A (en) * 2019-08-23 2019-11-29 佳都新太科技股份有限公司 It is a kind of distributed to compare clustering method, device, electronic equipment and storage medium

Also Published As

Publication number Publication date
WO2021159831A1 (en) 2021-08-19
TW202131171A (en) 2021-08-16
KR20210105378A (en) 2021-08-26
SG11202108352TA (en) 2021-09-29
CN111427551A (en) 2020-07-17
JP2022522609A (en) 2022-04-20

Similar Documents

Publication Publication Date Title
TWI786527B (en) User code operation method of programming platform, electronic equipment and computer-readable storage medium
US11762697B2 (en) Method and apparatus for scheduling resource for deep learning framework
CN109246229B (en) Method and device for distributing resource acquisition request
CN103971316B (en) Computer system and drawing processing method thereof
CN111290854A (en) Task management method, device and system, computer storage medium and electronic equipment
WO2021151312A1 (en) Method for determining inter-service dependency, and related apparatus
US9104488B2 (en) Support server for redirecting task results to a wake-up server
CN104077212A (en) Pressure test system and method
CN110458468A (en) A kind of task processing method, device, electronic equipment and storage medium
CN107247629A (en) Cloud computing system and cloud computing method and device for controlling server
CN111435354A (en) Data export method and device, storage medium and electronic equipment
CN108900627B (en) Network request method, terminal device and storage medium
CN115543615A (en) Resource allocation method and device, electronic equipment and storage medium
Bukhsh et al. A decentralized edge computing latency-aware task management method with high availability for IoT applications
CN110300188A (en) Data transmission system, method and apparatus
CN109428926B (en) Method and device for scheduling task nodes
CN112104679B (en) Method, apparatus, device and medium for processing hypertext transfer protocol request
CN114924851A (en) Training task scheduling method and device, electronic equipment and storage medium
CN108259605B (en) Data calling system and method based on multiple data centers
CN104809026B (en) A kind of method that CPU computing resources are borrowed using remote node
CN104052723B (en) information processing method, server and system
CN110290206B (en) Distributed computing system and method for internet bar environment
CN113965628A (en) Message scheduling method, server and storage medium
CN112448977A (en) System, method, apparatus and computer readable medium for assigning tasks
US8869171B2 (en) Low-latency communications