Commit 61306fc751a3543f3c7fbbf106d09513a2bc9def

Authored by Alexis Koralewski
1 parent 602317c8
Exists in dev

Revert "Adding src/core/pyros_django/sequences_pickle to gitignore"

This reverts commit 31eb7bc15675f46a203d0e5390dad9c81c61755c.
.gitignore
... ... @@ -65,7 +65,7 @@ privatedev/config/*/history/
65 65 privatedev/config/*/obsconfig.p
66 66 src/core/pyros_django/obsconfig/fixtures/obsconfig.p
67 67 src/core/pyros_django/obsconfig/fixtures/history/*
68   -src/core/pyros_django/sequences_pickle/
  68 +
69 69 src/core/guitastro
70 70  
71 71 # Token file created by pyros_api.py
... ...
src/core/pyros_django/routine_manager/views.py
1 1 from django.core.paginator import Paginator
2   -import pickle
3 2 from src.pyros_logger import log
4 3 from pprint import pprint
5 4 import mimetypes
... ... @@ -18,7 +17,6 @@ import ast
18 17 import os
19 18 import datetime
20 19  
21   -from django.forms.models import model_to_dict
22 20 from src.core.pyros_django.obsconfig.obsconfig_class import OBSConfig
23 21 from .forms import RequestForm, SequenceForm, AlbumForm, PlanForm, uneditablePlanForm
24 22 from .validators import check_plan_validity, check_album_validity, check_sequence_validity, check_request_validity
... ... @@ -252,23 +250,6 @@ def unsubmit_sequence(request, seq_id):
252 250 messages.add_message(request,messages.INFO,message)
253 251 return redirect(action_sequence, seq_id, "view")
254 252  
255   -def create_sequence_pickle(sequence):
256   - seq_dict = model_to_dict(sequence)
257   - fullseq_dict = {
258   - "sequence":seq_dict,
259   - "albums": {}
260   - }
261   - for album in sequence.albums.all():
262   - fullseq_dict["albums"][album.name] = {"plans" : []}
263   - for plan in album.plans.all():
264   - fullseq_dict["albums"][f"{album.name}"]["plans"].append(model_to_dict(instance=plan))
265   - period = sequence.period
266   - if not os.path.exists("sequences_pickle"):
267   - os.mkdir("./sequences_pickle")
268   - if not os.path.exists(f"sequences_pickle/P{period.id}"):
269   - os.mkdir(f"sequences_pickle/P{period.id}")
270   - seq_pickle_file_name = f"./sequences_pickle/P{period.id}/{sequence.name}.p"
271   - pickle.dump(fullseq_dict,open(seq_pickle_file_name,"wb"))
272 253  
273 254 @login_required
274 255 @level_required("Admin", "Unit-PI", "Observer")
... ... @@ -335,7 +316,6 @@ def sequence_validate(request, seq_id):
335 316 seq.status = Sequence.TOBEPLANNED
336 317 seq.save()
337 318 message = "Sequence submitted"
338   - create_sequence_pickle(seq)
339 319 messages.add_message(request, messages.INFO, message)
340 320 log.info(
341 321 f"User {request.user} did action submit sequence {seq} for period {seq.period} ")
... ...