attempt to use memray

This commit is contained in:
Inex Code 2024-11-11 06:23:29 +03:00
parent 4cd90d0c93
commit 1f6a538e9f
4 changed files with 12 additions and 8 deletions

View file

@ -1,4 +1,4 @@
{ pythonPackages, rev ? "local" }:
{ pythonPackages, rev ? "local", pkgs }:
pythonPackages.buildPythonPackage rec {
pname = "selfprivacy-graphql-api";
@ -22,6 +22,7 @@ pythonPackages.buildPythonPackage rec {
requests
websockets
httpx
pkgs.memray
];
pythonImportsCheck = [ "selfprivacy_api" ];
doCheck = false;

View file

@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1721949857,
"narHash": "sha256-DID446r8KsmJhbCzx4el8d9SnPiE8qa6+eEQOJ40vR0=",
"lastModified": 1731295185,
"narHash": "sha256-RaK3jMQ6X8FVESUSURB2An9FYmCfh3nEy8sUyxc/nJk=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "a1cc729dcbc31d9b0d11d86dc7436163548a9665",
"rev": "87e3803821210c537acfce075adf5cd030e963b3",
"type": "github"
},
"original": {

View file

@ -8,8 +8,9 @@
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
selfprivacy-graphql-api = pkgs.callPackage ./default.nix {
pythonPackages = pkgs.python312Packages;
pythonPackages = pkgs.python311Packages;
rev = self.shortRev or self.dirtyShortRev or "dirty";
pkgs = pkgs;
};
python = self.packages.${system}.default.pythonModule;
python-env =
@ -29,6 +30,7 @@
pyflakes
typer # for strawberry
types-redis # for mypy
pkgs.memray
] ++ strawberry-graphql.optional-dependencies.cli));
vmtest-src-dir = "/root/source";

View file

@ -45,12 +45,13 @@ in
pkgs.util-linux
pkgs.e2fsprogs
pkgs.iproute2
pkgs.memray
];
after = [ "network-online.target" ];
wantedBy = [ "network-online.target" ];
serviceConfig = {
User = "root";
ExecStart = "${selfprivacy-graphql-api}/bin/app.py";
ExecStart = "${pkgs.memray}/bin/memray --trace-python-allocators --live-remote ${selfprivacy-graphql-api}/bin/app.py";
Restart = "always";
RestartSec = "5";
};
@ -61,7 +62,7 @@ in
HOME = "/root";
PYTHONUNBUFFERED = "1";
PYTHONPATH =
pkgs.python312Packages.makePythonPath [ selfprivacy-graphql-api ];
pkgs.python311Packages.makePythonPath [ selfprivacy-graphql-api ];
} // config.networking.proxy.envVars;
path = [
"/var/"
@ -82,7 +83,7 @@ in
wantedBy = [ "network-online.target" ];
serviceConfig = {
User = "root";
ExecStart = "${pkgs.python312Packages.huey}/bin/huey_consumer.py selfprivacy_api.task_registry.huey";
ExecStart = "${pkgs.python311Packages.huey}/bin/huey_consumer.py selfprivacy_api.task_registry.huey";
Restart = "always";
RestartSec = "5";
};