From 2da3ce1c2cc370bc0d0b6fc8283e0b7af04bdb5a Mon Sep 17 00:00:00 2001 From: Vinaya Mayya Date: Sun, 8 Sep 2024 13:01:30 -0500 Subject: [PATCH] Error handling updates --- .../api/client/bell_schedule.py | 7 +++- .../api/client/calendar_date.py | 8 ++-- .../api/client/community.py | 4 ++ .../api/client/course.py | 3 ++ .../api/client/course_offering.py | 6 +++ .../api/client/discipline.py | 4 ++ .../api/client/ed_fi_api_client.py | 12 ++++++ .../api/client/education.py | 10 +++++ .../edfi_performance_test/api/client/grade.py | 7 +++- .../api/client/gradebook_entries.py | 2 + .../api/client/intervention.py | 4 ++ .../api/client/post_secondary.py | 2 + .../api/client/report_card.py | 2 + .../api/client/school.py | 1 + .../api/client/section.py | 12 +++++- .../api/client/session.py | 37 +++++++++++++++---- .../edfi_performance_test/api/client/staff.py | 9 +++++ .../api/client/student.py | 9 +++++ .../api/client/v4/gradebook_entries.py | 2 + .../factories/resources/calendar.py | 7 ++-- .../factories/resources/calendar_date.py | 2 +- .../factories/resources/course.py | 4 +- .../factories/resources/course_offering.py | 1 + .../factories/resources/grading_period.py | 6 ++- .../factories/resources/graduation_plan.py | 2 +- .../factories/resources/section.py | 2 +- .../factories/resources/session.py | 4 +- .../factories/resources/staff.py | 7 ---- .../factories/resources/student.py | 8 ++-- .../tasks/volume/ed_fi_volume_test_base.py | 9 +++-- .../tasks/volume/staff.py | 3 -- 31 files changed, 149 insertions(+), 47 deletions(-) diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/bell_schedule.py b/src/edfi-performance-test/edfi_performance_test/api/client/bell_schedule.py index a30afd93..c7e16d53 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/bell_schedule.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/bell_schedule.py @@ -6,6 +6,7 @@ from typing import Dict from edfi_performance_test.api.client.ed_fi_api_client import EdFiAPIClient from edfi_performance_test.api.client.class_period import ClassPeriodClient +from edfi_performance_test.api.client.school import SchoolClient class BellScheduleClient(EdFiAPIClient): @@ -14,9 +15,12 @@ class BellScheduleClient(EdFiAPIClient): dependencies: Dict = {ClassPeriodClient: {}} def create_with_dependencies(self, **kwargs): + school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) + # Create new class period class_period_reference = self.class_period_client.create_with_dependencies() - + if(class_period_reference is None or class_period_reference["resource_id"] is None): + return # Create bell schedule return self.create_using_dependencies( class_period_reference, @@ -25,5 +29,6 @@ def create_with_dependencies(self, **kwargs): ][ "classPeriodName" ], + classPeriods__0__classPeriodReference__schoolId=school_id, **kwargs ) diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/calendar_date.py b/src/edfi-performance-test/edfi_performance_test/api/client/calendar_date.py index ef6e4da6..1a38c4ea 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/calendar_date.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/calendar_date.py @@ -6,7 +6,6 @@ from typing import Dict from edfi_performance_test.api.client.ed_fi_api_client import EdFiAPIClient from edfi_performance_test.api.client.school import SchoolClient -from edfi_performance_test.factories.utils import RandomSuffixAttribute class CalendarDateClient(EdFiAPIClient): @@ -18,13 +17,12 @@ class CalendarDateClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) - custom_calendar_code = kwargs.pop( - "calendarCode", RandomSuffixAttribute("107SS111111") - ) # Create a calendar calendar_reference = self.calendar_client.create_with_dependencies( - schoolReference__schoolId=school_id, calendarCode=custom_calendar_code + schoolReference__schoolId=school_id ) + if(calendar_reference is None or calendar_reference["resource_id"] is None): + return # Create first calendar date return self.create_using_dependencies( diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/community.py b/src/edfi-performance-test/edfi_performance_test/api/client/community.py index 21f81c3f..58f6017b 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/community.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/community.py @@ -21,6 +21,8 @@ class CommunityProviderClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): org_reference = self.org_client.create_with_dependencies() + if(org_reference is None or org_reference["resource_id"] is None): + return return self.create_using_dependencies( org_reference, @@ -42,6 +44,8 @@ class CommunityProviderLicenseClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): provider_reference = self.provider_client.create_with_dependencies() + if(provider_reference is None or provider_reference["resource_id"] is None): + return return self.create_using_dependencies( provider_reference, diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/course.py b/src/edfi-performance-test/edfi_performance_test/api/client/course.py index f1ce16ef..20a8e624 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/course.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/course.py @@ -28,6 +28,9 @@ def create_with_dependencies(self, **kwargs): schoolId=school_id ) + if(record_reference is None or record_reference["resource_id"] is None): + return + # Create course transcript return self.create_using_dependencies( record_reference, diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/course_offering.py b/src/edfi-performance-test/edfi_performance_test/api/client/course_offering.py index 22bcf4bb..217cde6b 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/course_offering.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/course_offering.py @@ -16,10 +16,14 @@ class CourseOfferingClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) school_year = kwargs.get("schoolYear", 2014) + course_code = kwargs.pop("courseCode", "ELA-01") session_reference = self.session_client.create_with_dependencies( schoolId=school_id, schoolYear=school_year ) + if(session_reference is None or session_reference["resource_id"] is None): + return + return self.create_using_dependencies( session_reference, sessionReference__schoolId=school_id, @@ -27,5 +31,7 @@ def create_with_dependencies(self, **kwargs): sessionReference__sessionName=session_reference["attributes"][ "sessionName" ], + courseReference_courseCode=course_code, + courseReference_educationOrganizationId=school_id, **kwargs ) diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/discipline.py b/src/edfi-performance-test/edfi_performance_test/api/client/discipline.py index bc0240c0..fba9504f 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/discipline.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/discipline.py @@ -22,6 +22,8 @@ def create_with_dependencies(self, **kwargs): # Create staff staff_reference = self.staff_client.create_with_dependencies(schoolId=school_id) + if(staff_reference is None or staff_reference["resource_id"] is None): + return # Create discipline incident return self.create_using_dependencies( @@ -48,6 +50,8 @@ def create_with_dependencies(self, **kwargs): school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) assoc_reference = self.assoc_client.create_with_dependencies(schoolId=school_id) + if(assoc_reference is None or assoc_reference["resource_id"] is None): + return # Create discipline action return self.create_using_dependencies( diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/ed_fi_api_client.py b/src/edfi-performance-test/edfi_performance_test/api/client/ed_fi_api_client.py index 794dca46..175205e5 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/ed_fi_api_client.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/ed_fi_api_client.py @@ -140,6 +140,10 @@ def create(self, unique_id_field=None, name=None, **factory_kwargs): return if succeed_on != [] and response.status_code not in succeed_on: response.failure("Status code {} is a failure".format(response.status_code)) + # Useful for debugging + # logger.error( + # f"{response.request.method} {response.request.url} - REQUEST BODY: {payload}" + # ) return if self.is_not_expected_result(response, [200, 201]): if unique_id is not None: @@ -177,6 +181,14 @@ def delete_item(self, resource_id): ) ) return True + if(resource_id is None): + logger.debug( + "Skipping delete of {} instance {} because" + " resource_id is null".format( + self.__class__.__name__.replace("Client", ""), resource_id + ) + ) + return True response = self._get_response( "delete", self.detail_endpoint(resource_id), diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/education.py b/src/edfi-performance-test/edfi_performance_test/api/client/education.py index aed7aa97..ad80d43a 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/education.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/education.py @@ -29,6 +29,8 @@ class EducationOrganizationInterventionPrescriptionAssociationClient(EdFiAPIClie def create_with_dependencies(self, **kwargs): rx_reference = self.prescription_client.create_with_dependencies() + if(rx_reference is None or rx_reference["resource_id"] is None): + return return self.create_using_dependencies( rx_reference, @@ -55,6 +57,8 @@ class EducationOrganizationNetworkAssociationClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): network_reference = self.network_client.create_with_dependencies() + if(network_reference is None or network_reference["resource_id"] is None): + return return self.create_using_dependencies( network_reference, @@ -76,6 +80,8 @@ class EducationOrganizationPeerAssociationClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): school_reference = self.school_client.create_with_dependencies() + if(school_reference is None or school_reference["resource_id"] is None): + return return self.create_using_dependencies( school_reference, @@ -106,6 +112,8 @@ class LocalEducationAgencyClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): service_center_reference = self.service_center_client.create_with_dependencies() + if(service_center_reference is None or service_center_reference["resource_id"] is None): + return return self.create_using_dependencies( service_center_reference, @@ -145,6 +153,8 @@ class FeederSchoolAssociationClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): feeder_school_reference = self.school_client.create_with_dependencies() + if(feeder_school_reference is None or feeder_school_reference["resource_id"] is None): + return return self.create_using_dependencies( feeder_school_reference, diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/grade.py b/src/edfi-performance-test/edfi_performance_test/api/client/grade.py index 503e50c6..c2c39594 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/grade.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/grade.py @@ -21,11 +21,13 @@ class GradeClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): school_id = kwargs.pop("schoolId", SchoolClient.shared_elementary_school_id()) - course_code = kwargs.pop("courseCode", "ELA-01") assoc_reference = self.section_assoc_client.create_with_dependencies( - schoolId=school_id, courseCode=course_code + schoolId=school_id, ) + if(assoc_reference is None or assoc_reference["resource_id"] is None): + return + grade_period = assoc_reference["dependency_ids"]["section_client"][ "gradingPeriods" ][0]["gradingPeriodReference"] @@ -38,6 +40,7 @@ def create_with_dependencies(self, **kwargs): gradingPeriodReference__gradingPeriodDescriptor=grade_period[ "gradingPeriodDescriptor" ], + gradingPeriodReference__gradingPeriodName=grade_period["gradingPeriodName"], gradingPeriodReference__schoolYear=section_reference["schoolYear"], studentSectionAssociationReference__sectionIdentifier=section_reference[ "sectionIdentifier" diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/gradebook_entries.py b/src/edfi-performance-test/edfi_performance_test/api/client/gradebook_entries.py index b6d06a66..6227ca8a 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/gradebook_entries.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/gradebook_entries.py @@ -17,6 +17,8 @@ class GradebookEntryClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): section_reference = self.section_client.create_with_dependencies() + if(section_reference is None or section_reference["resource_id"] is None): + return section_attrs = section_reference["attributes"] return self.create_using_dependencies( diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/intervention.py b/src/edfi-performance-test/edfi_performance_test/api/client/intervention.py index f0a86f47..937bb977 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/intervention.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/intervention.py @@ -22,6 +22,8 @@ class InterventionClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): # Create intervention prescription rx_reference = self.prescription_client.create_with_dependencies() + if(rx_reference is None or rx_reference["resource_id"] is None): + return # Create intervention return self.create_using_dependencies( @@ -46,6 +48,8 @@ class InterventionStudyClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): # Create intervention prescription rx_reference = self.prescription_client.create_with_dependencies() + if(rx_reference is None or rx_reference["resource_id"] is None): + return # Create intervention return self.create_using_dependencies( diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/post_secondary.py b/src/edfi-performance-test/edfi_performance_test/api/client/post_secondary.py index 7a175c82..f0850e2a 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/post_secondary.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/post_secondary.py @@ -24,6 +24,8 @@ def create_with_dependencies(self, **kwargs): # Create new student for association institution_reference = self.institution_client.create_with_dependencies() + if(institution_reference is None or institution_reference["resource_id"] is None): + return return self.create_using_dependencies( institution_reference, diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/report_card.py b/src/edfi-performance-test/edfi_performance_test/api/client/report_card.py index 883f2be7..ff9fb54d 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/report_card.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/report_card.py @@ -20,6 +20,8 @@ def create_with_dependencies(self, **kwargs): # Prepopulated student studentUniqueId = kwargs.pop("studentUniqueId", StudentClient.shared_student_id()) period_reference = self.grading_period_client.create_with_dependencies() + if(period_reference is None or period_reference["resource_id"] is None): + return return self.create_using_dependencies( period_reference, diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/school.py b/src/edfi-performance-test/edfi_performance_test/api/client/school.py index 53dc93d6..991caed9 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/school.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/school.py @@ -27,6 +27,7 @@ def shared_high_school_id(cls): return cls._high_school_id cls._high_school_id = cls.create_shared_resource("schoolId") cls._create_school_course_code(cls._high_school_id, "ALG-2") + cls._create_school_course_code(cls._high_school_id, "ELA-01") cls._create_school_graduation_plan(cls._high_school_id, 2020) return cls._high_school_id diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/section.py b/src/edfi-performance-test/edfi_performance_test/api/client/section.py index 57abbade..f4a6be9b 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/section.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/section.py @@ -24,32 +24,38 @@ class SectionClient(EdFiAPIClient): def create_with_dependencies(self, **kwargs): school_id = kwargs.get("schoolId", SchoolClient.shared_elementary_school_id()) school_year = kwargs.get("schoolYear", 2014) - custom_course_code = kwargs.pop("courseCode", "ELA-01") # Create a course offering and its dependencies course_offering_reference = ( self.course_offering_client.create_with_dependencies( schoolId=school_id, schoolYear=school_year, - courseReference__courseCode=custom_course_code, courseReference__educationOrganizationId=school_id, schoolReference__schoolId=school_id, ) ) + if(course_offering_reference is None or course_offering_reference["resource_id"] is None): + return course_offering_attrs = course_offering_reference["attributes"] # Create a class period class_period_reference = self.class_period_client.create_with_dependencies( schoolReference__schoolId=school_id, ) + if(class_period_reference is None or class_period_reference["resource_id"] is None): + return # Create a location location_reference = self.location_client.create_with_dependencies( schoolReference__schoolId=school_id, ) + if(location_reference is None or location_reference["resource_id"] is None): + return + # Create a section section_attrs = self.factory.build_dict( + classPeriods__0__classPeriodReference__schoolId=school_id, classPeriods__0__classPeriodReference__classPeriodName=class_period_reference[ "attributes" ][ @@ -119,6 +125,8 @@ def create_with_dependencies(self, **kwargs): section_reference = self.section_client.create_with_dependencies( schoolId=school_id, schoolYear=calendarSchoolYear ) + if(section_reference is None or section_reference["resource_id"] is None): + return section_attrs = section_reference["attributes"] return self.create_using_dependencies( diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/session.py b/src/edfi-performance-test/edfi_performance_test/api/client/session.py index c78b53a8..81c0efb1 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/session.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/session.py @@ -7,7 +7,6 @@ from edfi_performance_test.api.client.ed_fi_api_client import EdFiAPIClient from edfi_performance_test.api.client.grading_period import GradingPeriodClient from edfi_performance_test.api.client.school import SchoolClient -from edfi_performance_test.factories.descriptors.utils import build_descriptor class SessionClient(EdFiAPIClient): @@ -23,17 +22,15 @@ def create_with_dependencies(self, **kwargs): schoolReference__schoolId=school_id, schoolYearTypeReference__schoolYear=school_year, ) + if(period_1_reference is None or period_1_reference["resource_id"] is None): + return + period_2_reference = self.grading_period_client.create_with_dependencies( schoolReference__schoolId=school_id, schoolYearTypeReference__schoolYear=school_year, - beginDate="2014-10-06", - endDate="2014-12-15", - totalInstructionalDays=30, - gradingPeriodDescriptor=build_descriptor( - "GradingPeriod", "Second Six Weeks" - ), ) - + if(period_2_reference is None or period_2_reference["resource_id"] is None): + return # Create session referencing grading periods return self.create_using_dependencies( [ @@ -52,6 +49,30 @@ def create_with_dependencies(self, **kwargs): ][ "periodSequence" ], + gradingPeriods__0__gradingPeriodReference__gradingPeriodDescriptor=period_1_reference[ + "attributes" + ][ + "gradingPeriodDescriptor" + ], + gradingPeriods__1__gradingPeriodReference__gradingPeriodDescriptor=period_2_reference[ + "attributes" + ][ + "gradingPeriodDescriptor" + ], + gradingPeriods__0__gradingPeriodReference__gradingPeriodName=period_1_reference[ + "attributes" + ][ + "gradingPeriodName" + ], + gradingPeriods__1__gradingPeriodReference__gradingPeriodName=period_2_reference[ + "attributes" + ][ + "gradingPeriodName" + ], + gradingPeriods__0__gradingPeriodReference__schoolId=school_id, + gradingPeriods__1__gradingPeriodReference__schoolId=school_id, + gradingPeriods__0__gradingPeriodReference__schoolYear=school_year, + gradingPeriods__1__gradingPeriodReference__schoolYear=school_year, **kwargs ) diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/staff.py b/src/edfi-performance-test/edfi_performance_test/api/client/staff.py index d004e6c6..28ec2def 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/staff.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/staff.py @@ -99,6 +99,8 @@ def create_with_dependencies(self, **kwargs): # Create staff staff_reference = self.staff_client.create_with_dependencies(schoolId=school_id) + if(staff_reference is None or staff_reference["resource_id"] is None): + return # Create association between new staff and new cohort return self.create_using_dependencies( @@ -140,6 +142,8 @@ def create_with_dependencies(self, **kwargs): # Create staff record staff_reference = self.staff_client.create_with_dependencies(schoolId=school_id) + if(staff_reference is None or staff_reference["resource_id"] is None): + return return self.create_using_dependencies( staff_reference, @@ -169,7 +173,12 @@ def create_with_dependencies(self, **kwargs): courseCode=course_code, sectionIdentifier=RandomSuffixAttribute(course_code + "2017RM555"), ) + if(section_reference is None or section_reference["resource_id"] is None): + return + staff_reference = self.staff_client.create_with_dependencies(schoolId=school_id) + if(staff_reference is None or staff_reference["resource_id"] is None): + return # Create association between staff and section sec_attrs = section_reference["attributes"] diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/student.py b/src/edfi-performance-test/edfi_performance_test/api/client/student.py index 5198f2d9..b129c566 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/student.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/student.py @@ -63,6 +63,8 @@ def create_with_dependencies(self, **kwargs): student_attrs = self.factory.build_dict(**kwargs) student_unique_id = student_attrs["studentUniqueId"] student_id = self.create(**student_attrs) + if(student_id is None): + return # Associate student with existing school to allow updates assoc_id = self.assoc_client.create( @@ -124,6 +126,8 @@ def create_with_dependencies(self, **kwargs): student_reference = self.student_client.create_with_dependencies( schoolId=school_id ) + if(student_reference is None or student_reference["resource_id"] is None): + return # Create ed org - student association return self.create_using_dependencies( @@ -303,6 +307,9 @@ def create_with_dependencies(self, **kwargs): courseCode=course_code, sectionIdentifier=RandomSuffixAttribute(course_code + "2017RM555"), ) + if(section_reference is None or section_reference["resource_id"] is None): + return + student_reference = self.student_client.create_with_dependencies( schoolId=school_id ) @@ -395,6 +402,8 @@ def create_with_dependencies(self, **kwargs): courseCode=course_code, sectionIdentifier=RandomSuffixAttribute(course_code + "2017RM555"), ) + if(section_reference is None or section_reference["resource_id"] is None): + return # Create student section attendance event section_attrs = section_reference["attributes"] diff --git a/src/edfi-performance-test/edfi_performance_test/api/client/v4/gradebook_entries.py b/src/edfi-performance-test/edfi_performance_test/api/client/v4/gradebook_entries.py index 4028e556..c7dfaff2 100644 --- a/src/edfi-performance-test/edfi_performance_test/api/client/v4/gradebook_entries.py +++ b/src/edfi-performance-test/edfi_performance_test/api/client/v4/gradebook_entries.py @@ -17,6 +17,8 @@ class GradebookEntryClientV4(EdFiAPIClient): def create_with_dependencies(self, **kwargs): section_reference = self.section_client.create_with_dependencies() + if(section_reference is None or section_reference["resource_id"] is None): + return section_attrs = section_reference["attributes"] return self.create_using_dependencies( diff --git a/src/edfi-performance-test/edfi_performance_test/factories/resources/calendar.py b/src/edfi-performance-test/edfi_performance_test/factories/resources/calendar.py index 42ed83ac..c85a61fa 100644 --- a/src/edfi-performance-test/edfi_performance_test/factories/resources/calendar.py +++ b/src/edfi-performance-test/edfi_performance_test/factories/resources/calendar.py @@ -9,19 +9,18 @@ from edfi_performance_test.factories.resources.api_factory import APIFactory from edfi_performance_test.factories.descriptors.utils import build_descriptor from edfi_performance_test.factories.utils import ( - RandomSuffixAttribute, - RandomSchoolYearAttribute, + UniqueIdAttribute, ) class CalendarFactory(APIFactory): schoolYearTypeReference = factory.Dict( { - "schoolYear": RandomSchoolYearAttribute(), + "schoolYear": 2014, } ) calendarTypeDescriptor = build_descriptor("CalendarType", "IEP") - calendarCode = RandomSuffixAttribute("107SS111111") + calendarCode = UniqueIdAttribute() schoolReference = factory.Dict( {"schoolId": SchoolClient.shared_elementary_school_id()} ) diff --git a/src/edfi-performance-test/edfi_performance_test/factories/resources/calendar_date.py b/src/edfi-performance-test/edfi_performance_test/factories/resources/calendar_date.py index 1f4d4291..a6bb79d0 100644 --- a/src/edfi-performance-test/edfi_performance_test/factories/resources/calendar_date.py +++ b/src/edfi-performance-test/edfi_performance_test/factories/resources/calendar_date.py @@ -16,7 +16,7 @@ class CalendarDateFactory(APIFactory): calendarReference = factory.Dict( dict( - calendarCode="107SS111111", + calendarCode=None, # Must be entered by client schoolId=SchoolClient.shared_elementary_school_id(), schoolYear=2014, ) diff --git a/src/edfi-performance-test/edfi_performance_test/factories/resources/course.py b/src/edfi-performance-test/edfi_performance_test/factories/resources/course.py index 616a8cac..acd41422 100644 --- a/src/edfi-performance-test/edfi_performance_test/factories/resources/course.py +++ b/src/edfi-performance-test/edfi_performance_test/factories/resources/course.py @@ -12,7 +12,7 @@ build_descriptor, build_descriptor_dicts, ) -from edfi_performance_test.factories.utils import RandomSuffixAttribute, current_year +from edfi_performance_test.factories.utils import UniqueIdAttribute, current_year class CourseFactory(APIFactory): @@ -23,7 +23,7 @@ class CourseFactory(APIFactory): ) academicSubjectDescriptor = build_descriptor("AcademicSubject", "Mathematics") courseTitle = "Algebra I" - courseCode = RandomSuffixAttribute("03100500") + courseCode = UniqueIdAttribute(num_chars=20) numberOfParts = 1 identificationCodes = factory.LazyAttribute( lambda o: build_descriptor_dicts( diff --git a/src/edfi-performance-test/edfi_performance_test/factories/resources/course_offering.py b/src/edfi-performance-test/edfi_performance_test/factories/resources/course_offering.py index 2268e6d8..da6dbad8 100644 --- a/src/edfi-performance-test/edfi_performance_test/factories/resources/course_offering.py +++ b/src/edfi-performance-test/edfi_performance_test/factories/resources/course_offering.py @@ -25,5 +25,6 @@ class CourseOfferingFactory(APIFactory): dict( schoolId=SchoolClient.shared_elementary_school_id(), schoolYear=2014, + sessionName=None, # Must be created ) ) diff --git a/src/edfi-performance-test/edfi_performance_test/factories/resources/grading_period.py b/src/edfi-performance-test/edfi_performance_test/factories/resources/grading_period.py index b012c13d..486f2dfd 100644 --- a/src/edfi-performance-test/edfi_performance_test/factories/resources/grading_period.py +++ b/src/edfi-performance-test/edfi_performance_test/factories/resources/grading_period.py @@ -8,11 +8,15 @@ from edfi_performance_test.api.client.school import SchoolClient from edfi_performance_test.factories.resources.api_factory import APIFactory from edfi_performance_test.factories.descriptors.utils import build_descriptor -from edfi_performance_test.factories.utils import UniquePrimaryKeyAttribute +from edfi_performance_test.factories.utils import ( + UniquePrimaryKeyAttribute, + UniqueIdAttribute, +) class GradingPeriodFactory(APIFactory): periodSequence = UniquePrimaryKeyAttribute() + gradingPeriodName = UniqueIdAttribute() beginDate = "2014-08-23" endDate = "2014-10-04" totalInstructionalDays = 29 diff --git a/src/edfi-performance-test/edfi_performance_test/factories/resources/graduation_plan.py b/src/edfi-performance-test/edfi_performance_test/factories/resources/graduation_plan.py index 1e44dfa9..a5589eec 100644 --- a/src/edfi-performance-test/edfi_performance_test/factories/resources/graduation_plan.py +++ b/src/edfi-performance-test/edfi_performance_test/factories/resources/graduation_plan.py @@ -14,7 +14,7 @@ class GraduationPlanFactory(APIFactory): totalRequiredCredits = 28 graduationPlanTypeDescriptor = build_descriptor( "GraduationPlanType", - random.choice(["Recommended", "Distinguished", "Minimum", "Standard"]), + random.choice(["Recommended", "Distinguished", "Minimum", "Standard", "Career and Technical Education"]), ) educationOrganizationReference = factory.Dict( dict(educationOrganizationId=None), diff --git a/src/edfi-performance-test/edfi_performance_test/factories/resources/section.py b/src/edfi-performance-test/edfi_performance_test/factories/resources/section.py index bd69d7b2..86d54021 100644 --- a/src/edfi-performance-test/edfi_performance_test/factories/resources/section.py +++ b/src/edfi-performance-test/edfi_performance_test/factories/resources/section.py @@ -56,7 +56,7 @@ class SectionAttendanceTakenEventFactory(APIFactory): ) sectionReference = factory.Dict( dict( - sectionIdentifier=None, # Must be created + sectionIdentifier=RandomSuffixAttribute("ELA012017RM555"), # Must be created localCourseCode="ELA-01", schoolId=SchoolClient.shared_elementary_school_id(), schoolYear=2014, diff --git a/src/edfi-performance-test/edfi_performance_test/factories/resources/session.py b/src/edfi-performance-test/edfi_performance_test/factories/resources/session.py index 0beab5bc..a594f7ba 100644 --- a/src/edfi-performance-test/edfi_performance_test/factories/resources/session.py +++ b/src/edfi-performance-test/edfi_performance_test/factories/resources/session.py @@ -8,7 +8,7 @@ from edfi_performance_test.api.client.school import SchoolClient from edfi_performance_test.factories.resources.api_factory import APIFactory from edfi_performance_test.factories.descriptors.utils import build_descriptor -from edfi_performance_test.factories.utils import RandomSuffixAttribute +from edfi_performance_test.factories.utils import UniqueIdAttribute class SessionFactory(APIFactory): @@ -16,7 +16,7 @@ class SessionFactory(APIFactory): dict(schoolId=SchoolClient.shared_elementary_school_id()) ) # Prepopulated school schoolYearTypeReference = factory.Dict(dict(schoolYear=2014)) - sessionName = RandomSuffixAttribute("2016-2017 Fall Semester") + sessionName = UniqueIdAttribute() gradingPeriods = factory.List( [ factory.Dict( diff --git a/src/edfi-performance-test/edfi_performance_test/factories/resources/staff.py b/src/edfi-performance-test/edfi_performance_test/factories/resources/staff.py index a575a1a8..b290e4ae 100644 --- a/src/edfi-performance-test/edfi_performance_test/factories/resources/staff.py +++ b/src/edfi-performance-test/edfi_performance_test/factories/resources/staff.py @@ -77,13 +77,6 @@ class StaffFactory(APIFactory): [("State", {"identificationCode": o.staffUniqueId})], ) ) - races = factory.List( - [ - dict( - raceDescriptor=build_descriptor("Race", "White"), - ), - ] - ) languages = factory.List( [ dict( diff --git a/src/edfi-performance-test/edfi_performance_test/factories/resources/student.py b/src/edfi-performance-test/edfi_performance_test/factories/resources/student.py index 0fce580d..82cc0c55 100644 --- a/src/edfi-performance-test/edfi_performance_test/factories/resources/student.py +++ b/src/edfi-performance-test/edfi_performance_test/factories/resources/student.py @@ -183,7 +183,7 @@ class StudentProgramAssociationFactory(APIFactory): educationOrganizationId=LocalEducationAgencyClient.shared_education_organization_id(), # Prepopulated ed organization ) ) - beginDate = formatted_date(8, 23) + beginDate = RandomDateAttribute() class StudentSchoolAssociationFactory(APIFactory): @@ -221,7 +221,7 @@ class StudentTitleIPartAProgramAssociationFactory(APIFactory): educationOrganizationId=LocalEducationAgencyClient.shared_education_organization_id(), # Prepopulated ed organization ) ) - beginDate = formatted_date(8, 23) + beginDate = RandomDateAttribute() titleIPartAParticipantDescriptor = build_descriptor( "TitleIPartAParticipant", "Public Targeted Assistance Program" ) @@ -243,7 +243,7 @@ class StudentSpecialEducationProgramAssociationFactory(APIFactory): educationOrganizationId=LocalEducationAgencyClient.shared_education_organization_id(), # Prepopulated ed organization ) ) - beginDate = formatted_date(8, 23) + beginDate = RandomDateAttribute() specialEducationSettingDescriptor = build_descriptor( "SpecialEducationSetting", "Inside regular class 80% or more of the day" ) @@ -285,7 +285,7 @@ class StudentSchoolAttendanceEventFactory(APIFactory): attendanceEventCategoryDescriptor = build_descriptor( "AttendanceEventCategory", "Tardy" ) - eventDate = formatted_date(9, 16) + eventDate = RandomDateAttribute() class StudentSectionAttendanceEventFactory(APIFactory): diff --git a/src/edfi-performance-test/edfi_performance_test/tasks/volume/ed_fi_volume_test_base.py b/src/edfi-performance-test/edfi_performance_test/tasks/volume/ed_fi_volume_test_base.py index 74f86481..86b069aa 100644 --- a/src/edfi-performance-test/edfi_performance_test/tasks/volume/ed_fi_volume_test_base.py +++ b/src/edfi-performance-test/edfi_performance_test/tasks/volume/ed_fi_volume_test_base.py @@ -14,12 +14,15 @@ class EdFiVolumeTestBase(EdFiTaskSet): def skip_all_scenarios(cls): return False - @task + @task(2) def run_scenario( self, update_attribute_name=None, update_attribute_value=None, **kwargs ): # Create resource instance reference = self.create_with_dependencies(**kwargs) + if reference is None: + return + resource_id = reference["resource_id"] resource_attrs = reference["attributes"] @@ -49,7 +52,7 @@ def _update_attribute( resource_attrs[update_attribute_name] = update_attribute_value self.update(resource_id, **resource_attrs) - @task + @task(1) def run_unsuccessful_scenario(self, **kwargs): if not eval(get_config_value("PERF_FAIL_DELIBERATELY")): return # Skip this scenario if the config value is set to false @@ -58,7 +61,7 @@ def run_unsuccessful_scenario(self, **kwargs): name=self._api_client.list_endpoint() + " [Deliberate Failure]", **kwargs ) - @task + @task(1) def stop(self): # Interrupt the TaskSet and hand over execution control back to the parent TaskSet. # Without interruption, TaskSet will never stop executing its tasks and hand over diff --git a/src/edfi-performance-test/edfi_performance_test/tasks/volume/staff.py b/src/edfi-performance-test/edfi_performance_test/tasks/volume/staff.py index 67290d3e..6ae32c49 100644 --- a/src/edfi-performance-test/edfi_performance_test/tasks/volume/staff.py +++ b/src/edfi-performance-test/edfi_performance_test/tasks/volume/staff.py @@ -60,9 +60,6 @@ def run_staff_scenarios(self): ), ) ], - races__0__raceDescriptor=build_descriptor( - "Race", "Black - African American" - ), )