-
-
Notifications
You must be signed in to change notification settings - Fork 166
creation of a script to update related to the OPL #959
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
Conversation
|
I haven't tested it and probably won't have a chance to (I am about to go on vacation), but the code looks ok. |
|
Issues:
After installing and the last one was taking quite some time to run,and in the end I stopped it and did not give it a chance to complete. That will be needed in the next round of testing. Since the Note: The code also changes to contents of the 3 JSON files:
|
|
When I tried to add ** MooX::Options found, but failed to load: Can't find the method in ! Ensure to load a Role::Tiny compatible module like Moo or Moose before using MooX::Options. at (eval 452) line 1.BEGIN failed--compilation aborted at (eval 452) line 1. Solution is to include |
|
#989 adds the changes needed to install and test for install of |
|
I've tried to be conservative about adding lots of packages. Adding Moose in particular would add too much bloat to the webwork system. Moo might be ok. I've already added Class::Accessor and used for constructing the answerTable for each problem which might be enough for the usage here. That's already in our code base so nothing new would need to be added. There is a useful comparison of perl OO options at the end of From that I'd recommend rewriting this using either Class::Accessor or Class::Tiny. There might need to be a little extra code to deal with the options feature -- I haven't looked closely at that. |
Need MooX::Options for webwork2 PR #959
|
I closed this prematurely by mistake. |
|
This points into the WW-2.15 branch, not develop. @pstaab, would you assess this for closing? Or should it move to develop? |
drgrice1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure to make the updateOPLextras file executable, and rename it to updateOPLextras.pl (for consistency with the other OPL scripts) as @taniwallach has said.
|
I'm embarrassed that I left this sit so long. I made changes suggested by @drgrice1 and switched it to be a Digging into this again, it was running super slow and have trimmed down the database queries to speed this this, so there's a lot of code changes, mainly to streamline. I'll commit this later today after more testing. Another important thing: the Thoughts? |
|
You say that you added the |
|
I haven't pushed anything yet. I'm still bug testing. I am interested in seeing people's opinion about pulling the functionality out of |
|
I just pushed an update and could use more testing. A few things about this
Also, I haven't updated the |
It seems that the only purpose of including Moo is to use MooX::Options to handle the parsing of command line arguments. For this we already have Getopt::Long, so it's not necessary to add these new libraries. use strict;
use warnings;
use DBI;
use Getopt::Long;
Getopt::Long::Configure ("bundling");
my ($textbooks, $directories, $subjects, $all);
GetOptions (
't|textbooks' => \$textbooks,
'd|directories' => \$directories,
's|subjects' => \$subjects,
'a|all' => \$all,
);
If you want the additional documentation that is included in =head1 NAME
updateOPLextras - re-build library trees
=head1 SYNOPSIS
updateOPLextras [options]
Options:
-t --textbooks (rebuild textbook tree)
-s --subjects (rebuild subject tree)
-d --directories (rebuild directory tree)
-a --all (rebuild all trees)
-h --help (display this text)
=head1 OPTIONS
=over 8
=item B<-t> I<--textbooks>
Rebuild the textbook tree and write to a JSON file.
=item B<-s> I<--subjects>
Rebuild the subject tree and write to a JSON file.
=item B<-d> I<--directories>
Rebuild the directory tree and write to a JSON file.
=back
=head1 DESCRIPTION
B<This program> will rebuild the specified library trees
from the existing library contents in the database.
=cut
use strict;
use warnings;
use DBI;
use Getopt::Long;
use Pod::Usage;
Getopt::Long::Configure ("bundling");
my ($textbooks, $directories, $subjects, $all);
GetOptions (
't|textbooks' => \$textbooks,
'd|directories' => \$directories,
's|subjects' => \$subjects,
'a|all' => \$all,
);
pod2usage(2) unless ($textbooks || $directories || $subjects || $all); |
|
I agree with @drdrew42 to use Getopt::Long instead of pulling in an unnecessary new module. I think it is a good idea to pull the things out of OPL-update that are not used for webwork2. They can be added back as needed when we migrate to webwork3. The OPL-update script takes long enough to run as it is, and that may cut down the run time a bit. While you are at it you should change the to_json calls either to encode_json or to using the object oriented approach. I think that just using encode_json is the correct thing to do. The |
|
I'll switch over to |
|
Updated this script to include recommendations. Note: I also pulled out the functionality from OPL-update. I'm in the middle of testing this, but I don't see anything I removed that will change the base OPL-update functionality. This should speed up the script. |
drgrice1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an instance of to_json on line 537 of OPL-update. It would be good to take care of that now while you are at it. You could export writeJSONtoFile from OPLUtils.pm and import and use that.
Also, could you remove libmoox-options-perl from Dockerfile (line 200) and Moo and MooX::Options from lines 90-91 of check_modules.pl now that they are not used?
I question the need of this pull request. If the json files generated by updateOPLextras.pl are not used by webwork2 at all, then why is this here? If this is only for webwork3, then this does not belong. There is a lot of code that is in webwork2 that seems to be for webwork3, and this should not be occuring. webwork3 should have its own repository entirely, and should not be mingled with webwork2. This needs to be rethought.
| my @dirArray = (); | ||
| push(@dirArray,buildTree($libraryRoot)); | ||
|
|
||
| my $webwork_htdocs = $ce->{webwork_dir}."/htdocs"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 78 and 80 above should be deleted. Those variables are not needed here.
|
Let me clarify that I think it is good that this pull request is now removing those things needed for webwork3 from the script that is run for webwork2. |
|
I'm sure the extra utilities in OPL-update script was my fault, although I remember suggesting that the Library Browser in webwork2 use the JSON files generated to improve performance. That never occurred. @drgrice1 Made the changes. |
drgrice1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good now.
|
It would be good for someone else to take a look at this before it is merged. |
This script allows to rerun a few scripts related to the OPL but doesn't require the entire OPLupdate script to be run. These scripts produce JSON files that
and are mainly used by the ww3 branch.
To test, the OPL update script should have been run and then the following
and the results should say that a file in the HTDOCS directory was successfully produced.