Skip to content

Commit

Permalink
fixed minore issues in the application and added further documentatio…
Browse files Browse the repository at this point in the history
…n on frontend development
  • Loading branch information
TheMrSheldon committed Aug 30, 2024
1 parent 5c4bd8e commit d8025f6
Show file tree
Hide file tree
Showing 17 changed files with 257 additions and 276 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Run backend tests
- name: Install dependencies
working-directory: ${{github.workspace}}/application
run: |
# Create a dummy DISRAPTOR_API_KEY
sudo bash -c 'mkdir -p "/etc/discourse/" && echo "I am so secret" > "/etc/discourse/client-api-key"'
pip3 install -e .[dev,test]
make setup
make tests
- name: Run backend tests
working-directory: ${{github.workspace}}/application/test
run: pytest

frontend-tests:
runs-on: ubuntu-latest
Expand Down
5 changes: 0 additions & 5 deletions application/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ help:
@echo " run the tira server"
@echo "make tests"
@echo " run all tests (automatically done in Github Actions on each commit)"
@echo "make vite-build"
@echo " build and test the frontnend client code"
@echo "make build-docker"
@echo " build the docker containers for deployment"
@echo "make clean"
Expand All @@ -31,9 +29,6 @@ setup:
python3 src/manage.py migrate tira
python3 src/manage.py index_model

tests:
./test/run_all_tests.sh

run-develop:
python3 src/manage.py makemigrations \
&& python3 src/manage.py migrate --fake \
Expand Down
3 changes: 0 additions & 3 deletions application/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ Run `make` to get an overview of all commands that will setup a self-contained t

4. Optionally: Change the configuration (the settings used for the development setup are: `tira/application/config/settings-dev.yml`)

## Frontend Development

Build the frontend code via `make vite-build`

## Docker

Expand Down
10 changes: 0 additions & 10 deletions application/src/django_admin/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"django_filters",
"rest_framework",
"rest_framework_json_api",
Expand Down Expand Up @@ -388,15 +387,6 @@ def logger_config(log_dir: Path):

USE_TZ = True

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/

STATIC_URL = "/public/"

STATICFILES_DIRS = [BASE_DIR / "tira/static/"]

STATIC_ROOT = "/var/www/public"

