mirror of
https://github.com/vale981/ray
synced 2025-03-06 02:21:39 -05:00
Fix some small code quality issues. (#3719)
This commit is contained in:
parent
cc5ecd71c5
commit
fa2bfa6d76
5 changed files with 15 additions and 15 deletions
|
@ -206,7 +206,7 @@ ClientConnection<T>::ClientConnection(MessageHandler<T> &message_handler,
|
|||
error_message_type_(error_message_type) {}
|
||||
|
||||
template <class T>
|
||||
const ClientID &ClientConnection<T>::GetClientId() {
|
||||
const ClientID &ClientConnection<T>::GetClientId() const {
|
||||
return client_id_;
|
||||
}
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ class ClientConnection : public ServerConnection<T> {
|
|||
}
|
||||
|
||||
/// \return The ClientID of the remote client.
|
||||
const ClientID &GetClientId();
|
||||
const ClientID &GetClientId() const;
|
||||
|
||||
/// \param client_id The ClientID of the remote client.
|
||||
void SetClientID(const ClientID &client_id);
|
||||
|
|
|
@ -145,17 +145,17 @@ class ResourceIds {
|
|||
///
|
||||
/// \param resource_quantity: The total amount of resource. This must either be
|
||||
/// a whole number or a fraction less than 1.
|
||||
ResourceIds(double resource_quantity);
|
||||
explicit ResourceIds(double resource_quantity);
|
||||
|
||||
/// \brief Constructs ResourceIds with a given set of whole IDs.
|
||||
///
|
||||
/// \param whole_ids: A vector of the resource IDs that are completely available.
|
||||
ResourceIds(const std::vector<int64_t> &whole_ids);
|
||||
explicit ResourceIds(const std::vector<int64_t> &whole_ids);
|
||||
|
||||
/// \brief Constructs ResourceIds with a given set of fractional IDs.
|
||||
///
|
||||
/// \param fractional_ids: A vector of the resource IDs that are partially available.
|
||||
ResourceIds(const std::vector<std::pair<int64_t, double>> &fractional_ids);
|
||||
explicit ResourceIds(const std::vector<std::pair<int64_t, double>> &fractional_ids);
|
||||
|
||||
/// \brief Constructs ResourceIds with a given set of whole IDs and fractional IDs.
|
||||
///
|
||||
|
|
|
@ -144,7 +144,7 @@ void WorkerPool::StartWorkerProcess(const Language &language) {
|
|||
<< strerror(errno);
|
||||
}
|
||||
|
||||
void WorkerPool::RegisterWorker(std::shared_ptr<Worker> worker) {
|
||||
void WorkerPool::RegisterWorker(const std::shared_ptr<Worker> &worker) {
|
||||
auto pid = worker->Pid();
|
||||
RAY_LOG(DEBUG) << "Registering worker with pid " << pid;
|
||||
auto &state = GetStateForLanguage(worker->GetLanguage());
|
||||
|
@ -158,7 +158,7 @@ void WorkerPool::RegisterWorker(std::shared_ptr<Worker> worker) {
|
|||
}
|
||||
}
|
||||
|
||||
void WorkerPool::RegisterDriver(std::shared_ptr<Worker> driver) {
|
||||
void WorkerPool::RegisterDriver(const std::shared_ptr<Worker> &driver) {
|
||||
RAY_CHECK(!driver->GetAssignedTaskId().is_nil());
|
||||
auto &state = GetStateForLanguage(driver->GetLanguage());
|
||||
state.registered_drivers.insert(std::move(driver));
|
||||
|
@ -186,7 +186,7 @@ std::shared_ptr<Worker> WorkerPool::GetRegisteredDriver(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void WorkerPool::PushWorker(std::shared_ptr<Worker> worker) {
|
||||
void WorkerPool::PushWorker(const std::shared_ptr<Worker> &worker) {
|
||||
// Since the worker is now idle, unset its assigned task ID.
|
||||
RAY_CHECK(worker->GetAssignedTaskId().is_nil())
|
||||
<< "Idle workers cannot have an assigned task ID";
|
||||
|
@ -218,13 +218,13 @@ std::shared_ptr<Worker> WorkerPool::PopWorker(const TaskSpecification &task_spec
|
|||
return worker;
|
||||
}
|
||||
|
||||
bool WorkerPool::DisconnectWorker(std::shared_ptr<Worker> worker) {
|
||||
bool WorkerPool::DisconnectWorker(const std::shared_ptr<Worker> &worker) {
|
||||
auto &state = GetStateForLanguage(worker->GetLanguage());
|
||||
RAY_CHECK(RemoveWorker(state.registered_workers, worker));
|
||||
return RemoveWorker(state.idle, worker);
|
||||
}
|
||||
|
||||
void WorkerPool::DisconnectDriver(std::shared_ptr<Worker> driver) {
|
||||
void WorkerPool::DisconnectDriver(const std::shared_ptr<Worker> &driver) {
|
||||
auto &state = GetStateForLanguage(driver->GetLanguage());
|
||||
RAY_CHECK(RemoveWorker(state.registered_drivers, driver));
|
||||
}
|
||||
|
|
|
@ -57,12 +57,12 @@ class WorkerPool {
|
|||
/// pool after it becomes idle (e.g., requests a work assignment).
|
||||
///
|
||||
/// \param The Worker to be registered.
|
||||
void RegisterWorker(std::shared_ptr<Worker> worker);
|
||||
void RegisterWorker(const std::shared_ptr<Worker> &worker);
|
||||
|
||||
/// Register a new driver.
|
||||
///
|
||||
/// \param The driver to be registered.
|
||||
void RegisterDriver(const std::shared_ptr<Worker> worker);
|
||||
void RegisterDriver(const std::shared_ptr<Worker> &worker);
|
||||
|
||||
/// Get the client connection's registered worker.
|
||||
///
|
||||
|
@ -84,17 +84,17 @@ class WorkerPool {
|
|||
///
|
||||
/// \param The worker to disconnect. The worker must be registered.
|
||||
/// \return Whether the given worker was in the pool of idle workers.
|
||||
bool DisconnectWorker(std::shared_ptr<Worker> worker);
|
||||
bool DisconnectWorker(const std::shared_ptr<Worker> &worker);
|
||||
|
||||
/// Disconnect a registered driver.
|
||||
///
|
||||
/// \param The driver to disconnect. The driver must be registered.
|
||||
void DisconnectDriver(std::shared_ptr<Worker> driver);
|
||||
void DisconnectDriver(const std::shared_ptr<Worker> &driver);
|
||||
|
||||
/// Add an idle worker to the pool.
|
||||
///
|
||||
/// \param The idle worker to add.
|
||||
void PushWorker(std::shared_ptr<Worker> worker);
|
||||
void PushWorker(const std::shared_ptr<Worker> &worker);
|
||||
|
||||
/// Pop an idle worker from the pool. The caller is responsible for pushing
|
||||
/// the worker back onto the pool once the worker has completed its work.
|
||||
|
|
Loading…
Add table
Reference in a new issue