Repository: oppia/oppia

Issue:
Remove "GetNumberOfExpExceedsMaxTitleLengthJob" after the fix.
Have to remove `GetNumberOfExpExceedsMaxTitleLengthJob` after its successful run on our dataset as now we have frontend validation so no new data will be generated which will have an exploration title length of more than 36.


Discussion:
@lkbhitesh07 What are the next steps here?
Hey @vojtechjelinek,
Sorry for the delay, It somehow slipped, I'll do this right away. Thanks for reminding me.


Resolving patch:
diff --git a/core/jobs/batch_jobs/exp_title_validation_jobs.py b/core/jobs/batch_jobs/exp_title_validation_jobs.py
deleted file mode 100644
--- a/core/jobs/batch_jobs/exp_title_validation_jobs.py
+++ /dev/null
@@ -1,90 +0,0 @@
-
-# coding: utf-8
-#
-# Copyright 2022 The Oppia Authors. All Rights Reserved.
-#
-# 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.
-
-"""Validation Jobs for title exploration"""
-
-from __future__ import annotations
-
-from core.domain import exp_fetchers
-from core.jobs import base_jobs
-from core.jobs.io import ndb_io
-from core.jobs.transforms import job_result_transforms
-from core.jobs.types import job_run_result
-from core.platform import models
-
-import apache_beam as beam
-
-(exp_models, ) = models.Registry.import_models([models.NAMES.exploration])
-
-
-# TODO(#14943): Remove this job after we fix the exploration titles length.
-class GetNumberOfExpExceedsMaxTitleLengthJob(base_jobs.JobBase):
-    """Job that returns exploration having title length more than 36."""
-
-    def run(self) -> beam.PCollection[job_run_result.JobRunResult]:
-        """Returns PCollection of invalid explorations with their id and
-        actual length.
-
-        Returns:
-            PCollection. Returns PCollection of invalid explorations with
-            their id and actual length.
-        """
-        total_explorations = (
-            self.pipeline
-            | 'Get all ExplorationModels' >> ndb_io.GetModels(
-                exp_models.ExplorationModel.get_all(include_deleted=False))
-            | 'Get exploration from model' >> beam.Map(
-                exp_fetchers.get_exploration_from_model)
-        )
-
-        exp_ids_with_exceeding_max_title_len = (
-            total_explorations
-            | 'Combine exploration title and ids' >> beam.Map(
-                lambda exp: (exp.id, exp.title))
-            | 'Filter exploraton with title length greater than 36' >>
-                beam.Filter(lambda exp: len(exp[1]) > 36)
-        )
-
-        report_number_of_exps_queried = (
-            total_explorations
-            | 'Report count of exp models' >> (
-                job_result_transforms.CountObjectsToJobRunResult('EXPS'))
-        )
-
-        report_number_of_invalid_exps = (
-            exp_ids_with_exceeding_max_title_len
-            | 'Report count of invalid exp models' >> (
-                job_result_transforms.CountObjectsToJobRunResult('INVALID'))
-        )
-
-        report_invalid_ids_and_their_actual_len = (
-            exp_ids_with_exceeding_max_title_len
-            | 'Save info on invalid exps' >> beam.Map(
-                lambda objects: job_run_result.JobRunResult.as_stderr(
-                    'The id of exp is %s and its actual len is %s'
-                    % (objects[0], len(objects[1]))
-                ))
-        )
-
-        return (
-            (
-                report_number_of_exps_queried,
-                report_number_of_invalid_exps,
-                report_invalid_ids_and_their_actual_len
-            )
-            | 'Combine results' >> beam.Flatten()
-        )
diff --git a/core/jobs/registry.py b/core/jobs/registry.py
--- a/core/jobs/registry.py
+++ b/core/jobs/registry.py
@@ -56,7 +56,6 @@
 from core.jobs.batch_jobs import suggestion_stats_computation_jobs   # pylint: disable=unused-import  # isort: skip
 from core.jobs.batch_jobs import user_stats_computation_jobs         # pylint: disable=unused-import  # isort: skip
 from core.jobs.batch_jobs import math_interactions_audit_jobs        # pylint: disable=unused-import  # isort: skip
-from core.jobs.batch_jobs import exp_title_validation_jobs           # pylint: disable=unused-import  # isort: skip
 
 
 def get_all_jobs() -> List[Type[base_jobs.JobBase]]:


