Esempio n. 1
0
    def test_post_job_draws_hierarchy(self):
        post_job(fixture_flow_factory, hierarchy=True)

        self.draw_hierarchy.assert_called_once_with(fixture_flow_factory,
                                                    store=None,
                                                    factory_args=None,
                                                    factory_kwargs=None)
Esempio n. 2
0
    def test_post_job_draws_hierarchy_with_specified_store(self):
        expected_store = {'some_key': 'some_value'}

        post_job(fixture_flow_factory, store=expected_store, hierarchy=True)

        self.draw_hierarchy.assert_called_once_with(fixture_flow_factory,
                                                    store=expected_store,
                                                    factory_args=None,
                                                    factory_kwargs=None)
Esempio n. 3
0
    def test_post_job_performs_post(self):
        post_job(fixture_flow_factory)

        self.perform_post.assert_called_once_with(
            self.ensure_logbook_exists.return_value,
            fixture_flow_factory,
            store=None,
            factory_args=None,
            factory_kwargs=None,
            capabilities=set())
Esempio n. 4
0
    def test_post_job_draws_hierarchy_with_specified_factory_args(self):
        expected_args = [True, False, 'blabla']

        post_job(fixture_flow_factory,
                 factory_args=expected_args,
                 hierarchy=True)

        self.draw_hierarchy.assert_called_once_with(fixture_flow_factory,
                                                    store=None,
                                                    factory_args=expected_args,
                                                    factory_kwargs=None)
Esempio n. 5
0
def run_webserver(port=8080, hierarchy=False):
    """
    Post a job to run a basic webserver to the job board
    :param int port: The port to use for the webserver
    :param bool hierarchy: Print the execution graph
    of the flow that would be posted
    :return None:
    """
    post_job(simple_http_server_flow_factory,
             hierarchy=hierarchy,
             store={'port': port},
             capabilities={'port_is_free'})
Esempio n. 6
0
    def test_post_job_performs_post_job_with_specified_capabilities(self):
        expected_capabilities = {'is_x86_64', 'is_ubuntu'}

        post_job(fixture_flow_factory, capabilities=expected_capabilities)

        self.perform_post.assert_called_once_with(
            self.ensure_logbook_exists.return_value,
            fixture_flow_factory,
            store=None,
            factory_args=None,
            factory_kwargs=None,
            capabilities=expected_capabilities)
Esempio n. 7
0
    def test_post_job_performs_post_with_specified_factory_kwargs(self):
        expected_kwargs = {'some_param': True, 'some_other_param': 'blabla'}

        post_job(fixture_flow_factory, factory_kwargs=expected_kwargs)

        self.perform_post.assert_called_once_with(
            self.ensure_logbook_exists.return_value,
            fixture_flow_factory,
            store=None,
            factory_args=None,
            factory_kwargs=expected_kwargs,
            capabilities=set())
Esempio n. 8
0
    def test_post_job_performs_post_with_specified_store(self):
        expected_store = {'some_key': 'some_value'}

        post_job(fixture_flow_factory, store=expected_store)

        self.perform_post.assert_called_once_with(
            self.ensure_logbook_exists.return_value,
            fixture_flow_factory,
            store=expected_store,
            factory_args=None,
            factory_kwargs=None,
            capabilities=set())
Esempio n. 9
0
    def test_post_job_draws_hierarchy_with_specified_factory_kwargs(self):
        expected_kwargs = {'some_param': True, 'some_other_param': 'blabla'}

        post_job(fixture_flow_factory,
                 factory_kwargs=expected_kwargs,
                 hierarchy=True)

        self.draw_hierarchy.assert_called_once_with(
            fixture_flow_factory,
            store=None,
            factory_args=None,
            factory_kwargs=expected_kwargs)
Esempio n. 10
0
def download_videos(channels_file, hierarchy=False):
    """
    Post a job to downloads the latest youtube videos of specified channels
    :param str channels_file: Path to a file containing a list of channels
    :param bool hierarchy: Print the execution graph
    of the flow that would be posted
    :return None:
    """
    with open(channels_file) as f:
        channels = [l.strip() for l in f.readlines()]

    post_job(
        youtube_dl_flow_factory,
        hierarchy=hierarchy,
        factory_args=[channels]
    )
Esempio n. 11
0
    def test_post_job_ensures_logbook_exists(self):
        post_job(fixture_flow_factory)

        self.ensure_logbook_exists.assert_called_once_with()