Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor the renee python package and move the GUI here #94

Merged
merged 40 commits into from
Aug 6, 2024

Conversation

kelly-sovacool
Copy link
Member

@kelly-sovacool kelly-sovacool commented Jan 16, 2024

Changes

Moves the renee GUI from the ccbrpipeliner repo to this one (see src/renee/gui.py). The launch_gui() function (previously the main function of the GUI script in ccbrpipeliner) calls run() directly instead of using subprocess. Now the gui is a subcommand of renee and is launched by running renee gui. Various static global variables and environmental variables are now setup dynamically with helper functions.

Also:

  • Breaks up some of the functions from __main__.py to separate modules to prevent circular imports.
  • Dynamically sets the default singularity sif cache depending on the HPC.

testing

To test the GUI, switch to this branch and run ./bin/renee gui.

Issues

PR Checklist

(Strikethrough any points that are not applicable.)

  • This comment contains a description of changes with justifications, with any relevant issues linked.
  • Update docs if there are any API changes.
  • Update CHANGELOG.md with a short description of any user-facing changes and reference the PR number. Guidelines: https://keepachangelog.com/en/1.1.0/

@kelly-sovacool kelly-sovacool marked this pull request as draft January 16, 2024 03:03
@kopardev kopardev added the RENEE RepoName label Jan 16, 2024
@kelly-sovacool
Copy link
Member Author

kelly-sovacool commented Aug 2, 2024

need to wait for package structure changes from #139 before we can continue with this

Update: it's merged now

@kelly-sovacool kelly-sovacool changed the title Refactor renee GUI Refactor the renee python package and move the GUI here Aug 2, 2024
@kelly-sovacool kelly-sovacool marked this pull request as ready for review August 2, 2024 23:26
@kelly-sovacool kelly-sovacool self-assigned this Aug 2, 2024
@kopardev
Copy link
Member

kopardev commented Aug 5, 2024

@samarth8392 .. Looks good to me ... can you please re-look and approve?

@samarth8392
Copy link
Contributor

samarth8392 commented Aug 5, 2024

I tried testing the gui using ./bin/renee gui and doing a dryrun. I get the following error.

Take a look here:

tmp_dir=get_tmp_dir(),

/data/CCBR_Pipeliner/db/PipeDB/Conda/envs/py311/lib/python3.11/tkinter/__init__.py:1531: ResourceWarning: unclosed <socket.socket fd=5, family=2, type=1, proto=0, laddr=('0.0.0.0', 0)>
  for k, v in cnf.items():
ResourceWarning: Enable tracemalloc to get the object allocation traceback
window created!
--SUBMIT-- {'--INDIR--': '/data/mathurs2/input', 'Browse': '/data/mathurs2/input', '--OUTDIR--': '/data/mathurs2/output', 'Browse0': '', '--ANNOTATION--': 'hg38_45'}
['/data/mathurs2/input/sample1-tumor.R2.fastq.gz', '/data/mathurs2/input/sample1-normal.R2.fastq.gz', '/data/mathurs2/input/sample1-normal.R1.fastq.gz', '/data/mathurs2/input/sample1-tumor.R1.fastq.gz']
Traceback (most recent call last):
  File "/vf/users/CCBR/projects/techDev/RENEE/main.py", line 16, in <module>
    sys.exit(main())
             ^^^^^^
  File "/vf/users/CCBR/projects/techDev/RENEE/src/renee/__main__.py", line 1479, in main
    args.func(args)
  File "/vf/users/CCBR/projects/techDev/RENEE/src/renee/gui.py", line 178, in launch_gui
    tmp_dir=get_tmp_dir(),
            ^^^^^^^^^^^^^
TypeError: get_tmp_dir() missing 2 required positional arguments: 'tmp_dir' and 'outdir'


@kelly-sovacool
Copy link
Member Author

I tried testing the gui using ./bin/renee gui and doing a dryrun. I get the following error.

Take a look here:

tmp_dir=get_tmp_dir(),

