Skip to content

Commit 5ccb5c4

Browse files
committed
Merge branch 'main' into fix-env-type
2 parents 92b9462 + 4e86a17 commit 5ccb5c4

File tree

17 files changed

+155
-94
lines changed

17 files changed

+155
-94
lines changed

.github/workflows/build-website.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: build-website
22

33
on:
44
push:
5-
branches: [ main, web_site ]
5+
branches: [ main, web_site, 'releases/**' ]
66

77
jobs:
88
publish:

Makefile

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,3 @@ install:
7979
.PHONY: develop
8080
develop:
8181
$(PYTHON) setup.py develop
82-
83-
84-
.PHONY: tag-and-release
85-
tag-and-release: ## create a tag in git. to run, do a 'make VERSION="version string" tag-and-release
86-
./tag_and_release.sh create_tag $(VERSION)
87-
./tag_and_release.sh package
88-
./tag_and_release.sh release

RELEASE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.9.0
1+
0.9.3

docs/_static/extras.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ function detectAll(selectorType) {
6767
// simple_value_2. However, if either "B" or "C" are selected in either selector,
6868
// we want to change both.
6969

70-
console.log("type:" + selectorType);
7170
$("p." + selectorType + "-selector").addClass(selectorType + "-item");
7271
var prevSpans = [];
7372
$("span").each(function() {
@@ -91,6 +90,28 @@ function detectAll(selectorType) {
9190
$(this).text("PROJECT_NAME");
9291
}
9392
}
93+
if (text == '_get_executor_instance') {
94+
// replace _get_executor_instance(execparams, job) with selector value
95+
// the spans are: "_get_executor_instance", "(", "execparams", ",", "job", ")"
96+
// we need: "JobExecutor", ".", "get_instance", "(", selector, ")"
97+
// the classes happen to match, so just replace the text
98+
// also, remove the space after the comma, which is rendered by sphinx as a text
99+
// node rather than span like everything else
100+
var crt = $(this);
101+
var space = $(this).next().next().next().get(0).nextSibling;
102+
if (space.nodeType == 3) {
103+
space.nodeValue = "";
104+
}
105+
else {
106+
console.log("Expected a text node: ", space);
107+
}
108+
var newText = ["JobExecutor", ".", "get_instance", "("];
109+
for (var i = 0; i < 4; i++) {
110+
crt.text(newText[i]);
111+
crt = crt.next();
112+
}
113+
crt.addClass(selectorType + "-item").addClass("psij-selector-value");
114+
}
94115
prevSpans.push($(this));
95116
if (prevSpans.length > 2) {
96117
prevSpans.shift();

docs/user_guide.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ processes on each node, for a total of 8 processes:
254254
.. literalinclude:: ../tests/user_guide/test_resourcespec.py
255255
:language: python
256256
:dedent: 4
257-
:lines: 9-17
257+
:lines: 8-16
258258

259259
.. note::
260260
All processes of a job will share at most one MPI communicator
@@ -332,7 +332,7 @@ and an instance of the
332332
.. literalinclude:: ../tests/user_guide/test_scheduling_information.py
333333
:language: python
334334
:dedent: 4
335-
:lines: 11-19
335+
:lines: 10-18,21-22
336336

337337
where `QUEUE_NAME` is the LRM queue where the job should be sent and
338338
`PROJECT_NAME` is a project/account that may need to be specified for

psij-ci-setup

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,17 @@ cron_install() {
5757
echo "The following line will be installed in your crontab:"
5858
echo "$LINE"
5959
echo "================================================================"
60-
{ crontab_list && echo "$LINE"; } | crontab -
60+
61+
CRT_CRONTAB=`crontab -l 2>&1`
62+
if [ "$?" != "0" ]; then
63+
if echo "$CRT_CRONTAB" | grep "no crontab for" >/dev/null 2>&1 ; then
64+
CRT_CRONTAB=""
65+
else
66+
echo "Error updating crontab: $CRT_CRONTAB"
67+
exit 2
68+
fi
69+
fi
70+
{ echo "$CRT_CRONTAB"; echo "$LINE"; } | crontab -
6171

6272
declare -x | egrep -v "^declare -x (BASH_VERSINFO|DISPLAY|EUID|GROUPS|SHELLOPTS|TERM|UID|_)=" >psij-ci-env
6373
}
@@ -249,6 +259,7 @@ check_key() {
249259
read -n1 RESPONSE
250260
RESPONSE=${RESPONSE^}
251261
done
262+
mkdir -p ~/.psij
252263
echo "$KEY" > ~/.psij/key
253264
chmod 600 ~/.psij/key
254265
DONE=1

release.sh

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#!/bin/bash
2+
3+
# This script does the following:
4+
# - does some sanity checks
5+
# - updates RELEASE and src/psij/version.py
6+
# - commits and pushes the version files
7+
# - creates a release tag
8+
# - builds packages
9+
# - pushes said packages to PyPi
10+
# - triggers github workflows to rebuild the web page (including documentation)
11+
12+
set -e
13+
14+
error() {
15+
echo $@
16+
exit 1
17+
}
18+
19+
if [ "$1" == "" ]; then
20+
error "Missing required version argument"
21+
else
22+
TARGET_VERSION="$1"
23+
fi
24+
25+
# Ensure that we are on the main branch
26+
CRT_BRANCH=`git rev-parse --abbrev-ref HEAD`
27+
28+
if [ "$CRT_BRANCH" != "main" ]; then
29+
error "Must be on the main branch to make a release."
30+
fi
31+
32+
STATUS=`git status --untracked-files=no --porcelain`
33+
34+
# Ensure current dir is clean
35+
if [ ! -z "$STATUS" ]; then
36+
error "Working directory is not clean. Please run this script on a clean checkout."
37+
echo
38+
fi
39+
40+
# Make sure version in newer than other releases
41+
TAGS=`git tag`
42+
if echo "$TAGS" | grep "$TARGET_VERSION" 2>&1 >/dev/null; then
43+
error "Version $TARGET_VERSION is already tagged."
44+
fi
45+
46+
LAST=`echo -e "$TAGS\n$TARGET_VERSION" | sed '/^\s*$/d' | sort -V | tail -n 1`
47+
if [ "$LAST" != "$TARGET_VERSION" ]; then
48+
error "Version $TARGET_VERSION is lower than the latest tagged version ($LAST)."
49+
fi
50+
51+
echo "This will tag and release psij-python to version $TARGET_VERSION."
52+
echo -n "Type 'yes' if you want to continue: "
53+
read REPLY
54+
55+
if [ "$REPLY" != "yes" ]; then
56+
error "Release canceled."
57+
fi
58+
59+
# There are mutable operations from here on
60+
61+
echo "Creating release branch"
62+
git checkout -b "releases/$TARGET_VERSION"
63+
64+
# Update the two version files and push them
65+
echo "Updating version and tagging..."
66+
67+
echo -n "$TARGET_VERSION" > RELEASE
68+
cat <<EOF >src/psij/version.py
69+
"""This module stores the current version of this library."""
70+
71+
# Do not change this file manually. It is updated automatically by the release script.
72+
VERSION = '$TARGET_VERSION'
73+
EOF
74+
75+
git commit -m "Updated version files to $TARGET_VERSION." RELEASE src/psij/version.py
76+
git push --set-upstream origin releases/$TARGET_VERSION
77+
78+
git tag -a "$TARGET_VERSION" -m "Tagging $TARGET_VERSION"
79+
git push origin --tags
80+
81+
echo "Building packages..."
82+
python3 setup.py sdist
83+
python3 setup.py bdist_wheel
84+
85+
echo "Releasing PyPi package..."
86+
twine upload dist/*
87+
88+
echo "Triggering web docs build..."
89+
git commit --allow-empty -m "Trigger web build for $TARGET_VERSION"
90+
git push
91+
92+
echo "All done!"

src/psij/executors/batch/batch_scheduler_executor.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from threading import Thread, RLock
1010
from typing import Optional, List, Dict, Collection, cast, Union, IO
1111

12-
from .escape_functions import bash_escape
1312
from psij.launchers.script_based_launcher import ScriptBasedLauncher
1413

1514
from psij import JobExecutor, JobExecutorConfig, Launcher, Job, SubmitException, \
@@ -68,7 +67,7 @@ def _env_to_mustache(job: Job) -> List[Dict[str, str]]:
6867

6968
r = []
7069
for k, v in job.spec.environment.items():
71-
r.append({'name': k, 'value': bash_escape(v)})
70+
r.append({'name': k, 'value': v})
7271
return r
7372

7473

src/psij/version.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
"""This module stores the current version of this library."""
22

3-
# Use PEP 440 for this
4-
#: This is a global constant with the PSI/J Python version number
5-
VERSION = '0.9.0'
3+
# Do not change this file manually. It is updated automatically by the release script.
4+
VERSION = '0.9.3'

tag_and_release.sh

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)