def set_run_lineage(run: BaseRun, artifacts_by_keys: Dict, query: Any): artifacts_to_link = (get_artifact_model().objects.filter(query).only( "id", "name", "state")) lineage_model = get_lineage_model() for m in artifacts_to_link: lineage_model.objects.get_or_create( artifact_id=m.id, run_id=run.id, is_input=artifacts_by_keys[(m.name, m.state)].is_input, )
# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from coredb.abstracts.getter import get_lineage_model lineage_model = get_lineage_model() artifacts_names = lineage_model.objects.prefetch_related("artifact").only( "artifact__id", "artifact__name" ) artifacts = lineage_model.objects.prefetch_related("artifact").only( "is_input", "artifact__id", "artifact__name", "artifact__kind", "artifact__path", "artifact__summary", ) project_runs_artifacts = ( lineage_model.objects.prefetch_related("artifact")
class Meta: model = get_lineage_model() fields = ("name", "kind", "is_input")
class Meta: model = get_lineage_model() fields = ("name",)
class Meta: model = get_lineage_model() fields = ("name", "kind", "path", "summary", "state", "is_input")