CN116594773A - Method and device for submitting computing tasks to Ray cluster - Google Patents
Method and device for submitting computing tasks to Ray cluster Download PDFInfo
- Publication number
- CN116594773A CN116594773A CN202310559086.0A CN202310559086A CN116594773A CN 116594773 A CN116594773 A CN 116594773A CN 202310559086 A CN202310559086 A CN 202310559086A CN 116594773 A CN116594773 A CN 116594773A
- Authority
- CN
- China
- Prior art keywords
- python
- target
- ray
- ray cluster
- cluster
- Prior art date
- Legal status (The legal status 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 status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 110
- 230000008569 process Effects 0.000 claims abstract description 48
- 238000004891 communication Methods 0.000 claims abstract description 37
- 238000003860 storage Methods 0.000 claims description 33
- 230000006870 function Effects 0.000 claims description 14
- 238000004590 computer program Methods 0.000 claims description 8
- 238000004364 calculation method Methods 0.000 claims description 6
- 238000009434 installation Methods 0.000 claims description 4
- 241000604301 Ninia Species 0.000 claims description 3
- 239000008186 active pharmaceutical agent Substances 0.000 description 26
- 238000012545 processing Methods 0.000 description 8
- 230000008901 benefit Effects 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 230000003287 optical effect Effects 0.000 description 3
- 238000013459 approach Methods 0.000 description 2
- 238000013500 data storage Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000010801 machine learning Methods 0.000 description 2
- 238000004519 manufacturing process Methods 0.000 description 2
- 230000008520 organization Effects 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 241000699670 Mus sp. Species 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000007405 data analysis Methods 0.000 description 1
- 230000001419 dependent effect Effects 0.000 description 1
- 238000009826 distribution Methods 0.000 description 1
- 230000014509 gene expression Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 230000008054 signal transmission Effects 0.000 description 1
- 229910052710 silicon Inorganic materials 0.000 description 1
- 239000010703 silicon Substances 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 230000007723 transport mechanism Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5061—Partitioning or combining of resources
- G06F9/5072—Grid computing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/547—Remote procedure calls [RPC]; Web services
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Mathematical Physics (AREA)
- Devices For Executing Special Programs (AREA)
Abstract
The present disclosure provides a method of submitting a computing task to a Ray cluster, comprising: embedding a Python interpreter in a target process, wherein the target process operates in a target language environment different from the Python language environment, and the target language environment is a Java language environment or a Kotlen language environment; calling a Python language API provided by a Ray framework in the target process by using the Python interpreter to establish communication connection with a Ray cluster; and submitting a target computing task to the Ray cluster via the communication connection in a manner of Python interpretation execution to perform the target computing task in a distributed manner with a plurality of nodes in the Ray cluster, the target computing task being written based on a Python language.
Description
Technical Field
The present disclosure relates to the field of computer technology, and in particular, to a method, an apparatus, a computing device, a computer readable storage medium, and a computer program product for submitting computing tasks to a Ray cluster.
Background
Ray is used as a powerful distributed computing framework and comprises functions of distributed remote call, distributed memory management and the like. A developer may utilize a Ray framework to transform algorithms running on a local (e.g., notebook) into a high-performance distributed application suitable for running on a cluster of computers (or a cluster formed by multiple cores of a single computer).
The Ray framework provides APIs in different languages (e.g., java language API, python language API) for the user, in particular, the Ray framework provides rich Python language API, the Python language API provided by the Ray framework supports Client mode, python Client API can be at nodes outside the Ray cluster, and the Python code to be executed is uploaded to the remote Ray cluster for execution. But APIs in other languages of the Ray framework (e.g., java language) are relatively few and may not support Client mode. For example, since the Java language API provided by the Ray framework does not support the Client mode, the Java language API cannot directly submit the computing task to the Ray cluster for execution, and if the computing capability of the Ray cluster is to be utilized, a corresponding Jar packet must be deployed to each node of the Ray cluster, which may bring additional complexity and risk.
Disclosure of Invention
In view of the above, the present disclosure provides a method, apparatus, computing device, computer-readable storage medium, and computer program product for submitting computing tasks to a Ray cluster to alleviate, mitigate, or even eliminate the above-mentioned problems.
According to one aspect of the present disclosure, there is provided a method of submitting a computing task to a Ray cluster, the method comprising: embedding a Python interpreter in a target process, wherein the target process operates in a target language environment different from the Python language environment, and the target language environment is a Java language environment or a Kotlen language environment; calling a Python language API provided by a Ray framework in the target process by using the Python interpreter to establish communication connection with a Ray cluster; and submitting a target computing task to the Ray cluster via the communication connection in a manner of Python interpretation execution to perform the target computing task in a distributed manner with a plurality of nodes in the Ray cluster, the target computing task being written based on a Python language.
According to some embodiments of the disclosure, the embedding the Python interpreter in the target process includes: installing a Jep component through pip install or installing the Jep component from Jep source codes by using setup.py in an operating system where the target language environment is located; introducing Jar package dependence of black, ninia, jep into a Java program or a Kotlen program corresponding to the target process; generating a first instance of a JepoConfig configuration class based on the Jar package dependency, wherein a path is arranged in the first instance, and the path contains Python codes for calling the Ray cluster through a Python language API; and generating a second instance of the ShareInterpreter class as a CPython interpreter based on the first instance.
According to some embodiments of the disclosure, the submitting the target computing task to the Ray cluster in a Python interpretation execution manner via the communication connection comprises: and calling a function of the Ray cluster by utilizing an invoke method of the ShareInterpter class, wherein the function is contained in the Python code and is used for remotely calling the Ray cluster, so that a target computing task is submitted to the Ray cluster.
According to some embodiments of the disclosure, the submitting the target computing task to the Ray cluster in a Python interpretation execution manner via the communication connection comprises: and calling a function of the Ray cluster by using an exec method of the SharedInterpter class, wherein the function is contained in the Python code and is used for remotely calling the Ray cluster, so that a target computing task is submitted to the Ray cluster.
According to some embodiments of the disclosure, the method further comprises: assigning the returned result of the Ray cluster to a Python variable; and calling a getValue method of the ShareInterpter class to acquire the value of the Python variable and assign the value to a Java variable, so that the calculation result of the target calculation task is acquired in the target language environment.
According to some embodiments of the disclosure, the communication connection employs a gRPC approach.
According to another aspect of the present disclosure, there is provided an apparatus for submitting a computing task to a Ray cluster, wherein the apparatus includes: an interpreter installation module configured to embed a Python interpreter in a target process, the target process operating in a target language environment different from a Python language environment, the target language environment being a Java language environment or a kotlen language environment; a communication connection establishment module configured to call a Python language API provided by a Ray framework in the target process by using the Python interpreter to establish a communication connection with a Ray cluster; and a computing task submission module configured to submit a target computing task to the Ray cluster in a Python interpretation execution manner via the communication connection to perform the target computing task in a distributed manner with a plurality of nodes in the Ray cluster, the target computing task being written based on Python language.
According to yet another aspect of the present disclosure, there is provided a computing device comprising: a memory configured to store computer-executable instructions; a processor configured to perform any of the methods provided according to the foregoing aspects of the present disclosure when the computer-executable instructions are executed by the processor.
According to yet another aspect of the present disclosure, there is provided a computer-readable storage medium storing computer-executable instructions that, when executed, perform any of the methods provided according to the foregoing aspects of the present disclosure.
According to yet another aspect of the present disclosure, there is provided a computer program product comprising computer executable instructions which when executed by a processor perform any of the methods provided according to the foregoing aspects of the present disclosure.
According to the method for submitting a computing task to a Ray cluster provided by the present disclosure, a Python interpreter (which is used for executing Python code running in the target process) may be embedded in a target process, the target process runs in a target language environment (for example, a Java language environment or a kotlein language environment) different from the Python language environment, and further, the Python interpreter is used to call a Python language API provided by a Ray framework in the target process to establish a communication connection with the Ray cluster, so that a target computing task (written based on Python language) is submitted to the Ray cluster in a Python interpretation execution manner via the communication connection, so that the target computing task is performed in a distributed manner by using a plurality of nodes in the Ray cluster. Through the above process, the Python language API provided by the Ray framework can be utilized to directly submit the target computing task to the Ray cluster for distributed execution, so that the computing capability of the Ray cluster can be utilized efficiently in a target language environment different from the Python language environment.
These and other aspects of the disclosure will be apparent from and elucidated with reference to the embodiments described hereinafter.
Drawings
Further details, features and advantages of the technical solutions of the present disclosure are disclosed in the following description of exemplary embodiments with reference to the attached drawings, in which:
FIG. 1 schematically illustrates an example scenario in which a technical solution provided according to some embodiments of the present disclosure may be applied;
FIG. 2 schematically illustrates an example flow chart of a method of submitting computing tasks to a Ray cluster, according to some embodiments of the disclosure;
FIG. 3 schematically illustrates an example schematic diagram of the method of FIG. 2 for submitting computing tasks to a Ray cluster;
FIG. 4 schematically illustrates an example schematic diagram of a method of submitting computing tasks to a Ray cluster in accordance with further embodiments of the present disclosure;
FIG. 5 schematically illustrates an example block diagram of an apparatus that submits computing tasks to a Ray cluster, in accordance with some embodiments of the disclosure;
FIG. 6 illustrates an example system including an example computing device that represents one or more systems and/or devices that can implement the various techniques described herein.
Detailed Description
Several embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings in order to enable those skilled in the art to practice the technical solutions of the present disclosure. The technical solutions of the present disclosure may be embodied in many different forms and objects and should not be limited to the embodiments set forth herein. These embodiments are provided so that this disclosure will be thorough and complete, and should not be construed as limiting the scope of the disclosure.
Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this disclosure belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the relevant art and/or the present specification and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
Fig. 1 schematically illustrates an example scenario 100 in which a technical solution provided according to some embodiments of the present disclosure may be applied. As shown in fig. 1, the scenario 100 may include a Ray cluster 110, a network 120, and a terminal device 130, where the Ray cluster 110 and the terminal device 130 may communicate via the network 120. Ray cluster 110 may include a plurality of servers (nodes), illustratively, as shown in fig. 1, ray cluster 110 includes nodes 111, 112, and 113 for performing corresponding computing tasks in a distributed manner. Note that Ray cluster 110 may include fewer (e.g., two) or more (e.g., four) nodes. Each node in Ray cluster 110 may be a physical machine or a cloud virtual machine, which is not limited by this disclosure. Functionally, each node in the Ray cluster 110 may include a head node (head node) and a number of work nodes (worker nodes), starting the Ray cluster 110 requires first starting the head node (e.g., node 111) and providing the work nodes (e.g., node 112 and node 113) with addresses of the head node to form the Ray cluster 110. In Ray cluster 110, the head node is responsible for managing and distributing the computing tasks of the work nodes, which are responsible for executing the computing tasks and returning the results. It should be further noted that, according to actual needs, the head node and the working node may be different cores on the same computer, or may be different cores on different computers, which is not limited in this disclosure.
Illustratively, the user may embed the Python interpreter in a target process deployed on the terminal device 130, the target process running in a target language environment different from the Python language environment, the target language environment being a Java language environment or a kotlen language environment. Then, using the Python interpreter, a Python language API provided by the Ray framework is called in the target process to establish a communication connection with the Ray cluster 110 (e.g., a communication connection via the network 120), and then a target computing task is submitted to the Ray cluster 110 via the network 120 in a Python interpreted execution manner to the Ray cluster 110 to perform the target computing task in a distributed manner using a plurality of nodes (e.g., the node 112 and the node 113) in the Ray cluster 110, the target computing task being written based on the Python language.
It should be noted that, in this disclosure, the term "target computing task" indicates any operation procedure that the Ray cluster 110 can process, and in different application scenarios, there may be different alternative expressions, for example, in some scenarios of high performance computing such as machine learning, data analysis, etc., it may be a corresponding computing task. In addition, in some financial domain scenarios, which may be described as a "smart contract," a computerized agreement in which terms of a contract may be executed to complete an automated transaction (e.g., querying the physical distribution status of a commodity purchased by a buyer, transferring the buyer's electronic money to a merchant's address after the buyer signs the commodity), ray cluster 110 may execute the corresponding smart contract as a node in a blockchain.
It should also be noted that the term "user" as used herein refers to any party that can interact data with a Ray cluster, including but not limited to people, program software, network platforms, and even machines.
In the present application, ray cluster 110 may be a server cluster on which a corresponding target computing task may be run, and on which various data uploaded by a user and various data generated during task execution may be stored. It should be noted that the stored data may be stored in a plurality of virtual servers that are typically hosted by a third party, rather than on a dedicated server. I.e., at least some of the nodes in Ray cluster 110 may be virtual servers (i.e., cloud virtual machines as described above) provided by cloud computing services. Hosting companies operate large data centers and require customers of the data storage hosting, so that the data storage requirements are met by purchasing or renting storage space from them. The data center operator prepares the storage virtualized resource at the back end according to the requirement of the client and provides the storage virtualized resource in a storage resource pool (storage poo 1), and the client can use the storage resource pool to store data. In practice, these resources may be distributed across numerous server hosts. Alternatively, the Ray cluster 110 may also run other applications and store other data. For example, ray cluster 110 may include multiple virtual hosts to run different applications and provide different services.
In the present application, the terminal device 130 may be various types of devices, such as a mobile phone, a tablet computer, a notebook computer, a wearable device such as a smart watch, a vehicle-mounted device, and the like. The terminal device 130 may have disposed thereon a client that may provide an interface for access operations such as data upload, download, etc., and optionally other services, and may take any of the following forms: locally installed applications, web programs accessed via a browser, etc.
Further, in the present application, the network 120 may be a wired network connected via a cable, an optical fiber, or the like, or may be a wireless network such as 2G, 3G, 4G, 5G, wi-Fi, bluetooth, zigBee, li-Fi, or the like.
Fig. 2 schematically illustrates an example flow chart of a method of submitting computing tasks to a Ray cluster (hereinafter referred to as task submitting method 200 for brevity) according to some embodiments of the disclosure. By way of example, the task submission method 200 may be implemented by the terminal device 130 shown in FIG. 1, although this is not limiting.
Specifically, in step 210, a Python interpreter may be embedded in a target process that operates in a target language environment different from the Python language environment, which is a Java language environment or a kotlen language environment. Illustratively, the target process is deployed on the terminal device 130 shown in FIG. 1. Illustratively, where the target language environment is a Java language environment, the target process is a Java virtual machine (Java Virtual Machine, JVM), the Python interpreter is a Cpython interpreter (a Python interpreter developed in the C language is the most widely used Python interpreter provided by Python authorities), and to embed the Python interpreter in the target process, a Jep component may be installed in the Java language environment to embed the Cpython interpreter in the JVM. Where Jep is an abbreviation of "Java Embedded Python" and is an open source item that embeds the CPython interpreter in Java. Jep uses Java native interface (Java Native Interface, JNI) and CPython language API to launch the Python interpreter in JVM.
In step 220, a Python language API provided by the Ray framework may be called in the target process using the Python interpreter to establish a communication connection with the Ray cluster. Illustratively, the Python language API provided by the Ray framework may be invoked in the target process running in the terminal device 130 shown in fig. 1 to establish a communication connection with the Ray cluster 110. Illustratively, the communication connection may employ the gRPC approach. The gRPC mode has the advantages of high communication efficiency, high access speed and the like.
At step 230, a target computing task may be submitted to the Ray cluster via the communication connection in a Python interpretation execution manner to perform the target computing task in a distributed manner with a plurality of nodes in the Ray cluster, the target computing task being written based on Python language. Illustratively, the target computing tasks may be performed in a distributed manner using nodes 112 and 113 in the Ray cluster 110 shown in FIG. 1. In applications such as machine learning and big data, various computing tasks are mostly written based on the Python language, and the target computing task written based on the Python language can be submitted to the Ray cluster in a Python interpretation and execution manner through steps 210-230, which helps to complete the target computing task more efficiently.
For example, in the case where the target language environment is a Java language environment, if a Java language API provided by the Ray framework is used to submit a corresponding computing task, the corresponding computing task needs to be compiled, and then a file (usually a Jar package) obtained by compiling is copied to a corresponding node of the Ray cluster for execution, which brings additional complexity and risk. With the task submission method 200 shown in fig. 2, a Python interpreter may be embedded in a target process (which runs in a target language environment different from the Python language environment), and then, with the Python interpreter, a Python language API provided by a Ray framework is called in the target process to establish a communication connection with the Ray cluster, so that a target computing task written based on Python language is submitted to the Ray cluster via the communication connection to perform the target computing task in a distributed manner with a plurality of nodes in the Ray cluster. Through the above process, the Python language API provided by the Ray framework can be utilized to directly submit the target computing task to the Ray cluster for distributed execution, so that the computing capability of the Ray cluster can be utilized across languages to execute the corresponding computing task. In particular, through the above procedure, a target computing task that can be dynamically adjusted can be submitted to the Ray cluster in a manner that does not require compilation (i.e., in a manner that is performed in a Python interpretation). For example, the target computing task may be in the form of a string that a user may conveniently modify to obtain a different target computing task and submit to the Ray cluster in a compilation-free manner.
The principles of the task submission method 200 shown in FIG. 2 are further described below with respect to FIG. 3. Illustratively, the target process 310 in fig. 3 is deployed on the terminal device 130 shown in fig. 1, and the Python interpreter 311 is embedded in the target process 310, and a communication connection with the Ray cluster is established by calling a Python language API provided by the Ray framework in the target process 310. As shown in fig. 3, a target computing task written based on a Python language is submitted to a Ray cluster in a Python interpretation execution manner via an established communication connection, so that the target computing task can be performed in a distributed manner using a plurality of nodes (e.g., N nodes: node_1, node_2, … node_n shown in fig. 3) in the Ray cluster.
In some embodiments, the embedding the Python interpreter in the target process comprises: installing a Jep component through pip install or installing the Jep component from Jep source codes by using setup.py in an operating system where the target language environment is located; introducing Jar package dependence of black, ninia, jep into a Java program or a Kotlen program corresponding to the target process; generating a first instance of a JepoConfig configuration class based on the Jar package dependency, wherein a path is arranged in the first instance, and the path contains Python codes for calling the Ray cluster through a Python language API; and generating a second instance of the ShareInterpreter class as a CPython interpreter based on the first instance. Taking the case that the target language environment is a JAVA language environment as an example (in this case, the target process is a JAVA virtual machine), as shown in fig. 4, by installing a Jep component in the JAVA language environment, embedding a Cpython interpreter in the JVM, a communication connection can be established with the Ray cluster by calling a Python language API provided by a Ray framework in the JVM, so that the target computing task can be performed in a distributed manner by using a plurality of nodes (for example, N nodes, node_1, node_2, … node_n, shown in fig. 4) in the Ray cluster.
As can be seen in connection with fig. 4, the above procedure enables the Java to submit computing tasks to the Ray cluster. Specifically, since the Cpython interpreter is embedded in the JVM, two language codes of Java and Python can run in the same JVM process, python codes can be executed in the Java language code, the returned value of the Python codes is assigned to Java variables, and then a Ray cluster can be remotely accessed by using a Python language API provided by a Ray framework, and corresponding computing tasks are directly submitted to the Ray cluster for distributed execution in a Python interpretation execution mode without compiling and deploying the corresponding computing tasks to each node of the Ray cluster for execution.
In addition to the above example of the JAVA language environment, the target language environment may be a Kotlin language environment, in which case, the process of embedding the Python interpreter in the target process is similar to the case where the target language environment is a JAVA language environment, and will not be described herein.
To submit a target computing task to the Ray cluster, in some embodiments, an invoke method of the sharedintersiter class may be used to invoke a function of the Ray cluster that is included in the Python code to submit a target computing task to the Ray cluster (such a method may also obtain a computing result of the target computing task in the target language environment). Alternatively, in other embodiments, exec methods of the sharedinterster class may be utilized to call functions of the Ray cluster that are included in the Python code to remotely call the Ray cluster to submit target computing tasks to the Ray cluster. In the latter case, the returned result of the Ray cluster may be further assigned to a Python variable, and further, a getValue method of the sharedInterpeter class may be called to obtain the value of the Python variable and assign the value to a Java variable, so as to obtain the calculation result of the target calculation task in the target language environment.
Fig. 5 schematically illustrates an example block diagram of an apparatus 500 for submitting computing tasks to a Ray cluster (hereinafter referred to as task submitting apparatus 500 for brevity) according to some embodiments of the disclosure. By way of example, the task submission apparatus 500 may be deployed on the terminal device 130 shown in fig. 1. As shown in fig. 5, the task submission apparatus 500 includes an interpreter installation module 510, a communication connection establishment module 520, and a computing task submission module 530.
Specifically, the interpreter installation module 510 may be configured to embed a Python interpreter in a target process that operates in a target language environment different from the Python language environment, the target language environment being a Java language environment or a kotlen language environment; the communication connection establishment module 520 may be configured to call a Python language API provided by the Ray framework in the target process to establish a communication connection with the Ray cluster using the Python interpreter; and a computing task submission module 530 may be configured to submit a target computing task to the Ray cluster via the communication connection in a Python interpretation execution manner to perform the target computing task in a distributed manner with a plurality of nodes in the Ray cluster, the target computing task being written based on Python language.
It should be appreciated that task submission apparatus 500 may be implemented in software, hardware, or a combination of both.
In addition, the task submission apparatus 500 may be used to implement the task submission method 200 described above, and its related details are described in detail above, and for brevity, will not be repeated here. In addition, these devices may have the same features and advantages as described for the corresponding methods.
FIG. 6 illustrates an example system including an example computing device 600 that represents one or more systems and/or devices that can implement the various techniques described herein. Computing device 600 may be, for example, a server used in a distributed computing scenario, a device associated with a server, a system-on-chip, and/or any other suitable computing device or computing system. The task submission apparatus 500 described above with reference to fig. 5 may take the form of a computing device 600. Alternatively, the task submission apparatus 500 may be implemented as a computer program in the form of an application 616.
The example computing device 600 as shown in fig. 6 includes a processing system 611, one or more computer-readable media 612, and one or more I/O interfaces 613 communicatively coupled to each other. Although not shown, computing device 600 may also include a system bus or other data and command transfer system that couples the various components to one another. A system bus may include any one or combination of different bus structures, such as a memory bus or memory controller, a peripheral bus, a universal serial bus, and/or a processor or local bus that utilizes any of a variety of bus architectures. Various other examples are also contemplated, such as control and data lines.
The processing system 611 represents functionality that performs one or more operations using hardware. Thus, the processing system 611 is illustrated as including hardware elements 614 that may be configured as processors, functional blocks, and the like. This may include implementation in hardware as application specific integrated circuits or other logic devices formed using one or more semiconductors. The hardware element 614 is not limited by the materials from which it is formed or the processing mechanisms employed therein. For example, the processor may be comprised of semiconductor(s) and/or transistors (e.g., electronic Integrated Circuits (ICs)). In such a context, the processor-executable instructions may be electronically-executable instructions.
Computer-readable medium 612 is illustrated as including memory/storage 615. Memory/storage 615 represents memory/storage capacity associated with one or more computer-readable media. Memory/storage 615 may include volatile media (such as Random Access Memory (RAM)) and/or nonvolatile media (such as Read Only Memory (ROM), flash memory, optical disks, magnetic disks, and so forth). The memory/storage 615 may include fixed media (e.g., RAM, ROM, a fixed hard drive, etc.) and removable media (e.g., flash memory, a removable hard drive, an optical disk, and so forth). The computer-readable medium 612 may be configured in a variety of other ways as described further below.
One or more I/O interfaces 613 represent functionality that allows a user to input commands and information to computing device 600 using various input devices, and optionally also allows information to be presented to the user and/or other components or devices using various output devices. Examples of input devices include keyboards, cursor control devices (e.g., mice), microphones (e.g., for voice input), scanners, touch functions (e.g., capacitive or other sensors configured to detect physical touches), cameras (e.g., motion that does not involve touches may be detected as gestures using visible or invisible wavelengths such as infrared frequencies), and so forth. Examples of output devices include a display device (e.g., projector), speakers, printer, network card, haptic response device, and so forth. Accordingly, computing device 600 may be configured in a variety of ways to support user interaction as described further below.
Computing device 600 also includes applications 616. The application 616 may be, for example, a software instance of the task submission apparatus 500, and implement the techniques described herein in combination with other elements in the computing device 600.
Various techniques may be described herein in the general context of software hardware elements or program modules. Generally, these modules include routines, programs, elements, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The terms "module," "functionality," and "component" as used herein generally represent software, firmware, hardware, or a combination thereof. The features of the techniques described herein are platform-independent, meaning that the techniques may be implemented on a variety of computing platforms having a variety of processors.
An implementation of the described modules and techniques may be stored on or transmitted across some form of computer readable media. Computer readable media can include a variety of media that are accessible by computing device 600. By way of example, and not limitation, computer readable media may comprise "computer readable storage media" and "computer readable signal media".
"computer-readable storage medium" refers to a medium and/or device that can permanently store information and/or a tangible storage device, as opposed to a mere signal transmission, carrier wave, or signal itself. Thus, computer-readable storage media refers to non-signal bearing media. Computer-readable storage media include hardware such as volatile and nonvolatile, removable and non-removable media and/or storage devices implemented in methods or techniques suitable for storage of information such as computer-readable instructions, data structures, program modules, logic elements/circuits or other data. Examples of a computer-readable storage medium may include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital Versatile Disks (DVD) or other optical storage, hard disk, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or other storage devices, tangible media, or articles of manufacture adapted to store the desired information and which may be accessed by a computer.
"computer-readable signal medium" refers to a signal bearing medium configured to transmit instructions to hardware of computing device 600, such as via a network. Signal media may typically be embodied in a modulated data signal, such as a carrier wave, data signal, or other transport mechanism, with computer readable instructions, data structures, program modules, or other data. Signal media also include any information delivery media. The term "modulated data signal" means a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, RF, infrared and other wireless media.
As previously described, the hardware elements 614 and computer-readable media 612 represent instructions, modules, programmable device logic, and/or fixed device logic implemented in hardware that may be used in some embodiments to implement at least some aspects of the techniques described herein. The hardware elements may include integrated circuits or components of a system on a chip, application Specific Integrated Circuits (ASICs), field Programmable Gate Arrays (FPGAs), complex Programmable Logic Devices (CPLDs), and other implementations in silicon or other hardware devices. In this context, the hardware elements may be implemented as processing devices that perform program tasks defined by instructions, modules, and/or logic embodied by the hardware elements, as well as hardware devices that store instructions for execution, such as the previously described computer-readable storage media.
Combinations of the foregoing may also be used to implement the various techniques and modules described herein. Accordingly, software, hardware, or program modules, and other program modules may be implemented as one or more instructions and/or logic embodied on some form of computer readable storage medium and/or by one or more hardware elements 614. Computing device 600 may be configured to implement particular instructions and/or functions corresponding to software and/or hardware modules. Thus, for example, by using the computer-readable storage medium of the processing system and/or the hardware element 614, a module may be implemented at least in part in hardware as a module executable by the computing device 600 as software. The instructions and/or functions may be executable/operable by one or more articles of manufacture (e.g., one or more computing devices 600 and/or processing systems 611) to implement the techniques, modules, and examples described herein.
In various implementations, computing device 600 may take on a variety of different configurations. For example, computing device 600 may be implemented as a computer-like device including a personal computer, desktop computer, multi-screen computer, laptop computer, netbook, and the like. Computing device 600 may also be implemented as a mobile appliance-like device including a mobile device such as a mobile phone, portable music player, portable gaming device, tablet computer, multi-screen computer, or the like. Computing device 600 may also be implemented as a television-like device that includes devices having or connected to generally larger screens in casual viewing environments. Such devices include televisions, set-top boxes, gaming machines, and the like.
The techniques described herein may be supported by these various configurations of computing device 600 and are not limited to the specific examples of techniques described herein. The functionality may also be implemented in whole or in part on the "cloud" 620 using a distributed system, such as by the platform 622 described below.
Cloud 620 includes and/or represents platform 622 for resource 624. Platform 622 abstracts underlying functionality of hardware (e.g., servers) and software resources of cloud 620. The resources 624 may include applications and/or data that may be used when executing computer processing on a server remote from the computing device 600. The resources 624 may also include services provided over the internet and/or over subscriber networks such as cellular or Wi-Fi networks.
Platform 622 may abstract resources and functionality to connect computing device 600 with other computing devices. Platform 622 may also be used to abstract the hierarchy of resources to provide a corresponding level of hierarchy of encountered demand for resources 624 implemented via platform 622. Thus, in an interconnected device embodiment, the implementation of the functionality described herein may be distributed throughout the system 600. For example, the functionality may be implemented in part on computing device 600 and by platform 622 abstracting the functionality of cloud 620.
It should be understood that for clarity, embodiments of the present disclosure have been described with reference to different functional units. However, it will be apparent that the functionality of each functional unit may be implemented in a single unit, in a plurality of units or as part of other functional units without departing from the present disclosure. For example, functionality illustrated to be performed by a single unit may be performed by multiple different units. Thus, references to specific functional units are only to be seen as references to suitable units for providing the described functionality rather than indicative of a strict logical or physical structure or organization. Thus, the present disclosure may be implemented in a single unit or may be physically and functionally distributed between different units and circuits.
It will be understood that, although the terms first, second, third, etc. may be used herein to describe various devices, elements, components or sections, these devices, elements, components or sections should not be limited by these terms. These terms are only used to distinguish one device, element, component, or section from another device, element, component, or section.
Although the present disclosure has been described in connection with some embodiments, it is not intended to be limited to the specific form set forth herein. Rather, the scope of the present disclosure is limited only by the appended claims. Additionally, although individual features may be included in different claims, these may possibly be advantageously combined, and the inclusion in different claims does not imply that a combination of features is not feasible and/or advantageous. The order of features in the claims does not imply any specific order in which the features must be worked. Furthermore, in the claims, the word "comprising" does not exclude other elements, and the term "a" or "an" does not exclude a plurality. Reference signs in the claims are provided merely as a clarifying example and shall not be construed as limiting the scope of the claims in any way.
It should be understood that for clarity, embodiments of the present disclosure have been described with reference to different functional units. However, it will be apparent that the functionality of each functional unit may be implemented in a single unit, in a plurality of units or as part of other functional units without departing from the present disclosure. For example, functionality illustrated to be performed by a single unit may be performed by multiple different units. Thus, references to specific functional units are only to be seen as references to suitable units for providing the described functionality rather than indicative of a strict logical or physical structure or organization. Thus, the present disclosure may be implemented in a single unit or may be physically and functionally distributed between different units and circuits.
The present disclosure provides a computer readable storage medium having stored thereon computer readable instructions that when executed implement the above-described method of submitting computing tasks to a Ray cluster.
The present disclosure provides a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The computer instructions are read from the computer-readable storage medium by a processor of a computing device, and executed by the processor, cause the computing device to perform the method of submitting computing tasks to a Ray cluster provided in various alternative implementations described above.
Variations to the disclosed embodiments can be understood and effected by those skilled in the art in practicing the claimed subject matter, from a study of the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other elements or steps, and the "a" or "an" does not exclude a plurality. The mere fact that certain measures are recited in mutually different dependent claims does not indicate that a combination of these measures cannot be used to advantage.
Claims (10)
1. A method of submitting a computing task to a Ray cluster, the method comprising:
embedding a Python interpreter in a target process, wherein the target process operates in a target language environment different from the Python language environment, and the target language environment is a Java language environment or a Kotlen language environment;
calling a Python language API provided by a Ray framework in the target process by using the Python interpreter to establish communication connection with a Ray cluster; and
submitting a target computing task to the Ray cluster via the communication connection in a manner of Python interpretation execution to perform the target computing task in a distributed manner with a plurality of nodes in the Ray cluster, the target computing task being written based on a Python language.
2. The method of claim 1, wherein embedding a Python interpreter in the target process comprises:
installing a Jep component through pip install or installing the Jep component from Jep source codes by using setup.py in an operating system where the target language environment is located;
introducing Jar package dependence of black, ninia, jep into a Java program or a Kotlen program corresponding to the target process;
generating a first instance of a JepoConfig configuration class based on the Jar package dependency, wherein a path is arranged in the first instance, and the path contains Python codes for calling the Ray cluster through a Python language API; and
a second instance of the ShareInterpter class is generated as a CPython interpreter based on the first instance.
3. The method of claim 2, wherein submitting the target computing task to the Ray cluster in a Python interpretation execution via the communication connection comprises:
and calling a function of the Ray cluster by utilizing an invoke method of the ShareInterpter class, wherein the function is contained in the Python code and is used for remotely calling the Ray cluster, so that a target computing task is submitted to the Ray cluster.
4. The method of claim 2, wherein submitting the target computing task to the Ray cluster in a Python interpretation execution via the communication connection comprises:
and calling a function of the Ray cluster by using an exec method of the SharedInterpter class, wherein the function is contained in the Python code and is used for remotely calling the Ray cluster, so that a target computing task is submitted to the Ray cluster.
5. The method according to claim 4, wherein the method further comprises:
assigning the returned result of the Ray cluster to a Python variable; and
and calling a getValue method of the ShareInterpter class to acquire the value of the Python variable and assign the value to the Java variable, so that the calculation result of the target calculation task is acquired in the target language environment.
6. The method of claim 1, wherein the communication connection is in the form of a gRPC.
7. An apparatus for submitting computing tasks to a Ray cluster, the apparatus comprising:
an interpreter installation module configured to embed a Python interpreter in a target process, the target process operating in a target language environment different from a Python language environment, the target language environment being a Java language environment or a kotlen language environment;
a communication connection establishment module configured to call a Python language API provided by a Ray framework in the target process by using the Python interpreter to establish a communication connection with a Ray cluster; and
a computing task submission module configured to submit a target computing task to the Ray cluster via the communication connection in a Python interpretation execution manner to perform the target computing task in a distributed manner with a plurality of nodes in the Ray cluster, the target computing task being written based on Python language.
8. A computing device, the computing device comprising:
a memory configured to store computer-executable instructions;
a processor configured to perform the method according to any one of claims 1 to 6 when the computer executable instructions are executed by the processor.
9. A computer readable storage medium storing computer executable instructions which, when executed, perform the method of any one of claims 1 to 6.
10. A computer program product, characterized in that the computer program product comprises computer-executable instructions, wherein the computer-executable instructions, when executed by a processor, perform the method according to any of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310559086.0A CN116594773A (en) | 2023-05-17 | 2023-05-17 | Method and device for submitting computing tasks to Ray cluster |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310559086.0A CN116594773A (en) | 2023-05-17 | 2023-05-17 | Method and device for submitting computing tasks to Ray cluster |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116594773A true CN116594773A (en) | 2023-08-15 |
Family
ID=87607609
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310559086.0A Pending CN116594773A (en) | 2023-05-17 | 2023-05-17 | Method and device for submitting computing tasks to Ray cluster |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116594773A (en) |
-
2023
- 2023-05-17 CN CN202310559086.0A patent/CN116594773A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11405274B2 (en) | Managing virtual network functions | |
CN109325195B (en) | Rendering method and system for browser, computer device and computer storage medium | |
US10956341B2 (en) | Multi-engine address translation facility | |
CN113312037B (en) | Data processing method, device, equipment and storage medium applied to micro-service | |
WO2017166447A1 (en) | Method and device for loading kernel module | |
US10628232B2 (en) | Methods and apparatus for limiting data transferred over the network by interpreting part of the data as a metaproperty | |
US20180239653A1 (en) | Exposing server functions to browser code | |
JP6182160B2 (en) | Dynamic code insertion into a running process | |
US9959135B2 (en) | Pattern design for heterogeneous environments | |
CN104335201B (en) | The mechanism of dynamic and trusted extension upgrading based on cloud for promoting computing system | |
US11895553B2 (en) | Web application with components in different virtual environments | |
JP2021068415A (en) | Code execution method, device, rendering device, storage medium, and program | |
US11960918B2 (en) | Creating product orchestration engines | |
JP2023547070A (en) | Reloading updated shared libraries without stopping application execution | |
US10789048B2 (en) | Namespace and class utilities for managed packages | |
US10579373B2 (en) | Seamless extension porting | |
US20230114321A1 (en) | Cloud Data Ingestion System | |
CN116594773A (en) | Method and device for submitting computing tasks to Ray cluster | |
CN112506781B (en) | Test monitoring method, device, electronic equipment, storage medium and program product | |
CN110599112A (en) | Method and device for developing and maintaining network page | |
CN114035864A (en) | Interface processing method, interface processing device, electronic device, and storage medium | |
JP2018106709A (en) | METHOD OF PROCESSING OpenCL KERNEL AND COMPUTING DEVICE TO IMPLEMENT THE SAME | |
US20230359440A1 (en) | Externally-initiated runtime type extension | |
US20230168949A1 (en) | Integration extensions | |
US20240020176A1 (en) | Methods and apparatus for deployment of a virtual computing cluster |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |