Skip to content

[tune] reuse_actors doesn't reuse actors for the class based API #13475

@cruyffturn

Description

@cruyffturn

What is the problem?

"reuse_actors = True" doesn't work as expected for the class based API. When I inspect the timeline I observe that workers are not reused. On the other hand, when I use the function based API it works faster and only 3 workers are used in the timeline as expected.

Ray version 1.1.0, Python 3.6.12.

Reproduction (REQUIRED)

import time
import ray
from ray import tune
import numpy as np

class Trainable(tune.Trainable):
    
    def _setup(self, config):
        self.i = 0
    
    def _train(self):  # This is called iteratively.
        print(self.i)
        time.sleep(1)
        self.i += 1
            
        return {'i':self.i}    

ray.init(num_cpus=3, num_gpus=0)
        
search_space = {
        "i": tune.grid_search(np.arange(20).tolist())
        }

analysis = tune.run(Trainable,
                    name = 'exp',
                    stop = {'i':1},
                    config=search_space,
                    reuse_actors = True
                    )
  • [y] I have verified my script runs in a clean environment and reproduces the issue.
  • [y] I have verified the issue also occurs with the latest wheels.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that is supposed to be working; but isn'ttriageNeeds triage (eg: priority, bug/not-bug, and owning component)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions