Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
brianrodri committed Jul 8, 2021
1 parent c45ac4e commit 1daef35
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
10 changes: 6 additions & 4 deletions jobs/batch_jobs/index_all_activities_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class IndexAllActivitiesJob(base_jobs.JobBase):

def run(self):
exp_summary_query = exp_models.ExpSummaryModel.query(
exp_models.ExpSummaryModel.deleted == False)
exp_models.ExpSummaryModel.deleted == False) # pylint: disable=singleton-comparison
exp_summary_models = (
self.pipeline
| 'Get all ExpSummaryModels' >> ndb_io.GetModels(
Expand All @@ -45,15 +45,15 @@ def run(self):

collection_summary_query = (
collection_models.CollectionSummaryModel.query(
collection_models.CollectionSummaryModel.deleted == False))
collection_models.CollectionSummaryModel.deleted == False)) # pylint: disable=singleton-comparison
collection_summary_models = (
self.pipeline
| 'Get all CollectionSummaryModels' >> ndb_io.GetModels(
collection_summary_query, self.datastoreio_stub)
)

exp_summary_models | beam.ParDo(IndexExplorationSummary())
collection_summary_models | beam.ParDo(IndexCollectionSummary())
_ = exp_summary_models | beam.ParDo(IndexExplorationSummary())
_ = collection_summary_models | beam.ParDo(IndexCollectionSummary())

return (
(exp_summary_models, collection_summary_models)
Expand All @@ -65,12 +65,14 @@ def run(self):


class IndexExplorationSummary(beam.DoFn):
"""Indexes an input ExpSummaryModel."""

def process(self, exp_summary_model):
search_services.index_exploration_summaries([exp_summary_model])


class IndexCollectionSummary(beam.DoFn):
"""Indexes an input CollectionSummaryModel."""

def process(self, collection_summary_model):
search_services.index_collection_summaries([collection_summary_model])
8 changes: 2 additions & 6 deletions jobs/batch_jobs/index_all_activities_jobs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,21 @@
from __future__ import absolute_import # pylint: disable=import-only-modules
from __future__ import unicode_literals # pylint: disable=import-only-modules

import itertools
import multiprocessing

from core.domain import activity_jobs_one_off
from core.domain import collection_domain
from core.domain import collection_services
from core.domain import exp_domain
from core.domain import exp_services
from core.domain import rights_manager
from core.domain import search_services
from core.domain import taskqueue_services
from core.domain import user_services
from core.platform import models
from core.tests import test_utils
from jobs import job_test_utils
from jobs.batch_jobs import index_all_activities_jobs
from jobs.types import job_run_result
import python_utils
import utils

platform_search_services = models.Registry.import_search_services()

Expand Down Expand Up @@ -78,8 +74,8 @@ def test_standard_operation(self):
rights_manager.publish_collection(self.owner, collection_id)
multiprocessing_dict[collection_id] = False

def mock_index_activity_summaries(models):
for model in models:
def mock_index_activity_summaries(model_list):
for model in model_list:
multiprocessing_dict[model.id] = True

swap_exp_indexer = self.swap(
Expand Down

0 comments on commit 1daef35

Please sign in to comment.