Skip to content

Commit bc5c6bf

Browse files
committed
update build image for hatch
1 parent 2218ad1 commit bc5c6bf

File tree

4 files changed

+43
-40
lines changed

4 files changed

+43
-40
lines changed

.circleci/config.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version: 2.1
44

55
.dockersetup: &dockersetup
66
docker:
7-
- image: pennlinc/babs_tests:datalad0.17.2_v5
7+
- image: pennlinc/babs_testing:0.1
88

99
# TODO:
1010
# runinstall: &runinstall
@@ -13,7 +13,7 @@ version: 2.1
1313
# TODO: add tests from flake8
1414

1515
jobs:
16-
pytest: # run pytest
16+
pytest: # run pytest
1717
<<: *dockersetup
1818
resource_class: xlarge
1919
working_directory: /home/circleci/src/babs
@@ -26,13 +26,13 @@ jobs:
2626
command: |
2727
pip install .[tests]
2828
pytest -n 6 -sv
29-
30-
deployable: # checkpoint of deployable: requires all success
29+
30+
deployable: # checkpoint of deployable: requires all success
3131
<<: *dockersetup
3232
steps:
3333
- run: echo Deploying!
3434

35-
deploy_pypi: # deploy to pypi
35+
deploy_pypi: # deploy to pypi
3636
<<: *dockersetup
3737
working_directory: /tmp/src/babs
3838
steps:
@@ -49,7 +49,6 @@ jobs:
4949
python3 -m twine upload dist/*
5050
# NOTE: if want to test with test pypi, add `--repository testpypi` after `twine upload`
5151

52-
5352
workflows:
5453
# version: 2
5554
build_test_deploy:
@@ -61,19 +60,19 @@ workflows:
6160
# - build
6261
filters:
6362
tags:
64-
only: /.*/ # i.e., all branches and tags
63+
only: /.*/ # i.e., all branches and tags
6564
- deployable:
66-
requires: # should require all jobs' success before deploying
65+
requires: # should require all jobs' success before deploying
6766
- pytest
68-
filters: # run when main branch + any tags
67+
filters: # run when main branch + any tags
6968
branches:
7069
only: main
7170
tags:
7271
only: /.*/
7372
- deploy_pypi:
7473
requires:
7574
- deployable
76-
filters: # runs for no branches but runs for any tags
75+
filters: # runs for no branches but runs for any tags
7776
branches:
7877
ignore: /.*/
7978
tags:

Dockerfile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ FROM ubuntu:22.04
22

33
RUN apt-get update && \
44
apt-get install -y --no-install-recommends \
5-
ca-certificates \
6-
bzip2 \
7-
curl \
5+
ca-certificates \
6+
bzip2 \
7+
curl \
88
&& apt-get clean \
99
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
1010

@@ -33,10 +33,10 @@ ENV PATH=/opt/conda/envs/babs/bin:$PATH
3333
RUN git config --global user.name "CircleCI" \
3434
&& git config --global user.email "circleci@example.com"
3535

36-
# install BABS
37-
COPY . $HOME/babs
38-
WORKDIR $HOME/babs
39-
RUN pip install .[tests]
36+
# # install BABS
37+
# COPY . $HOME/babs
38+
# WORKDIR $HOME/babs
39+
# RUN pip install .[tests]
4040

4141
# # pytest BABS
4242
# RUN pytest ~/babs

