示例#1
0
    def __init__(self,
                 instance,
                 service_url,
                 api_key,
                 network,
                 feed_publisher=DEFAULT_INSTANT_SYSTEM_FEED_PUBLISHER,
                 rating_scale_min=None,
                 rating_scale_max=None,
                 timeout=2):
        self.instance = instance
        self.service_url = service_url
        self.api_key = api_key
        self.network = network
        self.rating_scale_min = rating_scale_min
        self.rating_scale_max = rating_scale_max
        self.system_id = 'Instant System'
        self.timeout = timeout
        self.feed_publisher = None if feed_publisher is None else RsFeedPublisher(
            **feed_publisher)

        self.journey_metadata = rsj.MetaData(
            system_id=self.system_id,
            network=self.network,
            rating_scale_min=self.rating_scale_min,
            rating_scale_max=self.rating_scale_max)

        self.logger = logging.getLogger("{} {}".format(__name__,
                                                       self.system_id))

        self.breaker = pybreaker.CircuitBreaker(
            fail_max=app.config['CIRCUIT_BREAKER_MAX_INSTANT_SYSTEM_FAIL'],
            reset_timeout=app.
            config['CIRCUIT_BREAKER_INSTANT_SYSTEM_TIMEOUT_S'])
示例#2
0
    def __init__(
        self,
        service_url,
        api_key,
        network,
        feed_publisher=DEFAULT_BLABLALINES_FEED_PUBLISHER,
        timedelta=3600,
        timeout=2,
    ):
        self.service_url = service_url
        self.api_key = api_key
        self.network = network
        self.system_id = 'blablalines'
        self.timeout = timeout
        self.timedelta = timedelta
        self.feed_publisher = None if feed_publisher is None else RsFeedPublisher(
            **feed_publisher)

        self.logger = logging.getLogger("{} {}".format(__name__,
                                                       self.system_id))

        self.breaker = pybreaker.CircuitBreaker(
            fail_max=app.config.get(
                str('CIRCUIT_BREAKER_MAX_BLABLALINES_FAIL'), 4),
            reset_timeout=app.config.get(
                str('CIRCUIT_BREAKER_BLABLALINES_TIMEOUT_S'), 60),
        )
        self.call_params = ''

        self.journey_metadata = rsj.MetaData(system_id=self.system_id,
                                             network=self.network,
                                             rating_scale_min=None,
                                             rating_scale_max=None)
示例#3
0
文件: klaxit.py 项目: pbench/navitia
    def __init__(
        self,
        service_url,
        api_key,
        network,
        feed_publisher=DEFAULT_KLAXIT_FEED_PUBLISHER,
        timedelta=3600,
        timeout=2,
        departure_radius=2,
        arrival_radius=2,
        rating_scale_min=None,
        rating_scale_max=None,
    ):
        self.service_url = service_url
        self.api_key = api_key
        self.network = network
        self.system_id = 'klaxit'
        self.timeout = timeout
        self.timedelta = timedelta
        self.departure_radius = departure_radius
        self.arrival_radius = arrival_radius
        self.rating_scale_min = rating_scale_min
        self.rating_scale_max = rating_scale_max
        self.feed_publisher = None if feed_publisher is None else RsFeedPublisher(
            **feed_publisher)

        self.journey_metadata = rsj.MetaData(
            system_id=self.system_id,
            network=self.network,
            rating_scale_min=self.rating_scale_min,
            rating_scale_max=self.rating_scale_max,
        )

        self.logger = logging.getLogger("{} {}".format(__name__,
                                                       self.system_id))

        self.breaker = pybreaker.CircuitBreaker(
            fail_max=app.config.get(str('CIRCUIT_BREAKER_MAX_KLAXIT_FAIL'), 4),
            reset_timeout=app.config.get(
                str('CIRCUIT_BREAKER_KLAXIT_TIMEOUT_S'), 60),
        )
        self.call_params = ''
示例#4
0
    def __init__(
        self,
        service_url,
        api_key,
        network,
        feed_publisher=DEFAULT_INSTANT_SYSTEM_FEED_PUBLISHER,
        rating_scale_min=None,
        rating_scale_max=None,
        timeout=5,
        crowfly_radius=200,
        timeframe_duration=1800,
    ):
        self.service_url = service_url
        self.api_key = api_key
        self.network = network
        self.rating_scale_min = rating_scale_min
        self.rating_scale_max = rating_scale_max
        self.system_id = 'instant_system'
        self.timeout = timeout
        self.feed_publisher = None if feed_publisher is None else RsFeedPublisher(
            **feed_publisher)
        self.crowfly_radius = crowfly_radius
        self.timeframe_duration = timeframe_duration

        self.journey_metadata = rsj.MetaData(
            system_id=self.system_id,
            network=self.network,
            rating_scale_min=self.rating_scale_min,
            rating_scale_max=self.rating_scale_max,
        )

        self.logger = logging.getLogger("{} {}".format(__name__,
                                                       self.system_id))

        self.breaker = pybreaker.CircuitBreaker(
            fail_max=app.config.get(
                str('CIRCUIT_BREAKER_MAX_INSTANT_SYSTEM_FAIL'), 4),
            reset_timeout=app.config.get(
                str('CIRCUIT_BREAKER_INSTANT_SYSTEM_TIMEOUT_S'), 60),
        )
        self.call_params = ''