Hi! Please find bellow the outputs. When I was using sessions stored in
cache (specially in Memcached) all things were working good until I wanted
to upload a data set with larger volume of data : it wasn't be possible to
put them in cache.


Training dataset uploaded :  Coffee
training dataset saved in django session :

 
[[0,-0.51841899,-0.48588363,-0.50500747,-0.56018294,-0.63629941,-0.75322902,-0.82722915,-0.85976467,-0.90632072,-0.92379648,-0.93321222,-0.93442926,-0.92078716,-0.93657191,-0.95599685,-0.95934101,-0.96940599,-0.9824055,-0.97659952,-0.96252576,-0.97031893,-0.98199237,-0.9874616,-1.0152202,-1.0480611,-1.0592421,-1.0498854,-1.0467321,-1.0643986,-1.0877935,-1.0993351,-1.0850813,-1.0641912,-1.0545229,-1.044503,-1.0236367,-0.99421712,-0.96371982,-0.92237217,-0.86616903,-0.81351574,-0.77266759,-0.72343976,-0.66424331,-0.63424598,-0.6280451,-0.60469363,-0.56829781,-0.53778323,-0.50569966,-0.4612259,-0.38892741,-0.29296669,-0.20056328,-
...
582,-1.7619773,-1.7640397,-1.7661713,-1.7689397,-1.7722404,-1.7751282,-1.7766233,-1.7782533,-1.7809291,-1.7835006,-1.7858671,-1.7878936,-1.7896332,-1.791887,-1.7937475,-1.795334,-1.7968732]]


training dataset copy saved in django session :
     0         1         2         3         4         5         6
7         8    ...       278       279       280       281       282
283       284       285       286
0     0 -0.518419 -0.485884 -0.505007 -0.560183 -0.636299 -0.753229
-0.827229 -0.859765  ... -1.922313 -1.924212 -1.926997 -1.928721 -1.930026
-1.932301 -1.933631 -1.934963 -1.936007

23    1 -0.654035 -0.634715 -0.625911 -0.650577 -0.710112 -0.793933
-0.876500 -0.917085  ... -1.758149 -1.760285 -1.763167 -1.766203 -1.768161
-1.769878 -1.771651 -1.772835 -1.774231
24    1 -0.675463 -0.617801 -0.619069 -0.664476 -0.751102 -0.841188
-0.900013 -0.937926  ... -1.733537 -1.736082 -1.738777 -1.741560 -1.743612
-1.745258 -1.747073 -1
50    1 -0.674712 -0.633369 -0.648089 -0.706044 -0.763404 -0.841210
-0.926266 -0.967801  ... -1.798162 -1.800553 -1.803785 -1.806106 -1.808189
-1.810410 -1.812302 -1.814185 -1.815227
51    1 -0.637021 -0.624313 -0.602822 -0.644700 -0.735494 -0.798365
-0.866908 -0.920802  ... -1.777194 -1.779707 -1.782322 -1.784423 -1.786802
-1.789479
55    1 -0.665276 -0.636800 -0.639735 -0.687703 -0.760849 -0.839653
-0.898612 -0.923578  ... -1.780929 -1.783501 -1.785867 -1.787894 -1.789633
-1.791887 -1.793747 -1.795334 -1.796873

[56 rows x 287 columns]
In upload_local_dataset Session's keys :  dict_keys(['ts_dataset',
'ts_dataset_copy'])
[26/Feb/2020 08:20:09] "POST /upload_dataset HTTP/1.1" 200 176589
[26/Feb/2020 08:20:13] "GET /uts_datasets HTTP/1.1" 200 35673
In cv_classification Session's keys :  dict_keys([])
Internal Server Error: /cv_classification/5/FOTS/283/None/0/0
Traceback (most recent call last):
  File
"/home/proj-guyrostan1/STAGE/tsanalysiswebapp/backend/venv/lib/python3.7/site-packages/django/core/handlers/exception.py",
line 34, in inner
    response = get_response(request)
  File
