From 9127472e7b1baa178b10d328fa5b95cf6e318b18 Mon Sep 17 00:00:00 2001 From: <> Date: Thu, 22 Aug 2024 16:44:05 +0000 Subject: [PATCH] Deployed 36cf5a2 with MkDocs version: 1.6.0 --- .nojekyll | 0 404.html | 2852 +++++++ advanced/celery/application/index.html | 2973 ++++++++ advanced/celery/canvas/index.html | 2953 ++++++++ advanced/celery/periodic-tasks/index.html | 2953 ++++++++ advanced/celery/routing/index.html | 2953 ++++++++ advanced/celery/settings/index.html | 2895 +++++++ apps/activities/index.html | 3023 ++++++++ apps/admissions/index.html | 2919 +++++++ apps/monitoring/introduction/index.html | 2966 ++++++++ apps/monitoring/scripts/index.html | 3112 ++++++++ assets/_mkdocstrings.css | 119 + assets/images/favicon.png | Bin 0 -> 1870 bytes assets/javascripts/bundle.fe8b6f2b.min.js | 29 + assets/javascripts/bundle.fe8b6f2b.min.js.map | 7 + assets/javascripts/lunr/min/lunr.ar.min.js | 1 + assets/javascripts/lunr/min/lunr.da.min.js | 18 + assets/javascripts/lunr/min/lunr.de.min.js | 18 + assets/javascripts/lunr/min/lunr.du.min.js | 18 + assets/javascripts/lunr/min/lunr.el.min.js | 1 + assets/javascripts/lunr/min/lunr.es.min.js | 18 + assets/javascripts/lunr/min/lunr.fi.min.js | 18 + assets/javascripts/lunr/min/lunr.fr.min.js | 18 + assets/javascripts/lunr/min/lunr.he.min.js | 1 + assets/javascripts/lunr/min/lunr.hi.min.js | 1 + assets/javascripts/lunr/min/lunr.hu.min.js | 18 + assets/javascripts/lunr/min/lunr.hy.min.js | 1 + assets/javascripts/lunr/min/lunr.it.min.js | 18 + assets/javascripts/lunr/min/lunr.ja.min.js | 1 + assets/javascripts/lunr/min/lunr.jp.min.js | 1 + assets/javascripts/lunr/min/lunr.kn.min.js | 1 + assets/javascripts/lunr/min/lunr.ko.min.js | 1 + assets/javascripts/lunr/min/lunr.multi.min.js | 1 + assets/javascripts/lunr/min/lunr.nl.min.js | 18 + assets/javascripts/lunr/min/lunr.no.min.js | 18 + assets/javascripts/lunr/min/lunr.pt.min.js | 18 + assets/javascripts/lunr/min/lunr.ro.min.js | 18 + assets/javascripts/lunr/min/lunr.ru.min.js | 18 + assets/javascripts/lunr/min/lunr.sa.min.js | 1 + .../lunr/min/lunr.stemmer.support.min.js | 1 + assets/javascripts/lunr/min/lunr.sv.min.js | 18 + assets/javascripts/lunr/min/lunr.ta.min.js | 1 + assets/javascripts/lunr/min/lunr.te.min.js | 1 + assets/javascripts/lunr/min/lunr.th.min.js | 1 + assets/javascripts/lunr/min/lunr.tr.min.js | 18 + assets/javascripts/lunr/min/lunr.vi.min.js | 1 + assets/javascripts/lunr/min/lunr.zh.min.js | 1 + assets/javascripts/lunr/tinyseg.js | 206 + assets/javascripts/lunr/wordcut.js | 6708 +++++++++++++++++ .../workers/search.b8dbb3d2.min.js | 42 + .../workers/search.b8dbb3d2.min.js.map | 7 + assets/stylesheets/main.76a95c52.min.css | 1 + assets/stylesheets/main.76a95c52.min.css.map | 1 + assets/stylesheets/palette.06af60db.min.css | 1 + .../stylesheets/palette.06af60db.min.css.map | 1 + css/custom.css | 11 + .../configuring-the-github-secrets/index.html | 2902 +++++++ deployment/environment-variables/index.html | 3076 ++++++++ endpoints/index.html | 2880 +++++++ essential/4geeks/actions/index.html | 2953 ++++++++ .../services/first-party/token/index.html | 2908 +++++++ .../first-party/using-services/index.html | 3216 ++++++++ .../first-party/writing-services/index.html | 3099 ++++++++ .../4geeks/services/introduction/index.html | 2996 ++++++++ essential/aiohttp/index.html | 2899 +++++++ essential/celery/calling/index.html | 2982 ++++++++ essential/celery/introduction/index.html | 2973 ++++++++ essential/celery/tasks/index.html | 2899 +++++++ .../introduction/index.html | 2957 ++++++++ .../serializers/index.html | 2978 ++++++++ .../validators/index.html | 2953 ++++++++ .../django-rest-framework/views/index.html | 3170 ++++++++ essential/django/admin/index.html | 3045 ++++++++ essential/django/commands/index.html | 3013 ++++++++ essential/django/introduction/index.html | 2995 ++++++++ essential/django/models/index.html | 3046 ++++++++ essential/django/signals/index.html | 3093 ++++++++ essential/django/templates/index.html | 3005 ++++++++ essential/django/urls/index.html | 2993 ++++++++ essential/django/views/index.html | 3090 ++++++++ essential/requests/index.html | 2899 +++++++ essential/serpy/index.html | 3044 ++++++++ .../works-locally/devcontainer/index.html | 3085 ++++++++ .../works-locally/introduction/index.html | 3145 ++++++++ .../setup/works-locally/on-host-os/index.html | 3172 ++++++++ .../works-on-the-cloud/codespaces/index.html | 3030 ++++++++ .../works-on-the-cloud/gitpod/index.html | 3011 ++++++++ .../introduction/index.html | 3013 ++++++++ images/codespaces.png | Bin 0 -> 37723 bytes images/dockerhub.PNG | Bin 0 -> 127183 bytes images/github-secrets.PNG | Bin 0 -> 82390 bytes images/vs-button.png | Bin 0 -> 536 bytes index.html | 2889 +++++++ .../environment-variables/index.html | 2978 ++++++++ infrastructure/infra-env/index.html | 3776 ++++++++++ infrastructure/journal/index.html | 3118 ++++++++ .../studies/django-workers/index.html | 3391 +++++++++ .../studies/http-clients/index.html | 3316 ++++++++ infrastructure/web/index.html | 3171 ++++++++ installation/fixtures/index.html | 2973 ++++++++ objects.inv | Bin 0 -> 844 bytes search/search_index.json | 1 + security/authentication-class/index.html | 2968 ++++++++ security/capabilities/index.html | 3270 ++++++++ security/introduction/index.html | 2972 ++++++++ security/schema-link/index.html | 3148 ++++++++ .../google-cloud-functions/index.html | 3055 ++++++++ services/google_cloud/storage/index.html | 3238 ++++++++ services/slack integration/icons/index.html | 2897 +++++++ signals/quickstart/index.html | 3057 ++++++++ sitemap.xml | 353 + sitemap.xml.gz | Bin 0 -> 891 bytes testing/mixins/bc-cache/index.html | 3049 ++++++++ testing/mixins/bc-check/index.html | 4165 ++++++++++ testing/mixins/bc-database/index.html | 5565 ++++++++++++++ testing/mixins/bc-datetime/index.html | 3287 ++++++++ testing/mixins/bc-fake/index.html | 2895 +++++++ testing/mixins/bc-format/index.html | 4815 ++++++++++++ testing/mixins/bc-random/index.html | 3361 +++++++++ testing/mixins/bc-request/index.html | 3770 +++++++++ testing/mixins/bc/index.html | 3425 +++++++++ testing/mocks/mock-requests/index.html | 3886 ++++++++++ testing/mocks/using-mocks/index.html | 3096 ++++++++ testing/parametrize-tests/index.html | 2971 ++++++++ testing/runing-tests/index.html | 3040 ++++++++ 125 files changed, 231435 insertions(+) create mode 100644 .nojekyll create mode 100644 404.html create mode 100644 advanced/celery/application/index.html create mode 100644 advanced/celery/canvas/index.html create mode 100644 advanced/celery/periodic-tasks/index.html create mode 100644 advanced/celery/routing/index.html create mode 100644 advanced/celery/settings/index.html create mode 100644 apps/activities/index.html create mode 100644 apps/admissions/index.html create mode 100644 apps/monitoring/introduction/index.html create mode 100644 apps/monitoring/scripts/index.html create mode 100644 assets/_mkdocstrings.css create mode 100644 assets/images/favicon.png create mode 100644 assets/javascripts/bundle.fe8b6f2b.min.js create mode 100644 assets/javascripts/bundle.fe8b6f2b.min.js.map create mode 100644 assets/javascripts/lunr/min/lunr.ar.min.js create mode 100644 assets/javascripts/lunr/min/lunr.da.min.js create mode 100644 assets/javascripts/lunr/min/lunr.de.min.js create mode 100644 assets/javascripts/lunr/min/lunr.du.min.js create mode 100644 assets/javascripts/lunr/min/lunr.el.min.js create mode 100644 assets/javascripts/lunr/min/lunr.es.min.js create mode 100644 assets/javascripts/lunr/min/lunr.fi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.fr.min.js create mode 100644 assets/javascripts/lunr/min/lunr.he.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hu.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hy.min.js create mode 100644 assets/javascripts/lunr/min/lunr.it.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ja.min.js create mode 100644 assets/javascripts/lunr/min/lunr.jp.min.js create mode 100644 assets/javascripts/lunr/min/lunr.kn.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ko.min.js create mode 100644 assets/javascripts/lunr/min/lunr.multi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.nl.min.js create mode 100644 assets/javascripts/lunr/min/lunr.no.min.js create mode 100644 assets/javascripts/lunr/min/lunr.pt.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ro.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ru.min.js create mode 100644 assets/javascripts/lunr/min/lunr.sa.min.js create mode 100644 assets/javascripts/lunr/min/lunr.stemmer.support.min.js create mode 100644 assets/javascripts/lunr/min/lunr.sv.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ta.min.js create mode 100644 assets/javascripts/lunr/min/lunr.te.min.js create mode 100644 assets/javascripts/lunr/min/lunr.th.min.js create mode 100644 assets/javascripts/lunr/min/lunr.tr.min.js create mode 100644 assets/javascripts/lunr/min/lunr.vi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.zh.min.js create mode 100644 assets/javascripts/lunr/tinyseg.js create mode 100644 assets/javascripts/lunr/wordcut.js create mode 100644 assets/javascripts/workers/search.b8dbb3d2.min.js create mode 100644 assets/javascripts/workers/search.b8dbb3d2.min.js.map create mode 100644 assets/stylesheets/main.76a95c52.min.css create mode 100644 assets/stylesheets/main.76a95c52.min.css.map create mode 100644 assets/stylesheets/palette.06af60db.min.css create mode 100644 assets/stylesheets/palette.06af60db.min.css.map create mode 100644 css/custom.css create mode 100644 deployment/configuring-the-github-secrets/index.html create mode 100644 deployment/environment-variables/index.html create mode 100644 endpoints/index.html create mode 100644 essential/4geeks/actions/index.html create mode 100644 essential/4geeks/services/first-party/token/index.html create mode 100644 essential/4geeks/services/first-party/using-services/index.html create mode 100644 essential/4geeks/services/first-party/writing-services/index.html create mode 100644 essential/4geeks/services/introduction/index.html create mode 100644 essential/aiohttp/index.html create mode 100644 essential/celery/calling/index.html create mode 100644 essential/celery/introduction/index.html create mode 100644 essential/celery/tasks/index.html create mode 100644 essential/django-rest-framework/introduction/index.html create mode 100644 essential/django-rest-framework/serializers/index.html create mode 100644 essential/django-rest-framework/validators/index.html create mode 100644 essential/django-rest-framework/views/index.html create mode 100644 essential/django/admin/index.html create mode 100644 essential/django/commands/index.html create mode 100644 essential/django/introduction/index.html create mode 100644 essential/django/models/index.html create mode 100644 essential/django/signals/index.html create mode 100644 essential/django/templates/index.html create mode 100644 essential/django/urls/index.html create mode 100644 essential/django/views/index.html create mode 100644 essential/requests/index.html create mode 100644 essential/serpy/index.html create mode 100644 getting-started/setup/works-locally/devcontainer/index.html create mode 100644 getting-started/setup/works-locally/introduction/index.html create mode 100644 getting-started/setup/works-locally/on-host-os/index.html create mode 100644 getting-started/setup/works-on-the-cloud/codespaces/index.html create mode 100644 getting-started/setup/works-on-the-cloud/gitpod/index.html create mode 100644 getting-started/setup/works-on-the-cloud/introduction/index.html create mode 100644 images/codespaces.png create mode 100644 images/dockerhub.PNG create mode 100644 images/github-secrets.PNG create mode 100644 images/vs-button.png create mode 100644 index.html create mode 100644 infrastructure/environment-variables/index.html create mode 100644 infrastructure/infra-env/index.html create mode 100644 infrastructure/journal/index.html create mode 100644 infrastructure/studies/django-workers/index.html create mode 100644 infrastructure/studies/http-clients/index.html create mode 100644 infrastructure/web/index.html create mode 100644 installation/fixtures/index.html create mode 100644 objects.inv create mode 100644 search/search_index.json create mode 100644 security/authentication-class/index.html create mode 100644 security/capabilities/index.html create mode 100644 security/introduction/index.html create mode 100644 security/schema-link/index.html create mode 100644 services/google_cloud/google-cloud-functions/index.html create mode 100644 services/google_cloud/storage/index.html create mode 100644 services/slack integration/icons/index.html create mode 100644 signals/quickstart/index.html create mode 100644 sitemap.xml create mode 100644 sitemap.xml.gz create mode 100644 testing/mixins/bc-cache/index.html create mode 100644 testing/mixins/bc-check/index.html create mode 100644 testing/mixins/bc-database/index.html create mode 100644 testing/mixins/bc-datetime/index.html create mode 100644 testing/mixins/bc-fake/index.html create mode 100644 testing/mixins/bc-format/index.html create mode 100644 testing/mixins/bc-random/index.html create mode 100644 testing/mixins/bc-request/index.html create mode 100644 testing/mixins/bc/index.html create mode 100644 testing/mocks/mock-requests/index.html create mode 100644 testing/mocks/using-mocks/index.html create mode 100644 testing/parametrize-tests/index.html create mode 100644 testing/runing-tests/index.html diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 000000000..e69de29bb diff --git a/404.html b/404.html new file mode 100644 index 000000000..4a69dcfab --- /dev/null +++ b/404.html @@ -0,0 +1,2852 @@ + + + +
+ + + + + + + + + + + + + + +Celery needs an object called application, this object is bound with a set of configurations like the Message Broker or task queue, theoretically you should have many celery apps and bound your tasks to one or many of those apps, actually we had not got any use to this feature and we rather use the shared_task decorator instead which just support one application.
+Read this.
+It where in breathecode/celery.py
.
Celery allows configure some tasks to be executed repeatedly separate by a period of time, it usually did not use in favor of Django commands.
+Read this.
+ + + + + + + + + + + + + +Celery allows set custom routing to call its tasks, it is usually used when you use Celery as a Message Broker, actually use Celery for this purpose is complicated because Celery does not support other Programming languages, so, you would have to use the Message Broker that Celery is using instead.
+Read this.
+ + + + + + + + + + + + + +This API uses Google DataStore as storage, there is not local storage on Heroku or Postgres.
+We need Google DataStore because we plan to store huge amounts of activities that the user can do inside breathecode.
+Possible activities (so far): +
"breathecode_login" //every time it logs in
+"online_platform_registration" //first day using breathecode
+"public_event_attendance" //attendy on an eventbrite event
+"classroom_attendance" //when the student attent to class
+"classroom_unattendance" //when the student miss class
+"lesson_opened" //when a lessons is opened on the platform
+"office_attendance" //when the office raspberry pi detects the student
+"nps_survey_answered" //when a nps survey is answered by the student
+"exercise_success" //when student successfully tests exercise
+
Any activity has the following inputs:
+ +Get recent user activity +
+Add a new user activity (requires authentication) +
POST: activity/user/{email_or_id}
+{
+ 'slug' => 'activity_slug',
+ 'data' => 'any aditional data (string or json-encoded-string)'
+}
+
+💡 Node: You can pass the cohort in the data json object and it will be possible to filter on the activity graph like this:
+
+{
+ 'slug' => 'activity_slug',
+ 'data' => "{ \"cohort\": \"mdc-iii\" }" (json encoded string with the cohort id)
+}
+
Endpoints for the Cohort
+Get recent user activity +
+Endpoints for the coding_error's + +Add a new coding_error (requires authentication)
+POST: activity/coding_error/
+
+{
+ "user_id" => "my@email.com",
+ "slug" => "webpack_error",
+ "data" => "optional additional information about the error",
+ "message" => "file not found",
+ "name" => "module-not-found,
+ "severity" => "900",
+ "details" => "stack trace for the error as string"
+}
+
This module take care of the academic side of breathecode: Students, Cohorts, Course (aka: Certificate), Syllabus, etc. These are some of the things you can do with the breathecode.admissions API:
+TODO: finish this documentation.
+Override previous academies +
+This app is ideal for running diagnostic and reminders on the breathecode platform.
+Setup the monitor app job for once a day, this is the command: +
+Setup the monitor script job for once a day, this is the command: +
+A monitoring script is something that you want to execute recurrently withing the breathecode API, for example:
+scripts/alert_pending_leads.py
is a small python script that checks if there is FormEntry Marketing module database that are pending processing.
You can create a monitoring script to remind academy staff members about things, or to remind students about pending homework, etc.
+./breathecode/monitoring/scripts
#!/usr/bin/env python
+"""
+Alert when there are Form Entries with status = PENDING
+"""
+from breathecode.utils import ScriptNotification
+# start your code here
+
ScriptNotification
to notify for MINOR
or CRITICAL
reasons, for example:# here we are raising a notification because there are 2 pending tasks
+raise ScriptNotification("There are 2 pending taks", status='MINOR', slug="pending_tasks")
+
There are some global variables that you have available during your scripts:
+Variable name | +Value | +
---|---|
academy | +Contains the academy model object, you can use it to retrieve the current academy id like this: query.filter(academy__id=academy.id) |
+
You can test your scripts by running the following command:
+$ python manage.py run_script <file_name>
+
+# For example you can test the alert_pending_leads script like this:
+$ python manage.py run_script alert_pending_leads.py
+
The following script checks for pending leads to process:
+#!/usr/bin/env python
+"""
+Alert when there are Form Entries with status = PENDING
+"""
+from breathecode.marketing.models import FormEntry
+from django.db.models import Q
+from breathecode.utils import ScriptNotification
+
+# check the database for pending leads
+pending_leads = FormEntry.objects.filter(storage_status="PENDING").filter(Q(academy__id=academy.id) | Q(location=academy.slug))
+
+# trigger notification because pending leads were found
+if len(pending_leads) > 0:
+ raise ScriptNotification(f"Warning there are {len(pending_leads)} pending form entries", status='MINOR')
+
+# You can print this and it will show on the script results
+print("No pending leads")
+
from breathecode.monitoring.actions import run_script
+script = run_script(model.monitor_script)
+
+del script['slack_payload']
+del script['title']
+
+expected = {'details': script['details'],
+ 'severity_level': 5,
+ 'status': script['status'],
+ 'text': script['text']
+ }
+
+self.assertEqual(script, expected)
+
+self.assertEqual(self.all_monitor_script_dict(), [{
+ **self.model_to_dict(model, 'monitor_script'),
+}])
+