Getting a results artifact from a pipeline

Hi all,

I'm struggling specific with a pipeline issue. I've got a ffunction that I think is similar to the core metrics function following the same syntax:

The function gets registered as a plugin, theoretically.

I've got a test with synthetic data:

But, when i run the test, i get a type error:

Traceback (most recent call last):
  File "test_plugin_setup.py", line 144, in test_sidle_reconstruction
    results = sidle.sidle_reconstruction(
  File "<decorator-gen-611>", line 2, in sidle_reconstruction
  File "/Users/jusdeb/miniconda3/envs/qiime2-2021.8-dev/lib/python3.8/site-packages/qiime2/sdk/action.py", line 245, in bound_callable
    outputs = self._callable_executor_(scope, callable_args,
  File "/Users/jusdeb/miniconda3/envs/qiime2-2021.8-dev/lib/python3.8/site-packages/qiime2/sdk/action.py", line 490, in _callable_executor_
    raise TypeError("Pipelines must return `Result` objects, "
TypeError: Pipelines must return `Result` objects, not <class 'qiime2.sdk.results.Results'>

Im probably missing something totally obvious, but Im not sure what it is.

Thanks!

1 Like

Hey @jwdebelius! This is a great question.

QIIME 2 Actions return Results objects, which is basically just a fancy tuple - this container has one or more Result objects - Result is an Artifact or a Visualization.

In your new pipeline you've got two separate lines that don't unpack that tuple:

One really simple way to resolve the issue is to actually just append a , after each assignment variable, like here:

I think once you do that you should be in good shape, but let me know! This is a common stumbling block, we should probably think about a new way to report the errors here, because this also crops up in the Artifact API pretty often, too (different error, same general idea).

:qiime2:

3 Likes

Thanks @thermokarst! That worked perfectly :tada:

1 Like