babs/babs.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ def datalad_save(self, path, message=None):
179179
# ^^ number of dicts in list `statuses` = len(path)
180180
# check that all statuses returned are "okay":
181181
# below is from cubids
182-
saved_status = set([status['status'] for status in statuses])
183-
if saved_status.issubset(set(['ok', 'notneeded'])) is False:
182+
saved_status = {status['status'] for status in statuses}
183+
if saved_status.issubset({'ok', 'notneeded'}) is False:
184184
# exists element in `saved_status` that is not "ok" or "notneeded"
185185
# ^^ "notneeded": nothing to save
186186
raise Exception('`datalad save` failed!')
@@ -1377,7 +1377,7 @@ def babs_status(
13771377
to_print += ', ' + ses
13781378
to_print += (
13791379
' was requested, as this job is running,'
1380-
+ " BABS won't resubmit this job."
1380+
" BABS won't resubmit this job."
13811381
)
13821382
# NOTE: removed "and `--reckless` was not specified, "
13831383
# can add this ^^ back after supporting `--reckless` in CLI
@@ -1577,7 +1577,8 @@ def babs_status(
15771577
username_lowercase,
15781578
self.type_system,
15791579
)
1580-
df_job_updated.at[i_job, 'job_account'] = msg_job_account
1580+
raise Exception('This should be impossible to reach')
1581+
# df_job_updated.at[i_job, 'job_account'] = msg_job_account
15811582

15821583
# Collect all to-be-resubmitted tasks into a single DataFrame
15831584
df_job_resubmit = df_job_updated[df_job_updated['needs_resubmit'] == True].copy()

babs/template_test_job.py

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,29 @@
1111
def cli():
1212
parser = argparse.ArgumentParser()
1313
parser.add_argument(
14-
'--path-workspace', '--path_workspace',
14+
'--path-workspace',
15+
'--path_workspace',
1516
help='The path of ephemeral compute workspace',
16-
required=True)
17+
required=True,
18+
)
1719
parser.add_argument(
18-
'--path-check-setup', '--path_check_setup',
20+
'--path-check-setup',
21+
'--path_check_setup',
1922
help='The path to analysis/code/check_setup folder',
20-
required=True)
23+
required=True,
24+
)
2125

2226
return parser
2327

28+
2429
def main():
2530
# Get arguments:
2631
args = cli().parse_args()
2732

2833
# Prepare the yaml file:
2934
fn_yaml = op.join(args.path_check_setup, 'check_env.yaml')
3035
if op.exists(fn_yaml):
31-
os.remove(fn_yaml) # remove it
36+
os.remove(fn_yaml) # remove it
3237
yaml_file = open(fn_yaml, 'w')
3338

3439
# Initialize the dict:
@@ -38,40 +43,38 @@ def main():
3843
flag_writable = os.access(args.path_workspace, os.W_OK)
3944
config['workspace_writable'] = flag_writable
4045
# change to the version that `read_yaml()` from babs/utils.py can read:
41-
if flag_writable: # True
46+
if flag_writable: # True
4247
str_writable = 'true'
4348
else:
4449
str_writable = 'false'
45-
yaml_file.write(
46-
'workspace_writable: ' + str_writable + '\n')
50+
yaml_file.write('workspace_writable: ' + str_writable + '\n')
4751

4852
# Which python in current env:
4953
# assume the python is installed; otherwise this script cannot be run:
5054
config['which_python'] = sys.executable
51-
yaml_file.write(
52-
"which_python: '" + sys.executable + "'\n")
55+
yaml_file.write("which_python: '" + sys.executable + "'\n")
5356

5457
# Check each dependent packages' versions:
5558
config['version'] = {}
5659
yaml_file.write('version:\n')
5760
# What packages' versions to check:
58-
what_versions = {'datalad': 'datalad --version',
59-
'git': 'git --version',
60-
'git-annex': 'git-annex version',
61-
'datalad_containers': 'datalad containers-add --version'}
61+
what_versions = {
62+
'datalad': 'datalad --version',
63+
'git': 'git --version',
64+
'git-annex': 'git-annex version',
65+
'datalad_containers': 'datalad containers-add --version',
66+
}
6267
for key in what_versions:
6368
the_command = what_versions[key]
6469
try:
65-
proc = subprocess.run(the_command.split(' '),
66-
stdout=subprocess.PIPE)
70+
proc = subprocess.run(the_command.split(' '), stdout=subprocess.PIPE)
6771
proc.check_returncode()
6872
if key == 'git-annex':
6973
temp = proc.stdout.decode('utf-8').split('\n')[0]
7074
config['version'][key] = temp
7175
else:
72-
config['version'][key] = \
73-
proc.stdout.decode('utf-8').replace('\n', '')
74-
except:
76+
config['version'][key] = proc.stdout.decode('utf-8').replace('\n', '')
77+
except Exception:
7578
config['version'][key] = 'not_installed'
7679

7780
yaml_file.write(' ' + key + ": '" + config['version'][key] + "'\n")

0 commit comments

Comments
 (0)