from recidiviz.common.google_cloud.google_cloud_tasks_client_wrapper import \ QUEUES_REGION from recidiviz.ingest.direct.controllers.direct_ingest_gcs_file_system import \ to_normalized_unprocessed_file_path from recidiviz.cloud_storage.gcsfs_path import GcsfsFilePath from recidiviz.ingest.direct.direct_ingest_cloud_task_manager import \ DirectIngestCloudTaskManagerImpl, _build_task_id, ProcessIngestJobCloudTaskQueueInfo from recidiviz.ingest.direct.controllers.direct_ingest_types import IngestArgs from recidiviz.ingest.direct.controllers.gcsfs_direct_ingest_utils import \ GcsfsIngestArgs, GcsfsDirectIngestFileType, GcsfsRawDataBQImportArgs, GcsfsIngestViewExportArgs from recidiviz.utils import regions _REGION = regions.Region(region_code='us_nc', agency_name='agency_name', agency_type='state', base_url='base_url', shared_queue=DIRECT_INGEST_STATE_PROCESS_JOB_QUEUE_V2, timezone='America/New_York', jurisdiction_id='jid', environment='production') class TestCloudTaskQueueInfo(TestCase): """Tests for the CloudTaskQueueInfo.""" def test_is_task_queued_no_tasks(self): # Arrange info = ProcessIngestJobCloudTaskQueueInfo(queue_name='queue_name', task_names=[]) file_path = to_normalized_unprocessed_file_path( 'bucket/file_path.csv', GcsfsDirectIngestFileType.INGEST_VIEW) args = IngestArgs(ingest_time=datetime.datetime.now())
ProcessIngestJobCloudTaskQueueInfo, ) from recidiviz.ingest.direct.controllers.direct_ingest_types import IngestArgs from recidiviz.ingest.direct.controllers.gcsfs_direct_ingest_utils import ( GcsfsIngestArgs, GcsfsDirectIngestFileType, GcsfsRawDataBQImportArgs, GcsfsIngestViewExportArgs, ) from recidiviz.utils import regions _REGION = regions.Region( region_code="us_nc", agency_name="agency_name", agency_type="state", base_url="base_url", shared_queue=DIRECT_INGEST_STATE_PROCESS_JOB_QUEUE_V2, timezone="America/New_York", jurisdiction_id="jid", environment="production", ) class TestCloudTaskQueueInfo(TestCase): """Tests for the CloudTaskQueueInfo.""" def test_is_task_queued_no_tasks(self) -> None: # Arrange info = ProcessIngestJobCloudTaskQueueInfo(queue_name="queue_name", task_names=[]) file_path = to_normalized_unprocessed_file_path( "bucket/file_path.csv", GcsfsDirectIngestFileType.INGEST_VIEW)
from recidiviz.common.constants.county.booking import CustodyStatus from recidiviz.ingest.scrape import constants, infer_release, scrape_phase from recidiviz.ingest.scrape.sessions import ScrapeSession from recidiviz.utils import regions APP_ID = "recidiviz-infer-release-test" app = Flask(__name__) app.register_blueprint(infer_release.infer_release_blueprint) app.config['TESTING'] = True _REGIONS = [ regions.Region(region_code='us_ut', agency_name='agency_name', agency_type='jail', base_url='base_url', queue={'rate': '5/m'}, timezone='America/New_York', jurisdiction_id='jid', environment='production'), regions.Region(region_code='us_wy', agency_name='agency_name', agency_type='jail', base_url='base_url', timezone='America/New_York', removed_from_website='UNKNOWN_SIGNIFICANCE', jurisdiction_id='jid', environment='production'), regions.Region(region_code='us_nc', agency_name='agency_name', agency_type='prison', base_url='base_url',
from recidiviz.ingest.scrape import constants, infer_release, scrape_phase from recidiviz.ingest.scrape.sessions import ScrapeSession from recidiviz.utils import regions APP_ID = "recidiviz-infer-release-test" app = Flask(__name__) app.register_blueprint(infer_release.infer_release_blueprint) app.config["TESTING"] = True _REGIONS = [ regions.Region( region_code="us_ut", agency_name="agency_name", agency_type="jail", base_url="base_url", queue={"rate": "5/m"}, timezone="America/New_York", jurisdiction_id="jid", environment="production", ), regions.Region( region_code="us_wy", agency_name="agency_name", agency_type="jail", base_url="base_url", timezone="America/New_York", removed_from_website="UNKNOWN_SIGNIFICANCE", jurisdiction_id="jid", environment="production", ), regions.Region(
GcsfsIngestViewExportArgs, GcsfsRawDataBQImportArgs, gcsfs_direct_ingest_bucket_for_region, ) from recidiviz.ingest.direct.direct_ingest_cloud_task_manager import ( DirectIngestCloudTaskManagerImpl, ProcessIngestJobCloudTaskQueueInfo, _build_task_id, ) from recidiviz.utils import regions _REGION = regions.Region( region_code="us_xx", agency_name="agency_name", agency_type="state", base_url="base_url", timezone="America/New_York", jurisdiction_id="jid", environment="production", is_direct_ingest=True, ) class TestProcessIngestJobCloudTaskQueueInfo(TestCase): """Tests for the CloudTaskQueueInfo.""" def setUp(self) -> None: bucket = gcsfs_direct_ingest_bucket_for_region( project_id="recidiviz-456", region_code=_REGION.region_code, system_level=SystemLevel.STATE, ingest_instance=DirectIngestInstance.PRIMARY, )