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

Resolve "Create Script to Snapshot Compadre into Trilinos" #176

Merged
merged 3 commits into from
Apr 20, 2020
Merged

Resolve "Create Script to Snapshot Compadre into Trilinos" #176

merged 3 commits into from
Apr 20, 2020

Conversation

jmgate
Copy link
Collaborator

@jmgate jmgate commented Mar 25, 2020

Create script to snapshot the Compadre repository containing the script into the Trilinos pointed to on the command line, excluding the kokkos, kokkos-kernels, python, and scripts directories, utilizing the SnapshotDir utility from TriBITS under the hood.

Closes #175.

@jmgate jmgate requested a review from kuberry March 25, 2020 14:57
@jmgate jmgate self-assigned this Mar 25, 2020
@jmgate jmgate added the feature request New feature label Mar 25, 2020
@jmgate
Copy link
Collaborator Author

jmgate commented Mar 25, 2020

@kuberry, this is ready for review if you want to take a look at it. Unfortunately you won't be able to test it yet, because we are waiting for TriBITS#308 to be merged, and then I also need to do some work to make the SnapshotDir utility in TriBITS Python 3 compatible (shouldn't take long).

Let me know if you have any questions/comments/feedback.

@jmgate
Copy link
Collaborator Author

jmgate commented Mar 25, 2020

The other PR we're waiting on is TriBITS#311. After that and TriBITS#308 are merged, and then after TriBITS is snapshotted into Trilinos, you'll be able to test this script for real.

Create script to snapshot the Compadre repository containing the script
into the Trilinos pointed to on the command line, excluding the kokkos,
kokkos-kernels, python, and scripts directories, utilizing the
SnapshotDir utility from TriBITS under the hood.
@kuberry
Copy link
Collaborator

kuberry commented Mar 31, 2020

Hi @jmgate, should I just wait until TriBITS #311 and TriBITS #308 are merged to try it out?

@jmgate
Copy link
Collaborator Author

jmgate commented Mar 31, 2020

Yes, we'll need those to be merged and then snapshotted into Trilinos before this script will work, but you can comment / ask questions on the script now.

@jmgate
Copy link
Collaborator Author

jmgate commented Apr 7, 2020

TriBITS#308 and TriBITS#311 have been merged, but now we need to wait for Trilinos#7136 to snapshot TriBITS into Trilinos before we can test this script.

@jmgate
Copy link
Collaborator Author

jmgate commented Apr 9, 2020

@kuberry, TriBITS has been updated within Trilinos, so you should be able to test this out. Here's the help:

usage: snapshot_into_trilinos.py [-h] -t TRILINOS_DIR [-d]

----------------------[ Snapshot Compadre Into Trilinos ]----------------------

Create a snapshot from the Compadre repository containing this script into the
Trilinos repository pointed to, omitting the kokkos, kokkos-kernels, python,
and scripts directories.

Note:  This will assert that both repositories are in a clean state.

Warning:  This will clean out any locally-ignored files in Compadre (e.g.,
    ignored via .git/info/exclude) to avoid copying them over and then
    committing them to Trilinos.  Be sure you don't have any ignored files in
    Compadre that you want to keep before running this script.

To test this script to ensure that it's working correctly, simply use

    pytest snapshot_into_trilinos.py

optional arguments:
  -h, --help            show this help message and exit
  -t TRILINOS_DIR, --trilinos-dir TRILINOS_DIR
                        The path (relative or absolute) to the root of the
                        Trilinos repository you wish to snapshot Compadre
                        into.
  -d, --dry-run         Show what will happen, but don't actually do it.

----------------------------------[ Examples ]---------------------------------

Show what's going to happen without actually doing the snapshot::

    ./snapshot_into_trilinos.py \
        --trilinos-dir /path/to/Trilinos \
        --dry-run

Actually do the snapshot::

    ./snapshot_into_trilinos.py \
        --trilinos-dir /path/to/Trilinos

We're not ready to actually snapshot Compadre into Trilinos yet, so once you've tested that the snapshot works, you probably don't want to push anything anywhere. If you want to remove the snapshot commit from your local clone of Trilinos, just git reset --hard HEAD^.

@kuberry
Copy link
Collaborator

kuberry commented Apr 10, 2020

Hi @jmgate, so I want to clone Trilinos and checkout develop or master? Then, I go into the compadre repo and run the commands you specified?

@jmgate
Copy link
Collaborator Author

jmgate commented Apr 13, 2020

Best way to do it would be to checkout some branch off of develop. If you're starting from scratch:

git clone [email protected]:trilinos/Trilinos
cd Trilinos
git checkout develop
git checkout -b compadre-snapshot
mkdir -p packages/compadre # This will only need to be done the first time so the directory exists.
/path/to/compadre/scripts/snapshot_into_trilinos.py --trilinos-dir . --dry-run

