How to use the spidermon.monitors.order function in spidermon

To help you get started, we’ve selected a few spidermon examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github scrapinghub / spidermon / tests / fixtures / ordering.py View on Github external
class Unordered:
    class A(DummyMonitor):
        pass

    class B(DummyMonitor):
        pass

    class C(DummyMonitorSuite):
        pass

    class D(DummyMonitorSuite):
        pass


class Ordered:
    @monitors.order(1)
    class A(DummyMonitor):
        pass

    @monitors.order(2)
    class B(DummyMonitor):
        pass

    @monitors.order(3)
    class C(DummyMonitorSuite):
        pass

    @monitors.order(4)
    class D(DummyMonitorSuite):
        pass
github scrapinghub / spidermon / tests / fixtures / ordering.py View on Github external
class B(DummyMonitor):
        pass

    class C(DummyMonitorSuite):
        pass

    class D(DummyMonitorSuite):
        pass


class Ordered:
    @monitors.order(1)
    class A(DummyMonitor):
        pass

    @monitors.order(2)
    class B(DummyMonitor):
        pass

    @monitors.order(3)
    class C(DummyMonitorSuite):
        pass

    @monitors.order(4)
    class D(DummyMonitorSuite):
        pass


# ----------------------------------
# Methods ordering
# ----------------------------------
class UnorderedMethodsMonitor(Monitor):
github scrapinghub / spidermon / tests / fixtures / ordering.py View on Github external
class Ordered:
    @monitors.order(1)
    class A(DummyMonitor):
        pass

    @monitors.order(2)
    class B(DummyMonitor):
        pass

    @monitors.order(3)
    class C(DummyMonitorSuite):
        pass

    @monitors.order(4)
    class D(DummyMonitorSuite):
        pass


# ----------------------------------
# Methods ordering
# ----------------------------------
class UnorderedMethodsMonitor(Monitor):
    def test_a(self):
        pass

    def test_b(self):
        pass

    def test_c(self):
        pass
github scrapinghub / spidermon / examples / example_01.py View on Github external
'kafka/sources_sent': 29774,
    'memusage/max': 269193216,
    'memusage/startup': 55193600,
    'request_depth_max': 1,
    'response_received_count': 32931,
    'scheduler/dequeued': 66817,
    'scheduler/dequeued/disk': 63795,
    'scheduler/dequeued/memory': 3022,
    'scheduler/enqueued': 66817,
    'scheduler/enqueued/disk': 63795,
    'scheduler/enqueued/memory': 3022,
    'start_time': datetime.datetime(2015, 4, 29, 10, 38, 49, 717771)
}


@monitors.order(3)
class SpiderMonitor(StatsMonitor):
    """Spider stats monitor"""

    @monitors.name('Crawl duration')
    @monitors.level.high
    @monitors.order(1)
    def test_crawl_duration(self):
        """Ensures that crawl hasn't take too long."""
        pass

    @monitors.name('Requests vs responses')
    @monitors.order(2)
    def test_crawl_requests_vs_responses(self):
        """Checks that most of the requests have a response."""
        pass
github scrapinghub / spidermon / examples / example_01.py View on Github external
    @monitors.order(3)
    def test_finish_reason(self):
        """Ensures that the spider has finished correctly."""
        pass