Remote OTP with Ray#

Ray is a distributed execution framework for Python, and you can run code remotely on your dedicated Ray instance, without need to installing OneTick binaries locally.

Remote OTP Concepts#

Although, it isn’t possible to use without OneTick installation and its binaries, but it is still possible to run code remotely on Ray instance, while developing locally in your preferable IDE or Jupyter.


Each request to Ray server needs to be done in initialized context:

import ray

To onetick-py code you need to locate it inside some function, which in turn must be decorated with @ray.remote(max_retries=1) decorator to become so called “remote function”. Argument max_retries=1 is good to avoid retrying for failing calls of remote function, which is most probable will be caused by mistakes in your code.

import as otp

def example_otp_code():
    # here your OTP code goes
    return results

Following code runs remote function on Ray instance and return the results.

result = ray.get(example_otp_code.remote())

When you finish, it is necessary to shutdown your Ray connection (don’t forget to do it, as it is could lead to memory consumption on Ray server):