Repository: facebookresearch/hydra

Issue:
[Feature Request] RQ Launcher SSL support
# 🚀 Feature Request
RQ (Redis-Queue) has [support](https://github.com/rq/rq/blob/master/rq/cli/helpers.py#L56) for SSL connections. We can easily port this over to the plugin.

## Motivation
Allows users to use SSL Redis connections in the RQ Hydra Launcher. e.g. some cloud providers require you to connect with SSL (`rediss` instead of `redis`) and don't let you connect otherwise.

## Pitch
Will open PR 👍🏻

## Additional context
Currently Hydra RQ launcher only supports the following options:
```shell
export REDIS_HOST=localhost
export REDIS_PORT=6379
export REDIS_DB=0
export REDIS_PASSWORD=
python run.py hydra/launcher=rq random_state=0,1,2,3 --multirun
```
→ no way to configure SSL if server requires so.

Therefore, we require an option to configure Redis connections over SSL, e.g.:
```shell
export REDIS_SSL=True
python run.py hydra/launcher=rq random_state=0,1,2,3 --multirun
```

✨


Discussion:

Resolving patch:
diff --git a/plugins/hydra_rq_launcher/hydra_plugins/hydra_rq_launcher/_core.py b/plugins/hydra_rq_launcher/hydra_plugins/hydra_rq_launcher/_core.py
--- a/plugins/hydra_rq_launcher/hydra_plugins/hydra_rq_launcher/_core.py
+++ b/plugins/hydra_rq_launcher/hydra_plugins/hydra_rq_launcher/_core.py
@@ -76,6 +76,8 @@ def launch(
             port=rq_cfg.redis.port,
             db=rq_cfg.redis.db,
             password=rq_cfg.redis.password,
+            ssl=rq_cfg.redis.ssl,
+            ssl_ca_certs=rq_cfg.redis.ssl_ca_certs,
         )
     else:
         log.info("Running in synchronous mode")
diff --git a/plugins/hydra_rq_launcher/hydra_plugins/hydra_rq_launcher/config.py b/plugins/hydra_rq_launcher/hydra_plugins/hydra_rq_launcher/config.py
--- a/plugins/hydra_rq_launcher/hydra_plugins/hydra_rq_launcher/config.py
+++ b/plugins/hydra_rq_launcher/hydra_plugins/hydra_rq_launcher/config.py
@@ -16,6 +16,10 @@ class RedisConf:
     db: Optional[str] = II("oc.env:REDIS_DB,'0'")
     # password via REDIS_PASSWORD environment variable, default: no password
     password: Optional[str] = II("oc.env:REDIS_PASSWORD,null")
+    # enable/disable SSL, via REDIS_SSL environment variable, default False
+    ssl: bool = II("oc.env:REDIS_SSL,'False'")
+    # path to custom certs, via REDIS_SSL_CA_CERTS env veriable, default none
+    ssl_ca_certs: Optional[str] = II("oc.env:REDIS_SSL_CA_CERTS,null")
     # switch to run without redis server in single thread, for testing purposes only
     mock: bool = II("oc.env:REDIS_MOCK,'False'")
 


Test patch:
diff --git a/plugins/hydra_rq_launcher/tests/test_rq_launcher.py b/plugins/hydra_rq_launcher/tests/test_rq_launcher.py
--- a/plugins/hydra_rq_launcher/tests/test_rq_launcher.py
+++ b/plugins/hydra_rq_launcher/tests/test_rq_launcher.py
@@ -1,4 +1,6 @@
 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
+from typing import List
+
 from hydra.core.plugins import Plugins
 from hydra.plugins.launcher import Launcher
 from hydra.test_utils.launcher_common_tests import (
@@ -47,14 +49,17 @@ class TestRQLauncherIntegration(IntegrationTestSuite):
 
 # https://github.com/rq/rq/issues/1244
 @mark.filterwarnings("ignore::DeprecationWarning")
-def test_example_app(hydra_sweep_runner: TSweepRunner) -> None:
+@mark.parametrize("params_overrides", [[], ["hydra.launcher.redis.ssl=true"]])
+def test_example_app(
+    hydra_sweep_runner: TSweepRunner, params_overrides: List[str]
+) -> None:
     with hydra_sweep_runner(
         calling_file="example/my_app.py",
         calling_module=None,
         task_function=None,
         config_path=".",
         config_name="config",
-        overrides=["task=1,2,3,4"],
+        overrides=["task=1,2,3,4"] + params_overrides,
     ) as sweep:
         overrides = {("task=1",), ("task=2",), ("task=3",), ("task=4",)}