mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/13582 Worker nodes sometimes witness timeout failures when getting session_id blob from Zeus, which due to delays in master node setting the blob. This diff will add flexibility to specify longer timeout for getting blobs from Zeus. Reviewed By: pietern Differential Revision: D12926156 fbshipit-source-id: b1a4d1d9cf7de084785bfa4a8a0cd3cfd095ba5c
42 lines
999 B
C++
42 lines
999 B
C++
#pragma once
|
|
|
|
#include <caffe2/distributed/store_handler.h>
|
|
|
|
extern "C" {
|
|
#include <hiredis/hiredis.h>
|
|
}
|
|
|
|
#include <string>
|
|
|
|
namespace caffe2 {
|
|
|
|
class CAFFE2_API RedisStoreHandler : public StoreHandler {
|
|
public:
|
|
explicit RedisStoreHandler(std::string& host, int port, std::string& prefix);
|
|
virtual ~RedisStoreHandler();
|
|
|
|
virtual void set(const std::string& name, const std::string& data) override;
|
|
|
|
virtual std::string get(
|
|
const std::string& name,
|
|
const std::chrono::milliseconds& timeout = kDefaultTimeout) override;
|
|
|
|
virtual int64_t add(const std::string& name, int64_t value) override;
|
|
|
|
virtual bool check(const std::vector<std::string>& names) override;
|
|
|
|
virtual void wait(
|
|
const std::vector<std::string>& names,
|
|
const std::chrono::milliseconds& timeout = kDefaultTimeout) override;
|
|
|
|
private:
|
|
std::string host_;
|
|
int port_;
|
|
std::string prefix_;
|
|
|
|
redisContext* redis_;
|
|
|
|
std::string compoundKey(const std::string& name);
|
|
};
|
|
|
|
} // namespace caffe2
|