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

Dynamically pull repo information for HPC lessons #25

Merged
merged 18 commits into from
Apr 24, 2021
Merged

Conversation

ocaisa
Copy link
Member

@ocaisa ocaisa commented Apr 20, 2021

Fixes #24

@ocaisa
Copy link
Member Author

ocaisa commented Apr 20, 2021

See https://github.com/hpc-carpentry/hpc-carpentry.github.io/runs/2391477702 for where this change is checked

curl --remote-name-all https://feeds.carpentries.org/all_instructors_by_airport.geojson &&\
cp all_instructors_by_airport.geojson files/.
- name: Setup EESSI to give us an R module
uses: eessi/github-action-eessi@v1
Copy link
Member Author

Choose a reason for hiding this comment

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

All ye who use HPC, take note of this awesome action!

Copy link
Member Author

Choose a reason for hiding this comment

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

This is giving us R with over 900 packages installed in just over 30 seconds!

Copy link
Member

Choose a reason for hiding this comment

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

Super cool!

R/help_wanted_issues.R Outdated Show resolved Hide resolved
@ocaisa
Copy link
Member Author

ocaisa commented Apr 20, 2021

For this to work completely we will need to start using GitHub topics consistently on our repos. In particular things need to be at least tagged with lesson and hpc-carpentry before they will appear. The nice thing is that they will still show up even if they get migrated to the Carpentries incubator.

@tkphd
Copy link
Member

tkphd commented Apr 20, 2021

If those "tags" are Labels, we can configure Issue Templates for each repo to apply them automagically going forward. Then we only have to manually intervene with... all of history.

@ocaisa
Copy link
Member Author

ocaisa commented Apr 20, 2021

If those "tags" are Labels, we can configure Issue Templates for each repo to apply them automagically going forward. Then we only have to manually intervene with... all of history.

