Washington de Carvalho Segundo

11 papers C 1Journal 4Unranked 6
YearRankTypeTitle / Venue / Authors
2022 conf
CRIS
Vivian S. Silva, Lautaro Matas, Tales Moreira, Washington de Carvalho Segundo
2021 J jnl
Math. Struct. Comput. Sci.
Mauricio Ayala-Rincón, Washington de Carvalho Segundo, Maribel Fernández, Gabriel Ferreira Silva, Daniele Nantes-Sobrinho
2021 conf
ICEIS (1)
Gabriel Madeira, Eduardo N. Borges, Giancarlo Lucca, Washington de Carvalho Segundo, Jonata C. Wieczynski, Hélida S. Santos, Graçaliz Pereira Dimuro
2020 J jnl
Publ.
Lucca de Farias Ramalho, Washington de Carvalho Segundo
2019 J jnl
Theor. Comput. Sci.
Mauricio Ayala-Rincón, Washington de Carvalho Segundo, Maribel Fernández, Daniele Nantes-Sobrinho, Ana Cristina Rocha Oliveira
2018 conf
LSFA
Mauricio Ayala-Rincón, Washington de Carvalho Segundo, Maribel Fernández, Daniele Nantes-Sobrinho
2017 C conf
LOPSTR
Mauricio Ayala-Rincón, Washington de Carvalho Segundo, Maribel Fernández, Daniele Nantes-Sobrinho
2017 J jnl
CoRR
Mauricio Ayala-Rincón, Washington de Carvalho Segundo, Maribel Fernández, Daniele Nantes-Sobrinho
2017 conf
FroCoS
Mauricio Ayala-Rincón, Washington de Carvalho Segundo, Maribel Fernández, Daniele Nantes-Sobrinho
2016 conf
LSFA
Mauricio Ayala-Rincón, Washington de Carvalho Segundo, Maribel Fernández, Daniele Nantes-Sobrinho
2014 conf
CICM Workshops
Washington de Carvalho Segundo, Flávio L. C. de Moura, Daniel Ventura
redb/utils/push_to_elastic.py
← Index redb/utils/push_to_elastic.py python
import json
import os
#from redb.settings import elasticsearch as es
from elasticsearch import Elasticsearch
from dataclasses import asdict
from dotenv import load_dotenv

class Utils():
    """
    Utility class for pushing

    """
    @staticmethod
    def push_to_elastic(sample_dict):
        """
        Pushes the sample_dict to elastic search
        """
        load_dotenv()
        ELASTIC_ENDPOINT = os.getenv("ELASTIC_HOST")
        ELASTIC_ENFORCE_SSL = os.getenv("ELASTIC_ENFORCE_SSL", False) == "True"
        ELASTIC_USER = os.getenv("ELASTIC_USER")
        ELASTIC_PASSWORD = os.getenv("ELASTIC_PASSWORD")
        ELASTIC_BINARIES_COLLECTION = os.getenv(
            "ELASTIC_BINARIES_COLLECTION", "redb_test"
        )
        es = Elasticsearch(
            ELASTIC_ENDPOINT,
            verify_certs=ELASTIC_ENFORCE_SSL,
            basic_auth=(ELASTIC_USER, ELASTIC_PASSWORD),
            maxsize=20,
            retry_on_timeout=True,
            timeout=30,
        )

        try:
            dict_dump = json.dumps(sample_dict)
        except Exception as e:
            print(f"Error: {e}")
            return False
        elastic = es.index(index=ELASTIC_BINARIES_COLLECTION, body=dict_dump)
        return True
    
    def push_to_index(sample_dict, index_name):
        """
        Pushes the sample_dict to elastic search
        """
        load_dotenv()
        ELASTIC_ENDPOINT = os.getenv("ELASTIC_HOST")
        ELASTIC_ENFORCE_SSL = os.getenv("ELASTIC_ENFORCE_SSL", False) == "True"
        ELASTIC_USER = os.getenv("ELASTIC_USER")
        ELASTIC_PASSWORD = os.getenv("ELASTIC_PASSWORD")
        ELASTIC_BINARIES_COLLECTION = index_name
        
        es = Elasticsearch(
            ELASTIC_ENDPOINT,
            verify_certs=ELASTIC_ENFORCE_SSL,
            basic_auth=(ELASTIC_USER, ELASTIC_PASSWORD),
            maxsize=20,
            retry_on_timeout=True,
            timeout=30,
        )

        try:
            dict_dump = json.dumps(sample_dict)
        except Exception as e:
            print(f"Error: {e}")
            return False
        elastic = es.index(index=ELASTIC_BINARIES_COLLECTION, body=dict_dump)
        return True