Project

Profile

Help

Issue #7147

closed

AttributeError: 'Package' object has no attribute '_remote_artifact_saver_cas'

Added by ttereshc over 4 years ago. Updated about 4 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Category:
-
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 83
Quarter:

Description

To reproduce, in pulp 2:

Observe the error below.

Jul 15 12:21:58 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[18841]: Traceback (most recent call last):
Jul 15 12:21:58 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[18841]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/worker.py", line 886, in perform_job
Jul 15 12:21:58 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[18841]: rv = job.perform()
Jul 15 12:21:58 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[18841]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py", line 664, in perform
Jul 15 12:21:58 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[18841]: self._result = self._execute()
Jul 15 12:21:58 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[18841]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py", line 670, in _execute
Jul 15 12:21:58 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[18841]: return self.func(*self.args, **self.kwargs)
Jul 15 12:21:58 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[18841]: File "/home/vagrant/devel/pulp-2to3-migration/pulp_2to3_migration/app/tasks/migrate.py", line 127, in migrate_from_pulp2
Jul 15 12:21:58 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[18841]: migrate_content(plan)
Jul 15 12:21:58 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[18841]: File "/home/vagrant/devel/pulp-2to3-migration/pulp_2to3_migration/app/migration.py", line 34, in migrate_content
Jul 15 12:21:58 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[18841]: plugin.migrator.migrate_content_to_pulp3()
Jul 15 12:21:58 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[18841]: File "/home/vagrant/devel/pulp-2to3-migration/pulp_2to3_migration/app/plugin/rpm/migrator.py", line 140, in migrate_content_to_pulp3
Jul 15 12:21:58 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[18841]: loop.run_until_complete(dm.create())
Jul 15 12:21:58 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[18841]: File "/usr/lib64/python3.6/asyncio/base_events.py", line 484, in run_until_complete
Jul 15 12:21:58 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[18841]: return future.result()
Jul 15 12:21:58 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[18841]: File "/home/vagrant/devel/pulp-2to3-migration/pulp_2to3_migration/app/plugin/content.py", line 84, in create
Jul 15 12:21:58 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[18841]: await pipeline
Jul 15 12:21:58 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[18841]: File "/home/vagrant/devel/pulpcore/pulpcore/plugin/stages/api.py", line 225, in create_pipeline
Jul 15 12:21:58 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[18841]: await asyncio.gather(*futures)
Jul 15 12:21:58 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[18841]: File "/home/vagrant/devel/pulpcore/pulpcore/plugin/stages/api.py", line 43, in __call__
Jul 15 12:21:58 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[18841]: await self.run()
Jul 15 12:21:58 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[18841]: File "/home/vagrant/devel/pulpcore/pulpcore/plugin/stages/artifact_stages.py", line 225, in run
Jul 15 12:21:58 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[18841]: RemoteArtifact.objects.bulk_get_or_create(self._needed_remote_artifacts(batch))
Jul 15 12:21:58 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[18841]: File "/home/vagrant/devel/pulpcore/pulpcore/plugin/stages/artifact_stages.py", line 264, in _needed_remote_artifacts
Jul 15 12:21:58 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[18841]: for content_artifact in d_content.content._remote_artifact_saver_cas:
Jul 15 12:21:58 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[18841]: AttributeError: 'Package' object has no attribute '_remote_artifact_saver_cas'

Observations:

  • there are almost duplicated declarative content units in a batch which only differ by remote (that's expected, if one content unit has multiple LCE in pulp2)
  • If I ignore the exception and proceed to the next d_content here , I see that the even batches are failing and the odd ones are correct. E.g. batch#1 won't raise AttributeError, all content in the batch#2 will, batch#3 will work fine, batch#4 will raise AttributeError.

Related issues

Related to Pulp - Backport #7702: Backport Request: 7147 (AttributeError: 'Package' object has no attribute '_remote_artifact_saver_cas') to 3.7CLOSED - CURRENTRELEASEttereshc

Actions
Actions #1

Updated by ttereshc over 4 years ago

  • Description updated (diff)
Actions #2

Updated by ttereshc over 4 years ago

  • Project changed from Migration Plugin to Pulp
Actions #3

Updated by ttereshc over 4 years ago

  • Description updated (diff)
Actions #4

Updated by fao89 over 4 years ago

  • Triaged changed from No to Yes
  • Sprint set to Sprint 78
Actions #5

Updated by rchan over 4 years ago

  • Sprint changed from Sprint 78 to Sprint 79
Actions #6

Updated by rchan over 4 years ago

  • Sprint changed from Sprint 79 to Sprint 80
Actions #7

Updated by rchan over 4 years ago

  • Sprint changed from Sprint 80 to Sprint 81
Actions #8

Updated by rchan over 4 years ago

  • Sprint changed from Sprint 81 to Sprint 82
Actions #9

Updated by dkliban@redhat.com about 4 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to dkliban@redhat.com
Actions #10

Updated by pulpbot about 4 years ago

  • Status changed from ASSIGNED to POST
Actions #11

Updated by rchan about 4 years ago

  • Sprint changed from Sprint 82 to Sprint 83

Added by dkliban@redhat.com about 4 years ago

Revision 8dcdcd2d | View on GitHub

Handles duplicate content in the stages API.

If the very first Content in a batch has already been prefetched in a previous call to prefetch_related_objects, Django does not set the attribute specified in 'to_attr' when prefetching the rest of the items in the batch. As a result, the '_remote_artifact_saver_cas' attribute is not set on the Content instances and AttributeError is raised when '_remote_artifact_saver_cas' is accessed by the RemoteArtifactSaverStage.

This patch removes any existing '_remote_artifact_saver_cas' attributes on Content before calling into Django's prefetch_related_objects().

fixes: #7147 https://pulp.plan.io/issues/7147

Actions #12

Updated by dkliban@redhat.com about 4 years ago

  • Status changed from POST to MODIFIED
Actions #13

Updated by jsherril@redhat.com about 4 years ago

  • Related to Backport #7702: Backport Request: 7147 (AttributeError: 'Package' object has no attribute '_remote_artifact_saver_cas') to 3.7 added
Actions #14

Updated by ttereshc about 4 years ago

  • Sprint/Milestone set to 3.8.0
Actions #15

Updated by pulpbot about 4 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Also available in: Atom PDF