https://dagster.io/ logo
#ask-ai
Title
# ask-ai
p

Paul Herzog

03/09/2024, 7:51 PM
@Scout is there any way i can produce multiple outs from multi_asset but specificy the SpecificPartitions for each output? @multi_asset(compute_kind="python", partitions_def=teamtailor_partition_defintion_by_project_id, outs = { "fresh_published_job_data": AssetOut(is_required=False, partition_mapping=SpecificPartitionsPartitionMapping([hello_jobs_api_key])), "no_longer_published_job_data": AssetOut(is_required=False), "all_job_data": AssetOut(is_required=False) }, can_subset=True) t
s

Scout

03/09/2024, 7:51 PM
There was an error processing your request. Please try again.
The documentation provides an example of using
@multi_asset
with
AssetOut
to define multiple assets, but it does not explicitly cover the scenario of specifying
SpecificPartitions
for each output within a
@multi_asset
decorator. However, the documentation does mention the use of
partition_mapping
as a parameter for
AssetOut
, which allows you to specify how partitions of the output asset relate to partitions of its upstream assets. The
SpecificPartitionsPartitionMapping
is a type of partition mapping that could be used to map to specific partitions, but the documentation does not provide a detailed example of how to use
SpecificPartitionsPartitionMapping
within the context of
@multi_asset
. Given the lack of explicit documentation on this specific use case, it's recommended to refer to the Dagster API reference for the latest information on
AssetOut
and partition mappings, or to explore the source code and tests for examples of usage that might not be covered in the documentation. If you're looking to specify different partitioning strategies for each output of a
@multi_asset
, you might need to define a custom partition mapping that aligns with your requirements. If the documentation or API reference does not provide enough guidance, consider reaching out to the Dagster community or support channels for further assistance.
p

Paul Herzog

03/09/2024, 7:52 PM
i got this error TypeError: AssetOut.__new__() got an unexpected keyword argument 'partition_mapping' @Scout
s

Scout

03/09/2024, 7:52 PM
The error message you're encountering indicates that the
AssetOut
class does not accept a
partition_mapping
keyword argument, which suggests that the way you're trying to specify the partition mapping is not correct according to the current API. In Dagster, partition mappings are used to describe the relationship between the partitions of different assets. However, based on the error message, it seems that the
AssetOut
class does not directly take a
partition_mapping
parameter in its constructor. To resolve this issue, you should ensure that you are using the correct parameters and API according to the version of Dagster you are using. The API and its parameters can change between versions, so it's important to refer to the documentation that matches the version of Dagster you have installed. If you are following an example or a pattern from the documentation or another source, double-check that the example is up-to-date and compatible with your version of Dagster. If the documentation does not provide clarity, you may need to look at the source code or API reference for the version of Dagster you are using to understand the correct usage. Since the
partition_mapping
parameter is not accepted by
AssetOut
, you may need to look for alternative ways to specify partition mappings for your assets. This could involve using a different parameter or a different approach altogether. If you continue to have trouble, consider reaching out to the Dagster community for support, as they may be able to provide more specific guidance based on your use case and the version of Dagster you are using.