Test patch:
diff --git a/core/jobs/batch_jobs/exp_title_validation_jobs_test.py b/core/jobs/batch_jobs/exp_title_validation_jobs_test.py
deleted file mode 100644
--- a/core/jobs/batch_jobs/exp_title_validation_jobs_test.py
+++ /dev/null
@@ -1,140 +0,0 @@
-# coding: utf-8
-#
-# Copyright 2022 The Oppia Authors. All Rights Reserved.
-#
-# 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.
-
-"""Unit tests for jobs.batch_jobs.exp_title_validation_jobs."""
-
-from __future__ import annotations
-
-from core import feconf
-from core.constants import constants
-from core.domain import state_domain
-from core.jobs import job_test_utils
-from core.jobs.batch_jobs import exp_title_validation_jobs
-from core.jobs.types import job_run_result
-from core.platform import models
-
-(exp_models, ) = models.Registry.import_models([models.NAMES.exploration])
-
-
-class GetNumberOfExpExceedsMaxTitleLengthJobTests(
-    job_test_utils.JobTestBase):
-
-    JOB_CLASS = exp_title_validation_jobs.GetNumberOfExpExceedsMaxTitleLengthJob
-
-    EXPLORATION_ID_1 = '1'
-    EXPLORATION_ID_2 = '2'
-    EXPLORATION_ID_3 = '3'
-    STATE_1 = state_domain.State.create_default_state(
-        feconf.DEFAULT_INIT_STATE_NAME, is_initial_state=True).to_dict()
-    STATE_2 = state_domain.State.create_default_state(
-        feconf.DEFAULT_INIT_STATE_NAME, is_initial_state=True).to_dict()
-    STATE_3 = state_domain.State.create_default_state(
-        feconf.DEFAULT_INIT_STATE_NAME, is_initial_state=True).to_dict()
-
-    def setUp(self):
-        super().setUp()
-
-        # This is an invalid model with title length greater than 36.
-        self.exp_1 = self.create_model(
-            exp_models.ExplorationModel,
-            id=self.EXPLORATION_ID_1,
-            title='titleeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee',
-            init_state_name=feconf.DEFAULT_INIT_STATE_NAME,
-            category=feconf.DEFAULT_EXPLORATION_CATEGORY,
-            objective=feconf.DEFAULT_EXPLORATION_OBJECTIVE,
-            language_code=constants.DEFAULT_LANGUAGE_CODE,
-            tags=['Topic'],
-            blurb='blurb',
-            author_notes='author notes',
-            states_schema_version=feconf.CURRENT_STATE_SCHEMA_VERSION,
-            param_specs={},
-            param_changes=[],
-            auto_tts_enabled=feconf.DEFAULT_AUTO_TTS_ENABLED,
-            correctness_feedback_enabled=False,
-            states={feconf.DEFAULT_INIT_STATE_NAME: self.STATE_1}
-        )
-
-        # This is an valid model with title length lesser than 36.
-        self.exp_2 = self.create_model(
-            exp_models.ExplorationModel,
-            id=self.EXPLORATION_ID_2,
-            title='title',
-            init_state_name=feconf.DEFAULT_INIT_STATE_NAME,
-            category=feconf.DEFAULT_EXPLORATION_CATEGORY,
-            objective=feconf.DEFAULT_EXPLORATION_OBJECTIVE,
-            language_code=constants.DEFAULT_LANGUAGE_CODE,
-            tags=['Topic'],
-            blurb='blurb',
-            author_notes='author notes',
-            states_schema_version=feconf.CURRENT_STATE_SCHEMA_VERSION,
-            param_specs={},
-            param_changes=[],
-            auto_tts_enabled=feconf.DEFAULT_AUTO_TTS_ENABLED,
-            correctness_feedback_enabled=False,
-            states={feconf.DEFAULT_INIT_STATE_NAME: self.STATE_2}
-        )
-
-        # This is an invalid model with title length greater than 36.
-        self.exp_3 = self.create_model(
-            exp_models.ExplorationModel,
-            id=self.EXPLORATION_ID_3,
-            title='titleeeeeeeeeeeeeabcdefghijklmnopqrstuv',
-            init_state_name=feconf.DEFAULT_INIT_STATE_NAME,
-            category=feconf.DEFAULT_EXPLORATION_CATEGORY,
-            objective=feconf.DEFAULT_EXPLORATION_OBJECTIVE,
-            language_code=constants.DEFAULT_LANGUAGE_CODE,
-            tags=['Topic'],
-            blurb='blurb',
-            author_notes='author notes',
-            states_schema_version=feconf.CURRENT_STATE_SCHEMA_VERSION,
-            param_specs={},
-            param_changes=[],
-            auto_tts_enabled=feconf.DEFAULT_AUTO_TTS_ENABLED,
-            correctness_feedback_enabled=False,
-            states={feconf.DEFAULT_INIT_STATE_NAME: self.STATE_3}
-        )
-
-    def test_run_with_no_models(self) -> None:
-        self.assert_job_output_is([])
-
-    def test_run_with_single_valid_model(self) -> None:
-        self.put_multi([self.exp_2])
-        self.assert_job_output_is([
-            job_run_result.JobRunResult.as_stdout('EXPS SUCCESS: 1')
-        ])
-
-    def test_run_with_single_invalid_model(self) -> None:
-        self.put_multi([self.exp_1])
-        self.assert_job_output_is([
-            job_run_result.JobRunResult.as_stdout('EXPS SUCCESS: 1'),
-            job_run_result.JobRunResult.as_stdout('INVALID SUCCESS: 1'),
-            job_run_result.JobRunResult.as_stderr(
-                f'The id of exp is {self.EXPLORATION_ID_1} and its actual '
-                + f'len is {len(self.exp_1.title)}'),
-        ])
-
-    def test_run_with_mixed_models(self) -> None:
-        self.put_multi([self.exp_1, self.exp_2, self.exp_3])
-        self.assert_job_output_is([
-            job_run_result.JobRunResult.as_stdout('EXPS SUCCESS: 3'),
-            job_run_result.JobRunResult.as_stdout('INVALID SUCCESS: 2'),
-            job_run_result.JobRunResult.as_stderr(
-                f'The id of exp is {self.EXPLORATION_ID_1} and its actual '
-                + f'len is {len(self.exp_1.title)}'),
-            job_run_result.JobRunResult.as_stderr(
-                f'The id of exp is {self.EXPLORATION_ID_3} and its actual '
-                + f'len is {len(self.exp_3.title)}'),
-        ])
diff --git a/scripts/backend_test_shards.json b/scripts/backend_test_shards.json
--- a/scripts/backend_test_shards.json
+++ b/scripts/backend_test_shards.json
@@ -289,7 +289,6 @@
         "core.controllers.contributor_dashboard_test",
         "core.platform.email.dev_mode_email_services_test",
         "core.jobs.types.blog_validation_errors_test",
-        "core.jobs.batch_jobs.exp_title_validation_jobs_test",
         "core.jobs.batch_jobs.blog_validation_jobs_test",
         "core.jobs.transforms.validation.blog_validation_test",
         "core.jobs.transforms.validation.skill_validation_test",