Skip to content

Commit cf33026

Browse files
committed
remove logfile
1 parent 83db393 commit cf33026

File tree

8 files changed

+11
-45
lines changed

8 files changed

+11
-45
lines changed

configExample.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
"results": "/tmp/MLST/results/",
2222
"_comment": "Report collection folder",
2323
"reports": "/tmp/MLST/reports/",
24-
"_comment": "Log file position and name",
25-
"log_file": "/tmp/microsalt.log",
2624
"_comment": "Root folder for input fasta sequencing data",
2725
"seqdata": "/tmp/projects/",
2826
"_comment": "ST profiles. Each ST profile file under 'profiles' have an identicial folder under references",

microSALT/cli.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
initialize_database,
2323
)
2424
from microSALT.utils.job_creator import Job_Creator
25+
from microSALT.utils.pubmlst.get_credentials import main as get_bigsdb_credentials_main
2526
from microSALT.utils.referencer import Referencer
2627
from microSALT.utils.reporter import Reporter
2728
from microSALT.utils.scraper import Scraper
@@ -99,12 +100,6 @@ def _ensure_directories(config: MicroSALTConfig) -> None:
99100
click.echo("ERROR - Database writing failed! Invalid user access detected!")
100101
sys.exit(-1)
101102

102-
log_dir = os.path.dirname(config.folders.log_file)
103-
if log_dir and not pathlib.Path(log_dir).exists():
104-
os.makedirs(log_dir)
105-
proc = subprocess.Popen(f"touch {config.folders.log_file}".split(), stdout=subprocess.PIPE)
106-
proc.communicate()
107-
108103
folder_paths = [
109104
config.folders.results,
110105
config.folders.reports,
@@ -470,6 +465,15 @@ def report(config: MicroSALTConfig, sampleinfo_file, email, type, output, collec
470465
done()
471466

472467

468+
@utils.command("get-bigsdb-credentials")
469+
@click.argument("service", type=click.Choice(["pubmlst", "pasteur"]))
470+
@click.option("--species", default=None, help="Species name (required for the 'pasteur' service)")
471+
@pass_config
472+
def get_bigsdb_credentials(config: MicroSALTConfig, service, species):
473+
"""Obtain and store BIGSdb OAuth credentials for SERVICE (pubmlst or pasteur)"""
474+
get_bigsdb_credentials_main(service, config, species)
475+
476+
473477
@utils.command()
474478
@click.option("--input", help="Full path to project folder", default=os.getcwd())
475479
@click.pass_context

microSALT/config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ class Regex(BaseModel):
2323
class Folders(BaseModel):
2424
results: str
2525
reports: str
26-
log_file: str
2726
seqdata: str
2827
profiles: str
2928
references: str

microSALT/utils/job_creator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ def finish_job(self, joblist, single_sample=False):
742742
f"-A {self.slurm_header.project} -p core -n 1 -t 6:00:00 "
743743
f"-J {self.slurm_header.job_prefix}_{self.name}_MAILJOB "
744744
f"--qos {self.slurm_header.qos} --open-mode append "
745-
f"--dependency=afterany:{final} --output {self.folders.log_file}"
745+
f"--dependency=afterany:{final} --output {self.finishdir}/mailjob.out"
746746
)
747747
bash_cmd = f"sbatch {head} {mailfile}"
748748
mailproc = subprocess.Popen(bash_cmd.split(), stdout=subprocess.PIPE)

microSALT/utils/pubmlst/get_credentials.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
import os
22
import sys
3-
from argparse import ArgumentParser
43

54
from requests_oauthlib import OAuth1Session
65

76
from microSALT.config import (
8-
Folders,
9-
PasteurCredentials,
10-
PubMLSTCredentials,
11-
load_config,
127
MicroSALTConfig,
138
)
149
from microSALT.utils.pubmlst.constants import CREDENTIALS_KEY
@@ -118,28 +113,3 @@ def main(service: str, config: MicroSALTConfig, species: str | None = None):
118113
except Exception as e:
119114
print(f"Error: {e}")
120115
sys.exit(1)
121-
122-
123-
if __name__ == "__main__":
124-
parser = ArgumentParser(description="Get PubMLST or Pasteur credentials.")
125-
parser.add_argument(
126-
"-s",
127-
"--service",
128-
type=str,
129-
default="pubmlst",
130-
help="Service name (default: pubmlst)",
131-
)
132-
parser.add_argument(
133-
"--species",
134-
type=str,
135-
help="Species name (required for the 'pasteur' service)",
136-
)
137-
parser.add_argument(
138-
"--config",
139-
type=str,
140-
required=True,
141-
help="Path to the microSALT configuration JSON file.",
142-
)
143-
args = parser.parse_args()
144-
cfg = load_config(args.config)
145-
main(args.service, cfg, args.species)

tests/conftest.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ def config(tmp_path_factory: pytest.TempPathFactory) -> MicroSALTConfig:
3939
for d in (results, reports, seqdata, profiles, references, resistances, genomes, credentials):
4040
d.mkdir(parents=True, exist_ok=True)
4141

42-
log_file = base / "microsalt.log"
4342
db_path = base / "microsalt.db"
4443

4544
cfg = MicroSALTConfig(
@@ -59,7 +58,6 @@ def config(tmp_path_factory: pytest.TempPathFactory) -> MicroSALTConfig:
5958
folders=Folders(
6059
results=str(results),
6160
reports=str(reports),
62-
log_file=str(log_file),
6361
seqdata=str(seqdata),
6462
profiles=str(profiles),
6563
references=str(references),
@@ -130,7 +128,6 @@ def exp_config():
130128
"folders": {
131129
"results",
132130
"reports",
133-
"log_file",
134131
"seqdata",
135132
"profiles",
136133
"references",

tests/test_cli.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ def setup_config(tmp_path: Path) -> MicroSALTConfig:
5151
folders=Folders(
5252
results=str(base / "results"),
5353
reports=str(base / "reports"),
54-
log_file=str(base / "microsalt.log"),
5554
seqdata=str(base / "seqdata"),
5655
profiles=str(base / "profiles"),
5756
references=str(base / "references"),

tests/test_config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ def test_folders_fields():
4646
cfg = load_config(CONFIGEXAMPLE)
4747
assert cfg.folders.results
4848
assert cfg.folders.reports
49-
assert cfg.folders.log_file
5049
assert cfg.folders.seqdata
5150
assert cfg.folders.profiles
5251
assert cfg.folders.references

0 commit comments

Comments
 (0)