WEBPACK_LOADER = {
"DEFAULT": {
"CACHE": DEBUG,
Expand Down
4 changes: 1 addition & 3 deletions application/src/django_admin/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""

from django.conf import settings
from django.conf.urls.static import static
from django.urls import include, path

urlpatterns = [
path("", include("tira.urls")),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
]
6 changes: 3 additions & 3 deletions application/src/tira/data/HybridDatabase.py
Original file line number Diff line number Diff line change
Expand Up @@ -1568,7 +1568,7 @@ def add_vm(self, vm_id, user_name, initial_user_password, ip, host, ssh, rdp):
vm_id=vm_id, user_password=initial_user_password, roles="user", host=host, ip=ip, ssh=ssh, rdp=rdp
)
except IntegrityError as e:
logger.exception(f"Failed to add new vm {vm_id} with ", e)
logger.exception(f"Failed to add new vm {vm_id} with ",exc_info= e)
raise TiraModelIntegrityError(e)
else:
raise TiraModelWriteError(f"Failed to write VM {vm_id}")
Expand Down Expand Up @@ -2264,7 +2264,7 @@ def update(x, y):

self._save_run(dataset_id, vm_id, run_id, run)
except Exception as e:
raise TiraModelWriteError(f"Exception while saving run ({dataset_id}, {vm_id}, {run_id})", e)
raise TiraModelWriteError(f"Exception while saving run ({dataset_id}, {vm_id}, {run_id})", exc_info=e)

def _fdb_edit_task(
self,
Expand Down Expand Up @@ -2529,7 +2529,7 @@ def delete_dataset(self, dataset_id):
# self._fdb_delete_evaluator_from_vm(vm_id, evaluator_id)
# except AttributeError as e:
# logger.exception(f"Exception deleting evaluator while deleting dataset {dataset_id}. "
# f"Maybe It never existed?", e)
# f"Maybe It never existed?", exc_info=e)
# self._fdb_delete_dataset_from_task(task_id, dataset_id)
# self._fdb_delete_dataset(task_id, dataset_id)
# ds.delete()
Expand Down
6 changes: 3 additions & 3 deletions application/src/tira/data/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ def parse_run(runs_dir_path, dataset_id, vm_id, run_id):
except modeldb.VirtualMachine.DoesNotExist as e:
# If the vm was deleted but runs still exist, we land here. We skip indexing these runs.
msg = f"Skip run {run_id}: VM {vm_id} does not exist"
logger.exception(msg, e)
logger.exception(msg, exc_info=e)
return msg

# Error Correction: Skip runs where Dataset no not exist anymore
Expand All @@ -372,7 +372,7 @@ def parse_run(runs_dir_path, dataset_id, vm_id, run_id):
except modeldb.Dataset.DoesNotExist as e:
# If the dataset was deleted, but there are still runs left.
msg = f"Skip run {run_id}: Dataset {run_proto.inputDataset} does not exist {e}"
logger.exception(msg, e)
logger.exception(msg, exc_info=e)
return msg

# Error Correction. If run files dont add a task_id (which is optional), we use the default task of the dataset
Expand All @@ -388,7 +388,7 @@ def parse_run(runs_dir_path, dataset_id, vm_id, run_id):

except Exception as e:
msg = f"Skip run {run_id}: Creation of run had an unexpected ErrorRun: {run_proto}"
logger.exception(msg, e)
logger.exception(msg, exc_info=e)
return msg

# If this run has an input run (i.e. it's an evaluation) we set the reference here.
Expand Down
2 changes: 1 addition & 1 deletion application/src/tira/endpoints/admin_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def decorate(request, *args, **kwargs):
msg = func(*args, **kwargs)
return JsonResponse({"status": 0, "message": msg}, status=HTTPStatus.OK)
except Exception as e:
logger.exception(f"{func.__name__} failed with {e}", e)
logger.exception(f"{func.__name__} failed with {e}", exc_info=e)
return JsonResponse(
{"status": 1, "message": f"{func.__name__} failed with {e}"},
status=HTTPStatus.INTERNAL_SERVER_ERROR,
Expand Down
4 changes: 2 additions & 2 deletions application/src/tira/git_runner_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ def get_manifest_of_docker_image_image_repository(self, repository_name, tag, ca
"digest": image_metadata["config"]["digest"].split(":")[-1][:12],
}
except Exception as e:
logger.warn("Exception during loading of metadata for docker image", e)
logger.warn("Exception during loading of metadata for docker image", exc_info=e)
ret = {
"architecture": "Loading...",
"created": "Loading...",
Expand Down Expand Up @@ -1221,7 +1221,7 @@ def extract_job_configuration(self, gl_project, branch):
if len(i.split("=")) == 2
}
except Exception as e:
logger.warn(f'Could not extract job configuration on "{branch}".', e)
logger.warn(f'Could not extract job configuration on "{branch}".', exc_info=e)
pass

if (
Expand Down
2 changes: 1 addition & 1 deletion application/src/tira/management/commands/cache_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def keep_running_softwares_fresh(self, sleep_time):
)
except Exception as e:
print(f"Exception during refreshing the repository {git_repository_id}: e")
logger.warn(f"Exception during refreshing the repository {git_repository_id}", e)
logger.warn(f"Exception during refreshing the repository {git_repository_id}", exc_info=e)
continue

time.sleep(0.1)
Expand Down
10 changes: 0 additions & 10 deletions application/test/settings_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"django_filters",
"rest_framework",
"rest_framework_json_api",
Expand Down Expand Up @@ -305,15 +304,6 @@ def logger_config(log_dir: Path):

USE_TZ = True

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/

STATIC_URL = "/public/"

STATICFILES_DIRS = [BASE_DIR / "src" / "static/", BASE_DIR / "src" / "tira" / "static/"]

STATIC_ROOT = "/var/www/public"

WEBPACK_LOADER = {
"DEFAULT": {
"CACHE": DEBUG,
Expand Down
Binary file modified application/test/test-coverage/.coverage
Binary file not shown.
74 changes: 61 additions & 13 deletions documentation/development/frontend/index.rst
Original file line number Diff line number Diff line change
@@ -1,24 +1,72 @@
Frontend Development
====================

Getting Started
---------------
.. hint:: This page generally describes **two ways** of achieving the same thing: Using VSCode and using the shell. For
general development, we **highly recommend** using the VSCode integration unless it does not work for you or a
shell is required. Simply set the tab to the version you will work with, they a synchronized through the magic of
technology.



.. rubric:: Getting Started

To get started, please read and follow the instructions of the :ref:`DevEnvPage` section.

Code Testing
------------
Open a shell within the ``frontend`` directory and run

.. code:: bash
.. tab-set::

.. tab-item:: VSCode

.. _launchfrontend:

.. dropdown:: :octicon:`rocket` Launching the Frontend

.. todo:: TODO

.. dropdown:: :octicon:`beaker` Code Testing

.. todo:: TODO

.. dropdown:: :fab:`hammer` Building the Static Frontend

.. attention:: This step can only be performed via shell and is only really useful for deployment. If
you simply want to launch the frontend for debugging, have a look at
:ref:`Launching the Frontend <launchfrontend>`.

yarn test
.. tab-item:: Shell

.. dropdown:: :octicon:`rocket` Launching the Frontend

Open a shell within the ``frontend`` directory and run

.. code:: bash
yarn dev
.. dropdown:: :octicon:`beaker` Code Testing

Open a shell within the ``frontend`` directory and run

.. code:: bash
yarn test
.. dropdown:: :fab:`hammer` Building the Static Frontend

Open a shell within the ``frontend`` directory and either run

.. code:: bash
yarn build-light
.. rubric:: Linting

.. note:: We don't currently have any linters

Linting
-------

.. todo:: We don't currently have any linters

FAQ
---
.. rubric:: Frequently Asked Questions

Yay, no questions yet.
No questions yet :material-regular:`mood;1.5em;sd-text-success`.
8 changes: 0 additions & 8 deletions frontend/.devcontainer.json

This file was deleted.

28 changes: 0 additions & 28 deletions frontend/Makefile

This file was deleted.

33 changes: 5 additions & 28 deletions frontend/README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,7 @@
# TIRA Vuetify Frontend
# TIRA Frontend

Start with `yarn dev`.
To get started, please read our developer documentation on...
- [... setting up the development environment](https://tira-io.github.io/tira/nightly/development/devenvironment.html)
- [... developing the frontend](https://tira-io.github.io/tira/nightly/development/frontend/index.html)

Go to [http://127.0.0.1:3000/#/tasks](http://127.0.0.1:3000/#/tasks) for plain and to [http://127.0.0.1:3000/index-discourse.html#/tasks](http://127.0.0.1:3000/index-discourse.html#/tasks) for discourse adjusted development.

## Project setup

```
# yarn
yarn
```

### Compiles and hot-reloads for development

```
# yarn
yarn dev
```

### Compiles and minifies for production

```
# yarn
yarn build
```

### Customize configuration

See [Configuration Reference](https://vitejs.dev/config/).
the latter link contains all you need to know to navigate the development lifecycle.
Loading

0 comments on commit d8025f6

Please sign in to comment.