Skip to content

Commit 61dd0cb

Browse files
authored
OJ-45476: refactor how we get output dir size (#406)
* OJ-45476: refactor how we get output dir size * OJ-45476: add back in config outdir * OJ-45476: attempt to fix dependency problems
1 parent 2f67278 commit 61dd0cb

4 files changed

Lines changed: 36 additions & 143 deletions

File tree

.github/workflows/pr-checks.yml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,26 @@ name: Python application
55

66
on:
77
push:
8-
branches: [ "master" ]
8+
branches: ["master"]
99
pull_request:
10-
branches: [ "master" ]
10+
branches: ["master"]
1111

1212
permissions:
1313
contents: read
1414

1515
jobs:
1616
build:
17-
1817
runs-on: ubuntu-latest
1918

2019
steps:
21-
- uses: actions/checkout@v4
22-
- name: Set up Python 3.10
23-
uses: actions/setup-python@v3
24-
with:
25-
python-version: "3.10"
26-
- name: Install dependencies
27-
run: |
28-
sudo apt-get install libkrb5-dev && pip install pdm && pdm install --dev
29-
- name: Tests (pytest)
30-
run: |
31-
pdm run python -m pytest
20+
- uses: actions/checkout@v4
21+
- name: Set up Python 3.10
22+
uses: actions/setup-python@v3
23+
with:
24+
python-version: "3.10"
25+
- name: Install dependencies
26+
run: |
27+
pip install pdm && pdm install --dev
28+
- name: Tests (pytest)
29+
run: |
30+
pdm run python -m pytest

jf_agent/validation.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
import logging
22
import os
33
import shutil
4+
import subprocess
45
import traceback
56
from typing import Optional
67

78
import psutil
89
import requests
9-
from jf_agent.config_file_reader import get_ingest_config
10-
from jf_agent.data_manifests.git.generator import get_instance_slug
11-
from jf_agent.git import GithubGqlClient, get_git_client, get_nested_repos_from_git
12-
from jf_agent.util import upload_file
1310
from jf_ingest.validation import (
1411
GitConnectionHealthCheckResult,
1512
IngestionHealthCheckResult,
@@ -20,6 +17,10 @@
2017
)
2118

2219
from jf_agent import write_file
20+
from jf_agent.config_file_reader import get_ingest_config
21+
from jf_agent.data_manifests.git.generator import get_instance_slug
22+
from jf_agent.git import GithubGqlClient, get_git_client, get_nested_repos_from_git
23+
from jf_agent.util import upload_file
2324

2425
logger = logging.getLogger(__name__)
2526

@@ -173,7 +174,12 @@ def validate_memory(config):
173174
f" Available memory: {round(psutil.virtual_memory().available / (1024 * 1024), 2)} MB"
174175
)
175176

176-
output_dir_size = os.popen(f'du -hs {config.outdir}').readlines()[0].split("\t")[0]
177+
proc = subprocess.run(
178+
['du', '-hs', os.path.expanduser(config.outdir)],
179+
encoding='utf-8',
180+
stdout=subprocess.PIPE,
181+
)
182+
output_dir_size = proc.stdout.split("\t")[0]
177183
usage = shutil.disk_usage(config.outdir)
178184

179185
print(

pdm.lock

Lines changed: 11 additions & 123 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ dependencies = [
2020
"python-dotenv>=1.0.0",
2121
"structlog>=24.4.0",
2222
"colorama>=0.4.6",
23-
"jf-ingest==0.0.214",
23+
"jf-ingest==0.0.218",
2424
]
2525
requires-python = "~=3.10.15"
2626
readme = "README.md"

0 commit comments

Comments
 (0)