"/home/proj-guyrostan1/STAGE/tsanalysiswebapp/backend/venv/lib/python3.7/site-packages/django/core/handlers/base.py",
line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File
"/home/proj-guyrostan1/STAGE/tsanalysiswebapp/backend/venv/lib/python3.7/site-packages/django/core/handlers/base.py",
line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File
"/home/proj-guyrostan1/STAGE/tsanalysiswebapp/backend/djangobackend/tsanalysisapp/views.py",
line 260, in cv_classification
    df = pd.read_json(request.session.get('ts_dataset_copy'), orient='values
')
  File
"/home/proj-guyrostan1/STAGE/tsanalysiswebapp/backend/venv/lib/python3.7/site-packages/pandas/io/json/_json.py",
line 569, in read_json
    path_or_buf, encoding=encoding, compression=compression
  File
"/home/proj-guyrostan1/STAGE/tsanalysiswebapp/backend/venv/lib/python3.7/site-packages/pandas/io/common.py",
line 224, in get_filepath_or_buffer
    raise ValueError(msg.format(_type=type(filepath_or_buffer)))
ValueError: Invalid file path or buffer object type: <class 'NoneType'>
[26/Feb/2020 08:20:29] "GET /cv_classification/5/FOTS/283/None/0/0
HTTP/1.1" 500 84649




Le mer. 26 févr. 2020 à 08:39, Naveen Arora <[email protected]> a
écrit :

> Hi,
>
> please post the output of debugging the above, print after and before in
> these views and also check is something else is working using
> request.session.
> @csrf_exempt
>     def upload_local_dataset(request):
>         if request.method == 'POST':
>             dataset = pd.read_csv(request.FILES.get('datasetfilepath'),
>  header=None, index_col=None)
>             request.session['ts_datset'] = dataset.to_json(orient='values'
> )
>             print(dataset.to_json(orient='values'))
>             request.session['ts_dataset_copy'] = dataset.to_json(orient=
> 'values')
>             print(request.session['ts_dataset_copy'])
>             return HttpResponse(dataset.to_json(orient='values'))
> Post output of this plus the below one
> def cv_classification(request, kfolds, dissimilarity_func, windows_length=
> 0, noisy_law="", mu=0,std=0):
>             noisy_law = noisy_law.lower()
>             print(request.session['ts_dataset_copy'])
>             df = pd.read_json(request.session['ts_dataset_copy'], orient=
> 'values')
>             predictions = cv_classify(df, kfolds, dissimilarity_func,
>  windows_length, noisy_law, mu, std)
>             return JsonResponse(predictions, safe=False)
>
> On Tuesday, 25 February 2020 03:47:25 UTC+5:30, Guy NANA wrote:
>>
>> I have an angular frontend app which send file to django backend which
>> data is setting in django session. After I send a httprequest to django
>> backend to make ML tratements on that data and get the results. But I've a
>> 500 sever error: keyerror 'ts_dataset_copy': KeyError: 'ts_dataset_copy'
>> [24/Feb/2020 18:43:46] "GET /cv_classification/5/FOTS/283/None/0/0
>> HTTP/1.1" 500 78264. Here are my django code:
>>
>> Firstly I upload timeseries dataset file from angular frontend (All thing
>> is ok)
>> @csrf_exempt
>>     def upload_local_dataset(request):
>>         if request.method == 'POST':
>>             dataset = pd.read_csv(request.FILES.get('datasetfilepath'),
>> header=None, index_col=None)
>>             request.session['ts_datset'] = dataset.to_json(orient=
>> 'values')
>>             request.session['ts_dataset_copy'] = dataset.to_json(orient=
>> 'values')
>>
>>             return HttpResponse(dataset.to_json(orient='values'))
>>
>>
>>
>> # second httrequest that throws a server internal error
>>
>>     def cv_classification(request, kfolds, dissimilarity_func,
>> windows_length=0, noisy_law="", mu=0,
>>
>>         std=0):
>>             noisy_law = noisy_law.lower()
>>             df = pd.read_json(request.session['ts_dataset_copy'], orient=
>> 'values')
>>             predictions = cv_classify(df, kfolds, dissimilarity_func,
>> windows_length, noisy_law, mu, std)
>>             return JsonResponse(predictions, safe=False)
>>
>>
>>
>> Thanks for your help!
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/7pjz-2smXDQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ee6dd1d1-9567-46ba-a699-500d1e950788%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/ee6dd1d1-9567-46ba-a699-500d1e950788%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 

*Guy Rostan DJOUNANG  NANA*

*Élève Ingénieur en Informatique*
*-- Institut Africain d'Informatique ---*
*Certifié: LPIC-1 / OCA JAVA SE 8*
*Maîtrise de Mathématiques, Parcours type:*
* Analyse - Algèbre - Géométrie*
*-- Faculté des Sciences / Université de Douala-Cameroun ---*
*Président du Comité des Étudiants de l'IAI*

*Juin 2017 - Octobre 2019*

*LinkedIn: Guy Rostan DJOUNANG NANA
(www.linkedin.com/in/guy-rostan-djounang-nana/
<http://www.linkedin.com/in/guy-rostan-djounang-nana/>)*
*(+241) 02512998 <+241%2002%2051%2029%2098>*
* / (+33) (0) 785587350*

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BhhbOrvz3p54MowSVaevwsfJW8sL7pcTvNfknfRh%2B6i5eRo3Q%40mail.gmail.com.

Reply via email to