/data/CCBR_Pipeliner/db/PipeDB/Conda/envs/py311/lib/python3.11/tkinter/__init__.py:1531: ResourceWarning: unclosed <socket.socket fd=5, family=2, type=1, proto=0, laddr=('0.0.0.0', 0)>
  for k, v in cnf.items():
ResourceWarning: Enable tracemalloc to get the object allocation traceback
window created!
--SUBMIT-- {'--INDIR--': '/data/mathurs2/input', 'Browse': '/data/mathurs2/input', '--OUTDIR--': '/data/mathurs2/output', 'Browse0': '', '--ANNOTATION--': 'hg38_45'}
['/data/mathurs2/input/sample1-tumor.R2.fastq.gz', '/data/mathurs2/input/sample1-normal.R2.fastq.gz', '/data/mathurs2/input/sample1-normal.R1.fastq.gz', '/data/mathurs2/input/sample1-tumor.R1.fastq.gz']
Traceback (most recent call last):
  File "/vf/users/CCBR/projects/techDev/RENEE/main.py", line 16, in <module>
    sys.exit(main())
             ^^^^^^
  File "/vf/users/CCBR/projects/techDev/RENEE/src/renee/__main__.py", line 1479, in main
    args.func(args)
  File "/vf/users/CCBR/projects/techDev/RENEE/src/renee/gui.py", line 178, in launch_gui
    tmp_dir=get_tmp_dir(),
            ^^^^^^^^^^^^^
TypeError: get_tmp_dir() missing 2 required positional arguments: 'tmp_dir' and 'outdir'

Thanks for reporting this! I believe I've fixed it now

@samarth8392
Copy link
Contributor

Thanks for updating the two util functions. Now the error is coming from

if sub_args.wait:

and
allout = run_in_context(run_args)

I think --wait must be added to the run_args ??