No, not labels (that's what I thought too first). The labels are used for the help wanted data, but the topics are set globally for the repo in the "About" section of the repo homepage (see https://github.com/hpc-carpentry/hpc-shell where I set them for testing this)

@tkphd
Copy link
Member

tkphd commented Apr 20, 2021

Oh, cool!! That's even easier!

@ocaisa
Copy link
Member Author

ocaisa commented Apr 20, 2021

At the moment we don't actually have a "Help Wanted" page (I think) but with this we can add one based on the Carpentries.

It also opens the door to being able to include lessons from other providers under separate organisations (and we can group them accordingly)

@tkphd
Copy link
Member

tkphd commented Apr 20, 2021

Yes, this is fantastic. I introduced a "Help Wanted" page in #22, but hybridizing this feed with The Carpentries' code is a much better solution.

@tkphd
Copy link
Member

tkphd commented Apr 20, 2021

Applied the lesson and hpc-carpentry tags to all our lesson repositories, FYI. Also english, alpha, and (for Chapel) pre-alpha.

pages/community-lessons.md Outdated Show resolved Hide resolved
@ocaisa
Copy link
Member Author

ocaisa commented Apr 20, 2021

Applied the lesson and hpc-carpentry tags to all our lesson repositories, FYI. Also english, alpha, and (for Chapel) pre-alpha.

I tested this locally and they all appear fine

Alan O'Cais added 3 commits April 21, 2021 09:19
@@ -4,5 +4,5 @@ gem 'faraday', '0.17.3'

group :jekyll_plugins do
gem 'github-pages'
gem 'jekyll-get-json', "~> 0.0.2"
# gem 'jekyll-get-json', "~> 0.0.2"
Copy link
Member Author

Choose a reason for hiding this comment

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

Since we are not pulling data from AMY this is not needed (yet)


<hr>

## HPC Carpentry Listings
Copy link
Member Author

Choose a reason for hiding this comment

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

If this starts getting populated, it should really be broken off into a separate page

Copy link
Member Author

Choose a reason for hiding this comment

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

I have a lesson I would like to include here

pages/teach.md Show resolved Hide resolved
@tkphd tkphd mentioned this pull request Apr 21, 2021
@ocaisa
Copy link
Member Author

ocaisa commented Apr 21, 2021

For the record, here are the changes required to the upstream code at https://github.com/carpentries/feeds.carpentries.org/tree/main/R

diff --git a/home/alanc/feeds.carpentries.org/R/community_lessons.R b/R/hpc-carpentry_lessons.R
index b0d33b8a..a8ead1c5 100644
--- a/home/alanc/feeds.carpentries.org/R/community_lessons.R
+++ b/feeds/hpc-carpentry_lessons.R
@@ -1,6 +1,7 @@
 source("R/utils.R")
 
 LIFE_CYCLE_TAGS <- c("pre-alpha", "alpha", "beta", "stable")
+# The tags below will be filtered out in the json
 COMMON_TAGS <- c(
   "carpentries",
   "carpentries-incubator",
@@ -43,10 +44,11 @@ check_repo_info <- function(.d, fields) {
 make_community_lessons_feed <- function(path, ...) {
 
   carp_inc <- get_org_topics("carpentries-incubator")
-  carp_lab <- get_org_topics("carpentrieslab")
+  hpc_carp <- get_org_topics("hpc-carpentry")
 
-  res <- dplyr::bind_rows(carp_inc, carp_lab) %>%
+  res <- dplyr::bind_rows(carp_inc, hpc_carp) %>%
     dplyr::select(-private) %>%
+    dplyr::filter(grepl("hpc-carpentry", github_topics)) %>%
     dplyr::filter(grepl("lesson", github_topics)) %>%
     extract_tag(
       life_cycle_tag,
@@ -71,4 +73,4 @@ make_community_lessons_feed <- function(path, ...) {
 
 }
 
-make_community_lessons_feed("_data/community_lessons.json")
+make_community_lessons_feed("_data/hpc_lessons.json")
diff --git a/home/alanc/feeds.carpentries.org/R/help_wanted_issues.R b/feeds/help_wanted_issues.R
index d0f79ddd..cb154f6e 100644
--- a/home/alanc/feeds.carpentries.org/R/help_wanted_issues.R
+++ b/feeds/help_wanted_issues.R
@@ -1,4 +1,4 @@
-source("R/utils.R")
+source("feeds/utils.R")
 
 new_tbl_github_issues <- function(url = character(0),
                                   title = character(0),
@@ -97,40 +97,17 @@ get_gh_issues <- function(owner, repo, labels) {
     )
 }
 
-keep_opted_in <- function(orgs) {
-
-  at_opted_in <- airtabler::airtable(
-    base = "appeZJGnGremE1MYm",
-    tables = "Repositories"
+keep_hpc_carpentry_repos <- function(orgs) {
+  dplyr::filter(
+    orgs, carpentries_org == "hpc-carpentry"
   )
-
-  opted_in <- at_opted_in$Repositories$select_all() %>%
-    dplyr::mutate(lesson_program = tolower(lesson_program))
-
-  dplyr::left_join(
-    orgs, opted_in,
-    by = c(
-      "carpentries_org" = "lesson_program",
-      "repo" = "repository"
-    )
-  ) %>%
-    dplyr::filter(display_help_wanted)
-
 }
 
 keep_other_repos <- function(orgs) {
+  # Repos that wish to opt in should be manually added here
   other_repos <- tibble::tribble(
     ~carpentries_org, ~repo,
-    "carpentries", "glosario",
-    "carpentries", "glosario-r",
-    "carpentries", "glosario-py",
-    ##    "carpentries", "glosario-js",
-    "carpentries", "carpentries.org",
-    "carpentries", "docs.carpentries.org",
-    "datacarpentry", "datacarpentry.github.io",
-    "librarycarpentry", "librarycarpentry.github.io",
-    "carpentryconnect", "carpentryconnect.org",
-    "swcarpentry", "website"
+    "carpentries-incubator", "hpc-intro",
   )
 
   dplyr::inner_join(
@@ -141,13 +118,8 @@ keep_other_repos <- function(orgs) {
 
 
 list_organizations <- c(
-  "Data Carpentry" = "datacarpentry",
-  "Software Carpentry" = "swcarpentry",
-  "Library Carpentry" = "librarycarpentry",
-  "CarpentriesLab" = "carpentrieslab",
-  "The Carpentries Incubator" = "carpentries-incubator",
-  "The Carpentries" = "carpentries",
-  "CarpentryConnect" = "carpentryconnect"
+  "HPC Carpentry" = "hpc-carpentry",
+  "The Carpentries Incubator" = "carpentries-incubator"
 )
 
 list_help_wanted <- purrr::imap_dfr(
@@ -158,14 +130,14 @@ list_help_wanted <- purrr::imap_dfr(
       ignore_pattern = "^\\d{4}-\\d{2}-\\d{2}"
     )
 
-    lessons <- orgs %>%
-      keep_opted_in()
+    hpc_carpentry_repos <- orgs %>%
+      keep_hpc_carpentry_repos()
 
     other_repos <- orgs %>%
       keep_other_repos()
 
     dplyr::bind_rows(
-      lessons,
+      hpc_carpentry_repos,
       other_repos
     )  %>%
       dplyr::distinct(carpentries_org, repo, .keep_all = TRUE) %>%

Copy link
Member

@tkphd tkphd left a comment

Choose a reason for hiding this comment

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

This looks great!!! A few minor quibbles, but this is really good stuff.

_config.yml Show resolved Hide resolved
pages/community-lessons.md Outdated Show resolved Hide resolved
pages/teach.md Show resolved Hide resolved
R/help_wanted_issues.R Outdated Show resolved Hide resolved
_config.yml Show resolved Hide resolved
@tkphd
Copy link
Member

tkphd commented Apr 21, 2021

@ocaisa the EESSI trick is neat for getting an R environment. Is there a way to run it locally, so I can make serve and see the updated list of lessons? Can we document that step?

@ocaisa
Copy link
Member Author

ocaisa commented Apr 21, 2021

@ocaisa the EESSI trick is neat for getting an R environment. Is there a way to run it locally, so I can make serve and see the updated list of lessons? Can we document that step?

@tkphd There are a few example installation scripts at https://github.com/EESSI/eessi-demo/tree/main/scripts but they are slightly outdated (but should still work). You can now use https://github.com/EESSI/filesystem-layer/releases/download/latest/cvmfs-config-eessi_latest_all.deb as the configuration file.

After that you need to source /cvmfs/pilot.eessi-hpc.org/latest/init/bash and that will give you access to the stack for your CPU. You can then follow the same steps as the CI:

GITHUB_PAT=XXXXX make data
make serve

Copy link
Member

@tkphd tkphd left a comment

Choose a reason for hiding this comment

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

This looks great! Thanks @ocaisa!

@tkphd tkphd merged commit 0bf965d into main Apr 24, 2021
@tkphd tkphd deleted the generate_lesson_json branch April 24, 2021 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Creating our own feeds for our repos
2 participants