Let me know if any of the documentation or testing needs clarification or anything.

@kuberry
Copy link
Collaborator

kuberry commented Apr 14, 2020

Hi @jmgate, here is the current output:
pakuber@ews00935:~/Compadre/Trilinos-dev/packages/compadre$ /ascldap/users/pakuber/Compadre/barebone_toolkit/scripts/snapshot_into_trilinos.py --trilinos-dir . --dry-run
Trilinos repository root: /home/pakuber/Compadre/Trilinos-dev/packages/compadre
Using snapshot-dir.py from: /home/pakuber/Compadre/Trilinos-dev/packages/compadre/cmake/tribits/python_utils
Snapshotting Compadre from: /home/pakuber/Compadre/barebone_toolkit
into: /home/pakuber/Compadre/Trilinos-dev/packages/compadre/packages/compadre
Traceback (most recent call last):
File "/ascldap/users/pakuber/Compadre/barebone_toolkit/scripts/snapshot_into_trilinos.py", line 207, in
options.dry_run))
File "/ascldap/users/pakuber/Compadre/barebone_toolkit/scripts/snapshot_into_trilinos.py", line 197, in snapshot
import SnapshotDir
ModuleNotFoundError: No module named 'SnapshotDir'

Any suggestions? Thank you.

@jmgate
Copy link
Collaborator Author

jmgate commented Apr 14, 2020

--trilinos-dir needs to point to the root of the Trilinos repository. You were in Trilinos/packages/compadre when you ran the command.

@jmgate
Copy link
Collaborator Author

jmgate commented Apr 14, 2020

Might need to add a check that the dir given is actually the Trilinos root.

@kuberry
Copy link
Collaborator

kuberry commented Apr 14, 2020

@jmgate, sorry that I missed switching directories last night (went into the compadre folder).
I re-ran having changed to the Trilinos root.
The --dry-run option works, but when I remove --dry-run I get to part D)

D) Get info from git commit from origDir [optional]

fatal: No upstream configured for branch 'master'
Traceback (most recent call last):
  File "/ascldap/users/pakuber/Compadre/barebone_toolkit/scripts/snapshot_into_trilinos.py", line 207, in <module>
    options.dry_run))
  File "/ascldap/users/pakuber/Compadre/barebone_toolkit/scripts/snapshot_into_trilinos.py", line 198, in snapshot
    return SnapshotDir.snapshotDirMainDriver(snapshot_dir_args)
  File "/home/pakuber/Compadre/Trilinos-dev/cmake/tribits/python_utils/SnapshotDir.py", line 360, in snapshotDirMainDriver
    snapshotDir(options)
  File "/home/pakuber/Compadre/Trilinos-dev/cmake/tribits/python_utils/SnapshotDir.py", line 408, in snapshotDir
    getGitRepoUrl(inOptions.origDir)
  File "/home/pakuber/Compadre/Trilinos-dev/cmake/tribits/python_utils/SnapshotDir.py", line 547, in getGitRepoUrl
    "git rev-parse --abbrev-ref --symbolic-full-name @{u}", workingDir=gitDir))
  File "/home/pakuber/Compadre/Trilinos-dev/cmake/tribits/python_utils/GeneralScriptSupport.py", line 498, in getCmndOutput
    raise RuntimeError('%s failed w/ exit code %d:\n\n%s' % (cmnd, errCode, data))
RuntimeError: git rev-parse --abbrev-ref --symbolic-full-name @{u} failed w/ exit code 128:

@kuberry
Copy link
Collaborator

kuberry commented Apr 14, 2020

In this case, I took your feature branch and checked it out as 'master'
jmgate/175-create-script-to-snapshot-compadre-into-trilinos' with similar results.

@jmgate
Copy link
Collaborator Author

jmgate commented Apr 14, 2020

Would you mind scheduling a Skype meeting where we can screen-share?

@kuberry
Copy link
Collaborator

kuberry commented Apr 15, 2020

Hi @jmgate, please also exclude:
cmake/bob.cmake
cmake/detect_trilinos_opts.cmake
examples/Python_3D_Convergence.py.in

Everything else looks great. Thanks!

jmgate added 2 commits April 16, 2020 16:59
Ensure --trilinos-dir points to the root of the Trilinos repository.
@jmgate
Copy link
Collaborator Author

jmgate commented Apr 16, 2020

@kuberry, I excluded those additional files, and then also added a check to ensure that the --trilinos-dir pointed to is the root of the Trilinos repository. This should be good to merge.

Copy link
Collaborator

@kuberry kuberry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jmgate, this looks good.

@kuberry kuberry merged commit 09f65c1 into sandialabs:master Apr 20, 2020
@jmgate jmgate deleted the 175-create-script-to-snapshot-compadre-into-trilinos branch April 21, 2020 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create Script to Snapshot Compadre into Trilinos
2 participants