Traceback (most recent call last):
  File "/vf/users/CCBR/projects/techDev/RENEE/main.py", line 16, in <module>
    sys.exit(main())
             ^^^^^^
  File "/vf/users/CCBR/projects/techDev/RENEE/src/renee/__main__.py", line 1477, in main
    args.func(args)
  File "/vf/users/CCBR/projects/techDev/RENEE/src/renee/gui.py", line 185, in launch_gui
    allout = run_in_context(run_args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/vf/users/CCBR/projects/techDev/RENEE/src/renee/gui.py", line 243, in run_in_context
    run(args)
  File "/vf/users/CCBR/projects/techDev/RENEE/src/renee/run.py", line 59, in run
    if sub_args.wait:
       ^^^^^^^^^^^^^
AttributeError: 'Namespace' object has no attribute 'wait'

@kelly-sovacool
Copy link
Member Author

ok, I'm working through a couple more errors after this one, will let you know when it's working on my end

@kelly-sovacool
Copy link
Member Author

Yes I'm working on going through and adding all the sub_args. I thought those with defaults would be automatically populated, but I guess that only happens via the CLI.

@samarth8392
Copy link
Contributor

Thanks Kelly for fixing those errors, now it's related to SIF cache dir.

Traceback (most recent call last):
  File "/vf/users/CCBR/projects/techDev/RENEE/main.py", line 16, in <module>
    sys.exit(main())
             ^^^^^^
  File "/vf/users/CCBR/projects/techDev/RENEE/src/renee/__main__.py", line 1477, in main
    args.func(args)
  File "/vf/users/CCBR/projects/techDev/RENEE/src/renee/gui.py", line 180, in launch_gui
    singularity_cache=os.environ["SINGULARITY_CACHEDIR"],
                      ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen os>", line 679, in __getitem__
KeyError: 'SINGULARITY_CACHEDIR'

same behavior as before, just moved this from orchestrate() to its own function for the GUI to use too
@samarth8392
Copy link
Contributor

Yeyy! The dryrun works now. I didn't submit a full run but I don't think there should be any issues there. If this is good enough, send me a 👍 and I will approve the PR and merge the branches.

@kelly-sovacool
Copy link
Member Author

Yeyy! The dryrun works now. I didn't submit a full run but I don't think there should be any issues there. If this is good enough, send me a 👍 and I will approve the PR and merge the branches.

I think it is worthwhile to try submitting a full run just in case, since we don't have any unit tests for that section of the code

@samarth8392
Copy link
Contributor

samarth8392 commented Aug 6, 2024

I just submitted a full test run, all the rules worked file but jobby failed.

run_jobby_on_snakemake_log: command not found

I think this is a RENEE issue because the file is in resources folder so it should be os.path.join('resources', 'run_jobby_on_snakemake_log'

jobby_cmd = "run_jobby_on_snakemake_log " + join('logfiles', 'snakemake.log') + " | tee " + join('logfiles', 'snakemake.log.jobby') + " | cut -f2,3,18 > " + join('logfiles', 'snakemake.log.jobby.short')

also for spooker

run_jobby_on_snakemake_log logfiles/snakemake.log | tee logfiles/snakemake.log.jobby | cut -f2,3,18 > logfiles/snakemake.log.jobby.short
/usr/bin/bash: run_jobby_on_snakemake_log: command not found
CalledProcessError in file /data/BandayLab/CABO-exome-seq-Andrea/mathurs2/ccbr1332/test/output/workflow/Snakefile, line 241:
Command 'set -euo pipefail;  run_jobby_on_snakemake_log logfiles/snakemake.log | tee logfiles/snakemake.log.jobby | cut -f2,3,18 > logfiles/snakemake.log.jobby.short' returned non-zero exit status 127.
  File "/data/BandayLab/CABO-exome-seq-Andrea/mathurs2/ccbr1332/test/output/workflow/Snakefile", line 241, in __onsuccess
OnSuccess
run_jobby_on_snakemake_log logfiles/snakemake.log | tee logfiles/snakemake.log.jobby | cut -f2,3,18 > logfiles/snakemake.log.jobby.short

@kelly-sovacool
Copy link
Member Author

kelly-sovacool commented Aug 6, 2024

I just submitted a full test run, all the rules worked file but jobby failed.

run_jobby_on_snakemake_log: command not found

I think this is a RENEE issue because the file is in resources folder so it should be os.path.join('resources', 'run_jobby_on_snakemake_log'

run_jobby_on_snakemake_log logfiles/snakemake.log | tee logfiles/snakemake.log.jobby | cut -f2,3,18 > logfiles/snakemake.log.jobby.short
/usr/bin/bash: run_jobby_on_snakemake_log: command not found
CalledProcessError in file /data/BandayLab/CABO-exome-seq-Andrea/mathurs2/ccbr1332/test/output/workflow/Snakefile, line 241:
Command 'set -euo pipefail;  run_jobby_on_snakemake_log logfiles/snakemake.log | tee logfiles/snakemake.log.jobby | cut -f2,3,18 > logfiles/snakemake.log.jobby.short' returned non-zero exit status 127.
  File "/data/BandayLab/CABO-exome-seq-Andrea/mathurs2/ccbr1332/test/output/workflow/Snakefile", line 241, in __onsuccess
OnSuccess
run_jobby_on_snakemake_log logfiles/snakemake.log | tee logfiles/snakemake.log.jobby | cut -f2,3,18 > logfiles/snakemake.log.jobby.short

This is expected behavior if you did not run module load ccbrpipeliner before submitting the run.

We are no longer using the jobby file in the resources directory, instead we'd like to have "single source" of jobby (and spooker) which is added to the path when you load ccbrpipeliner.

@samarth8392
Copy link
Contributor

This is expected behavior if you did not run module load ccbrpipeliner before submitting the run.

We are no longer using the jobby file in the resources directory, instead we'd like to have "single source" of jobby (and spooker) which is added to the path when you load ccbrpipeliner.

Okay! Thanks!! In that case the test run was successful and I can now approve the PR. Great job @kelly-sovacool :)

@samarth8392 samarth8392 merged commit 39938fd into main Aug 6, 2024
5 checks passed
@samarth8392 samarth8392 deleted the refactor-renee-gui branch August 6, 2024 21:07
@kelly-sovacool
Copy link
Member Author

Go team!

@kelly-sovacool kelly-sovacool added this to the 2024-08 milestone Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use shared singularity cache dir on biowulf and frce
3 participants