mirror of
https://github.com/elastic/eland.git
synced 2025-07-24 00:00:39 +08:00
Add --ca-certs and --insecure option for configuring TLS
This commit is contained in:
parent
abd05df50b
commit
5c5e5af54d
@ -29,6 +29,7 @@ import argparse
|
|||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
import elasticsearch
|
import elasticsearch
|
||||||
|
from elastic_transport.client_utils import DEFAULT
|
||||||
|
|
||||||
from eland.ml.pytorch import PyTorchModel
|
from eland.ml.pytorch import PyTorchModel
|
||||||
from eland.ml.pytorch.transformers import SUPPORTED_TASK_TYPES, TransformerModel
|
from eland.ml.pytorch.transformers import SUPPORTED_TASK_TYPES, TransformerModel
|
||||||
@ -81,9 +82,21 @@ def main():
|
|||||||
default=False,
|
default=False,
|
||||||
help="Should the model previously stored with `elasticsearch-model-id` be deleted"
|
help="Should the model previously stored with `elasticsearch-model-id` be deleted"
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--insecure",
|
||||||
|
action="store_false",
|
||||||
|
default=True,
|
||||||
|
help="Do not verify SSL certificates"
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--ca-certs",
|
||||||
|
required=False,
|
||||||
|
default=DEFAULT,
|
||||||
|
help="Path to CA bundle"
|
||||||
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
es = elasticsearch.Elasticsearch(args.url, timeout=300) # 5 minute timeout
|
es = elasticsearch.Elasticsearch(args.url, request_timeout=300, verify_certs=args.insecure, ca_certs=args.ca_certs) # 5 minute timeout
|
||||||
|
|
||||||
# trace and save model, then upload it from temp file
|
# trace and save model, then upload it from temp file
|
||||||
with tempfile.TemporaryDirectory() as tmp_dir:
|
with tempfile.TemporaryDirectory() as tmp_dir:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user