Exemple #1
0
def get_beam_jobs():
    """Returns the list of all registered Apache Beam jobs.

    Returns:
        list(BeamJob). The list of registered Apache Beam jobs.
    """
    return [beam_job_domain.BeamJob(j) for j in jobs_registry.get_all_jobs()]
Exemple #2
0
    def test_get_all_jobs_returns_value_from_job_metaclass(self):
        unique_obj = object()

        @classmethod
        def get_all_jobs_mock(unused_cls):
            """Returns the unique_obj."""
            return unique_obj

        get_all_jobs_swap = self.swap(base_jobs._JobMetaclass, 'get_all_jobs',
                                      get_all_jobs_mock)  # pylint: disable=protected-access

        with get_all_jobs_swap:
            self.assertIs(registry.get_all_jobs(), unique_obj)
Exemple #3
0
    def test_get_all_jobs_returns_value_from_job_metaclass(self) -> None:
        unique_obj = object()

        @classmethod  # type: ignore[misc]
        def get_all_jobs_mock(
                unused_cls: Type[base_jobs.JobMetaclass]) -> object:
            """Returns the unique_obj."""
            return unique_obj

        get_all_jobs_swap = self.swap(base_jobs.JobMetaclass, 'get_all_jobs',
                                      get_all_jobs_mock)

        with get_all_jobs_swap:
            self.assertIs(registry.get_all_jobs(), unique_obj)
Exemple #4
0
 def test_get_all_jobs_never_returns_an_empty_list(self):
     self.assertNotEqual(registry.get_all_jobs(), [])