This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;;set the REST endpoint for K8S | |
| (core/set-api-context {:base-url "http://localhost:8080"}) | |
| ;;create a job with the given spec. | |
| ;;we'll use the default K8s namespace. | |
| (create-namespaced-job "default" pi-job-spec) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (get-job-status "pi") | |
| ;;{:startTime "2020-09-15T08:33:44Z", :active 1} | |
| ;;wait for a few seconds | |
| (get-job-status "pi") | |
| ;;{:conditions [{:type "Complete", :status "True", :lastProbeTime "2020-09-15T08:33:55Z", | |
| ;;:lastTransitionTime "2020-09-15T08:33:55Z"}], :startTime "2020-09-15T08:33:44Z", | |
| ;;:completionTime "2020-09-15T08:33:55Z", :succeeded 1} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (-> | |
| ;;this is a utility API to get the name of the pods | |
| ;;used by the job named pi. | |
| (get-job-pods "pi") | |
| first | |
| (read-namespaced-pod-log "default")) | |
| ;;the result is the first 50 digits of pi. | |
| ;;"3.1415926535897932384626433832795028841971693993751\n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (delete-namespaced-job "pi" "default" | |
| {:kind :DeleteOptions | |
| :propagationPolicy "Foreground"}) | |
| ;;all dependents are deleted when this command returns |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ns clj-k8s-job.core | |
| (:require | |
| [clojure-kubernetes-client.core :as core] | |
| [clojure-kubernetes-client.api.core-v1 :refer [read-namespaced-pod-log | |
| list-pod-for-all-namespaces]] | |
| [clojure-kubernetes-client.api.batch-v1 :refer [create-namespaced-job | |
| read-namespaced-job-status | |
| delete-namespaced-job]])) | |
| (def pi-job-spec |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish package to GitHub Packages | |
| on: [push] | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defproject group-id/artifact-id "version" | |
| :repositories [["github" {:url "https://maven.pkg.github.com/<githubusername>/<repo>" | |
| :username <github-username> :password [:env/GITHUB_TOKEN]}]] | |
| ;;other bits | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 | |
| http://maven.apache.org/xsd/settings-1.0.0.xsd"> | |
| <activeProfiles> | |
| <activeProfile>github</activeProfile> | |
| </activeProfiles> | |
| <profiles> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| dir /soundfont | |
| bank 0 | |
| 74 %font ExpressiveFluteSSO-v1.2.sf2 0 0 | |
| 40 %font Strings-4U-v1.0.sf2 0 0 | |
| 54 %font KBH-Real-Choir-V2.5.sf2 0 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ConvStack2d(nn.Module): | |
| def __init__(self, input_features, output_features): | |
| super().__init__() | |
| # input is batch_size * 1 channel * frames * input_features | |
| self.cnn = nn.Sequential( | |
| # layer 0 | |
| nn.Conv2d(1, output_features // 16, (3, 3), padding=1), | |
| nn.BatchNorm2d(output_features // 16), | |
| nn.ReLU(), |