wildlife-dynamics / ecoscope-workflows

An extensible task specification and compiler for local and distributed workflows.
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Unit test failure: get_subjectgroup_observations #53

Open Yun-Wu opened 2 days ago

Yun-Wu commented 2 days ago
tmp_path = PosixPath('/private/var/folders/b8/nns96jhx4j7222yjslzrhnnc0000gn/T/pytest-of-yunwu/pytest-6/test_consumes_and_or_produces_0')

    @pytest.mark.parametrize(
        "tf",
        task_fixtures.values(),
        ids=task_fixtures.keys(),
    )
    def test_consumes_and_or_produces_dataframe(
        tf: TaskFixture,
        tmp_path: Path,
    ):
        args = (
            (gpd.read_parquet(tf.example_input_dataframe_path),)
            if tf.example_input_dataframe_path
            else ()  # io tasks don't have input dataframes
        )
>       in_memory = tf.task(*args, **tf.kws)

tests/test_tasks.py:149: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
ecoscope_workflows/decorators.py:123: in __call__
    else func_copy(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

client = 'MEP_DEV', subject_group_name = 'Elephants', include_inactive = True
since = datetime.datetime(2011, 1, 1, 0, 0)
until = datetime.datetime(2023, 1, 1, 0, 0)

    @distributed(tags=["io"])
    def get_subjectgroup_observations(
        client: EarthRangerClient,
        subject_group_name: Annotated[
            str, Field(description="Name of EarthRanger Subject")
        ],
        include_inactive: Annotated[
            bool,
            Field(description="Whether or not to include inactive subjects"),
        ],
        since: Annotated[datetime, Field(description="Start date")],
        until: Annotated[datetime, Field(description="End date")],
    ) -> DataFrame[SubjectGroupObservationsGDFSchema]:
        """Get observations for a subject group from EarthRanger."""
>       return client.get_subjectgroup_observations(
            subject_group_name=subject_group_name,
            include_subject_details=True,
            include_inactive=include_inactive,
            since=since,
            until=until,
        )
E       AttributeError: 'str' object has no attribute 'get_subjectgroup_observations'

ecoscope_workflows/tasks/io/_earthranger.py:42: AttributeError