Skip to content
This repository was archived by the owner on Dec 27, 2022. It is now read-only.

Commit 65eeaa6

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 49560ea + dc523b6 commit 65eeaa6

File tree

6 files changed

+745
-161
lines changed

6 files changed

+745
-161
lines changed

.travis.yml

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
1-
# Config file for automatic testing at travis-ci.org
2-
3-
language: python
4-
python:
5-
- 3.6
6-
- 3.5
7-
- 3.4
8-
9-
# Command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
10-
install: pip install -U tox-travis
11-
12-
# Command to run tests, e.g. python setup.py test
13-
script: tox
14-
15-
1+
sudo: false
2+
language: node_js
3+
node_js:
4+
- '6.0'
5+
cache:
6+
directories:
7+
- preafqViewer/node_modules
8+
branches:
9+
only:
10+
- master
11+
notifications:
12+
email: false
13+
before_script:
14+
- cd preafqViewer
15+
- npm prune
16+
script:
17+
- npm run build
18+
- npm test
19+
after_success:
20+
- bash ./deploy.sh
21+
env:
22+
global:
23+
- GH_USER: akeshavan
24+
- GH_REPO: preAFQ
25+
- secure: irToFjVhLgr3rOdobRrhpJqSJtamvDTiBHmq4Xr1m3G24rirSRqSEjp6zronYbyNJ/VnoIhc0L8/VKrDUNsGR+0zqwJ4b4/2nR7LG7grvH79hWz2zGOckm2oYFC0BKyCFSiJ4n5op5SVslARr2ONgO+BqtclBIVAyHcbfnRMhHawZvcaWDgUOeLT8cTCT3uddOWNRQY1bH+nwv7OjqpQHlvLTAXjSH7XdVoGnzPhK79F1djUrpzJSODcsZl+VU1ghVKc1fj8AEpha0m3ZF0dSRK9xYBXOYaoXsbjXjDMo2kZJd8vobZ2Tvl9WP8xpEEJjqFMRxqDCd9JZq9kr/vVWpirm7mWce65BiJBj7K2iBwWjruqeLhYLcM8bdIEDybTqV8ZeXeghcbBpw+L+5hgSHbEK+XZFmTO9XKOpF0XhvYjxpti8cv2PIJ6Dhg+j+LrAo3MkRuYZ19DgKdId4fr+PM6Fuxfwa/h0AkL2bKampeofrbRQZDS/Q2TxTfp4UaxMYhLWLoJqZFYsdcLIPjlmMPSTvvnWq+YJ8bHxqrdORiUKDY32uXQ/LBFrQVjgZJFzR7OOazWcxykpBMYJh5sH1A6a52xJj26heygM2CxPGdwzapFM1XmS0QZ+qeGVYx9YMSD+oBxgpHj3xQorvon+YEiSdnTeyLWKq7sTciTAPM=

preafq/__init__.py

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,51 @@
66
__email__ = '[email protected]'
77
__version__ = '0.1.0'
88

9+
import errno
10+
import logging
11+
import os
912

10-
from .preafq import download_prereqs, upload_to_s3 # noqa
11-
from . import fetch_hbn # noqa
13+
from .preafq import upload_to_s3 # noqa
14+
from . import fetch_bids_s3 # noqa
15+
16+
17+
module_logger = logging.getLogger(__name__)
18+
19+
# get the log level from environment variable
20+
if "AFQ_LOGLEVEL" in os.environ:
21+
loglevel = os.environ['AFQ_LOGLEVEL']
22+
module_logger.setLevel(getattr(logging, loglevel.upper()))
23+
else:
24+
module_logger.setLevel(logging.WARNING)
25+
26+
# create a file handler
27+
logpath = os.path.join(os.path.expanduser('~'), '.afq', 'afq.log')
28+
29+
# Create the config directory if it doesn't exist
30+
logdir = os.path.dirname(logpath)
31+
try:
32+
os.makedirs(logdir)
33+
except OSError as e:
34+
pre_existing = (e.errno == errno.EEXIST and os.path.isdir(logdir))
35+
if pre_existing:
36+
pass
37+
else:
38+
raise e
39+
40+
handler = logging.FileHandler(logpath, mode='w')
41+
handler.setLevel(logging.DEBUG)
42+
43+
# create a logging format
44+
formatter = logging.Formatter(
45+
'%(asctime)s - %(name)s - %(levelname)s - %(message)s'
46+
)
47+
handler.setFormatter(formatter)
48+
49+
# add the handlers to the logger
50+
module_logger.addHandler(handler)
51+
module_logger.info('Started new preAFQ session')
52+
53+
# Reduce verbosity of the boto logs
54+
logging.getLogger('boto').setLevel(logging.WARNING)
55+
logging.getLogger('boto3').setLevel(logging.WARNING)
56+
logging.getLogger('botocore').setLevel(logging.WARNING)

preafq/base.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
from collections import namedtuple
66

77
# Define the different namedtuple return types
8-
InputS3Keys = namedtuple(
9-
'InputS3Keys',
10-
['subject', 'site', 'valid', 's3_keys']
8+
InputFiles = namedtuple(
9+
'InputFiles',
10+
['subject', 'site', 'valid', 'files', 'file_type']
1111
)
1212

13-
# Input files namedtuple
14-
InputFiles = namedtuple('InputFiles', ['subject', 'site', 'files'])
13+
# Input files (one type with session info and one without)
14+
InputFilesWithSession = namedtuple(
15+
'InputFilesWithSession',
16+
['subject', 'site', 'session', 'files', 'file_type']
17+
)

0 commit comments

Comments
 (0)