Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Time Critical option in compose page #96

Merged
merged 2 commits into from
Dec 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 7 additions & 5 deletions observation_portal/requestgroups/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -787,20 +787,22 @@ def validate(self, data):

if time_available <= 0.0:
raise serializers.ValidationError(
_("Proposal {} does not have any time left allocated in semester {} on {} instruments").format(
data['proposal'], tak.semester, tak.instrument_type)
_("Proposal {} does not have any {} time left allocated in semester {} on {} instruments").format(
data['proposal'], data['observation_type'], tak.semester, tak.instrument_type)
)
elif time_available * OVERHEAD_ALLOWANCE < (duration / 3600.0):
raise serializers.ValidationError(
_("Proposal {} does not have enough time allocated in semester {}").format(
data['proposal'], tak.semester)
_("Proposal {} does not have enough {} time allocated in semester {}").format(
data['proposal'], data['observation_type'], tak.semester)
)
# validate the ipp debitting that will take place later
if data['observation_type'] == RequestGroup.NORMAL:
validate_ipp(data, total_duration_dict)
except ObjectDoesNotExist:
raise serializers.ValidationError(
_("You do not have sufficient time allocated on the instrument you're requesting for this proposal.")
_("You do not have sufficient {} time allocated on the instrument you're requesting for this proposal.".format(
data['observation_type']
))
)
except TimeAllocationError as e:
raise serializers.ValidationError(repr(e))
Expand Down
8 changes: 4 additions & 4 deletions observation_portal/requestgroups/test/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def test_post_requestgroup_no_time_allocation_for_instrument(self):
bad_data['requests'][0]['configurations'][0]['instrument_configs'][0]['optical_elements']['slit'] = 'slit_6.0as'
response = self.client.post(reverse('api:request_groups-list'), data=bad_data)
self.assertEqual(response.status_code, 400)
self.assertIn('You do not have sufficient time', str(response.content))
self.assertIn('You do not have sufficient NORMAL time', str(response.content))

def test_post_requestgroup_manual_instrument_not_allowed(self):
bad_data = self.generic_payload.copy()
Expand Down Expand Up @@ -246,7 +246,7 @@ def test_post_requestgroup_not_enough_time_allocation_for_instrument(self):
self.time_allocation_1m0_sbig.save()
response = self.client.post(reverse('api:request_groups-list'), data=bad_data)
self.assertEqual(response.status_code, 400)
self.assertIn('does not have enough time allocated', str(response.content))
self.assertIn('does not have enough NORMAL time allocated', str(response.content))

def test_post_requestgroup_not_enough_rr_time_allocation_for_instrument(self):
bad_data = self.generic_payload.copy()
Expand All @@ -257,7 +257,7 @@ def test_post_requestgroup_not_enough_rr_time_allocation_for_instrument(self):
self.time_allocation_1m0_sbig.save()
response = self.client.post(reverse('api:request_groups-list'), data=bad_data)
self.assertEqual(response.status_code, 400)
self.assertIn('does not have enough time allocated', str(response.content))
self.assertIn('does not have enough RAPID_RESPONSE time allocated', str(response.content))

def test_post_requestgroup_rr_future_start_time(self):
bad_data = self.generic_payload.copy()
Expand Down Expand Up @@ -291,7 +291,7 @@ def test_post_requestgroup_not_have_any_time_left(self):
self.time_allocation_1m0_sbig.save()
response = self.client.post(reverse('api:request_groups-list'), data=bad_data)
self.assertEqual(response.status_code, 400)
self.assertIn('does not have any time left allocated', str(response.content))
self.assertIn('does not have any NORMAL time left allocated', str(response.content))

def test_post_requestgroup_time_limit_reached(self):
self.membership.time_limit = 0
Expand Down
7 changes: 5 additions & 2 deletions static/js/components/requestgroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,14 @@
label="Mode"
field="observation_type" v-on:input="update"
desc="Rapid Response (RR) requests bypass normal scheduling and are executed immediately.
This mode is only available if a proposal was granted RR time."
Time Critical (TC) requests are given a large fixed priority that will beat any
requests that use default queue scheduling.
These modes are only available if a proposal was granted RR or TC time."
:errors="errors.observation_type"
:options="[
{value: 'NORMAL', text: 'Queue scheduled (default)'},
{value:'RAPID_RESPONSE', text: 'Rapid Response'}
{value: 'TIME_CRITICAL', text: 'Time Critical'},
{value: 'RAPID_RESPONSE', text: 'Rapid Response'}
]"
@input="update"
/>
Expand Down