Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Mock server for the eRisk challenge.

License

NotificationsYou must be signed in to change notification settings

jmloyola/erisk_mock_server

Repository files navigation

DOI

eRisk mock server

Mock server for theeRisk challenge.

This server resembles the original eRisk server. It allows teams to:

  • Get writings for a given task.
  • Post the results of a run.

Besides those, the mock servers can:

  • Create new teams (used mainly to experiment with different models and parameters).
  • List the teams in the system.
  • List the teams that have finished processing the input.
  • Get information of a given team.
  • Calculate time aware measures for a given team that have finished processing the input.
  • List the results for the teams that have finished.
  • Get the results of a given team.
  • Graph the final separation plot for a given team.
  • Graph separation plot for a given team and time.
  • Graph score evolution for a given user, team and run.
  • Graph score evolution of a random users for a given team and run.
  • Graph the elapsed time from all the teams that had finished processing the input.
  • Graph the elapsed time from all the selected runs of a team.
  • Show a table with the results of all finished experiments.
  • Graph the time the server took to answer the requests from all the teams that had finished processing the input.
  • Graph the time the server took to answer the GET requests from a team that had finished processing the input.
  • Graph the time the server took to answer the POST requests from a team that had finished processing the input.
  • Graph stats about the time the server took to answer the GET requests from all the teams that had finished processing the input.
  • Graph stats about the time the server took to answer the POST requests from all the teams that had finished processing the input.

Environment set up

To set up the environment we usedminiconda.Once you have miniconda installed, run:

conda env create -f environment.yml

Project configuration

Before running the server, make sure to configure the server editing theconfig.py file.

Corpus structure

We assume that each corpus has the following structure:

  • One line per user.
  • Each line is divided in two parts separated by a tab (\t).The first token represents the class the current user belongs to:"positive" or"negative". Then, all the user documents follow.
  • Each user document is separated by a special token declared in theconfig.py file.Edit theend_of_post_token variable.

Run the server

To run the server use:

uvicorn mock_server:app --host 0.0.0.0 --port 8000

To check all the available endpoints, go to thedocumentation.

Example client

The scriptclient.py shows how to consume the API.This is a simple example that get writings for a task and post a random response.You can get the all the available parameters of the script using:

python -m client --help

Docker image

If you want to use a Docker image to run the mock server, you can follow these steps.

Build the docker image with:

docker build --tag mock_server_image.

Note that if you changed the location of the datasets (the default location isin subfolder called "datasets"), you will have to change the path in theDockerfile.

To check the available docker images, use:

docker image ls

In case you want to remove the created image you can use:

docker image rm mock_server_image

Finally, to run the mock server with a persistent database, use:

docker run --detach --name mock_server --publish 8000:8000 \    --volume mock_server_db:/app/database/ mock_server_image

The--detach option makes the container run in the background. If you want tosee the terminal output directly, you can remove it.

Another way to look at the logs of the container when using the--detach optionis to use:

docker logs mock_server

To check the status of all the containers, use:

docker ps --all

To check the resources used by the container, use:

docker stats mock_server

To stop the container, use:

docker stop --time 2 mock_server

To remove the container, use:

docker rm mock_server

In case a container failed (it is stopped now) and you want to run it again, you will have toremove it. You can remove with the previous commando or, you can prune all stopped instances with:

docker container prune

if you want to inspect the persisted database, you can use:

docker volume inspect mock_server_db

This will tell you the location of the database in your disk.TheMountpoint is the actual location on the disk where the data is stored.


[8]ページ先頭

©2009-2025 Movatter.jp