1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-28 10:55:30 +03:00

Fix various errors when trying to run make bulk_data.

- Properly import PrimoridialModel.
- Use floor division operator for range() method to avoid float vs int errors.
This commit is contained in:
Kia Lam 2019-02-22 11:59:18 -05:00
parent c1698fff8e
commit 0943f989ce
No known key found for this signature in database
GPG Key ID: 294F9BE53C241D03

View File

@ -40,10 +40,13 @@ from django.db import transaction # noqa
# awx
from awx.main.models import ( # noqa
Credential, CredentialType, Group, Host, Inventory, Job, JobEvent,
JobHostSummary, JobTemplate, Label, Organization, PrimordialModel, Project,
JobHostSummary, JobTemplate, Label, Organization, Project,
Team, User, WorkflowJobTemplate, WorkflowJobTemplateNode,
batch_role_ancestor_rebuilding,
)
from awx.main.models.base import PrimordialModel
from awx.main.signals import ( # noqa
disable_activity_stream,
disable_computed_fields
@ -695,7 +698,7 @@ def make_the_data():
continue
# Bulk create in chunks with maximum chunk size
MAX_BULK_CREATE = 100
for j in range((n / MAX_BULK_CREATE) + 1):
for j in range((n // MAX_BULK_CREATE) + 1):
n_subgroup = MAX_BULK_CREATE
if j == n / MAX_BULK_CREATE:
# on final pass, create the remainder