Skip to content

Commit

Permalink
Improve debugging docs (#3298)
Browse files Browse the repository at this point in the history
  • Loading branch information
thbar authored Jul 10, 2023
1 parent 3363037 commit 7261ad3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
14 changes: 14 additions & 0 deletions learning_track.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@ This guide tracks useful steps to learn how to maintain and modify this system.
* Learn how to run a single test (see readme), as this is very useful for debugging
* :warning: All the tests should pass locally! If they don't, file an issue

### Different techniques to debug stuff

(More will come here later, especially with Elixir 1.15+)

* `IO.puts(x)`
* `IO.inspect(x, IEx.inspect_opts)`
* `dbg` + `iex -S mix phx.server`
* `find apps/transport | entr -c mix run my_script.exs`
* `@tag :focus` and `find debug.exs apps/transport/{lib,test} | entr -c mix cmd --app transport mix test --color --only focus`
* `mix test apps/transport/test/transport/import_data_test.exs --only focus`
* `doctest ImportData, import: true, tags: [:focus]`
* `elixir --sname node -S mix phx.server` and `iex --sname console --remsh node` (https://github.com/etalab/transport-site/pull/2960/files) to connect to a running node and make evaluations (useful to inspect ETS state for instance)
* LiveBook in non-standalone mode (create a notebook then switch from standalone to connected in the settings)

### Understand the "stats" page

* Check out the [/stats](https://transport.data.gouv.fr/stats) page, entry point for bizdev questions on data quality
Expand Down
4 changes: 3 additions & 1 deletion scripts/debugging.livemd
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ asdf reshim elixir
* Lancer livebook en connection au projet, avec la commande suivante:

```
LIVEBOOK_DEFAULT_RUNTIME=mix:. livebook server --open
livebook server
```

* Modifier les réglages pour ne pas utiliser le mode "standalone" mais se connecter à un noeud qui tourne à la place (instructions disponibles dans LiveBook)

## Opérations liées à l'import

Lors de l'ajout d'un dataset en backoffice, on donne l'url "data gouv" du dataset. Le contrôleur reçoit cette url via l'action [POST](https://github.com/etalab/transport-site/blob/605696a5638a1e80be27a674ba201c13f2820b81/apps/transport/lib/transport_web/controllers/backoffice/dataset_controller.ex#L10), puis convertit cette url en "id datagouv" comme suit:
Expand Down

0 comments on commit 7261ad3

Please sign in to comment.