-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* New branch * bug on containers pagination from rancher * error codes seadata * better pagination for rancher containers list * irods problems fix * Saving errors in order of data (seadata) * bug fix on edmo code * more improvements on seadata * metadata fix * bug fix * request for a fix * errors one step higher (seadata) * doc fix * bug fixes and optimizations * bug fix * Adding a patch test * Draft celery async task in seadata * bug fix * small updates to async * small mods * debugging * bug fix * bug fix * base for irods in worker * splitting b2handle from pid generation * Move to production async * Adding api call when celery finishes * bug fix * bug fix * counting the workers totals * return the id * removing extra projects and moving projectrc * worker path fix * Back door to skip the APIs call * try more workers :) * worker fix * dir fix * unzip operation with shutils in celery task * try to fix the broken pip10 update * Allow celery to put the zip file only in backdoor cases * A new task for async orders * bug fix * bug fix * b2handle bugfix * debugging b2handle on celery * bug fix * dir zip fix * adding extra configuration for seadata * bug fix * more fix * fix for merret * fix task for order to call CDI * bug fix * double fix * Adding a count of files added * remove logging * redis test * fix * fix * bug fix to avoid redis library in backend * fix redis again * bug fix * fix * fix redis import * swagger fix * don't set for now the cache on workers * bug fix * Adding redis parameters * scan fix * more fix * extra check on pid resolution * prefetching disabled on celery * Push fix for ticket and slashes * Try catch problems in workers * Adding mongo and fixing celery conf * adding elastic * add verification counts * adding redis cache * use the cache * various bug fixes * bug fix * bug fix * better output on seadata * few mods * previous * towards leaving all ideas up to others * Cleanup compose configurations to reflect new defaults * Switching to backend+irods images * Adding --development flag to fix tests execution * First stub of restricted orders * Added submodules do to gitignore * Added celeryui * Added rapydo version to project configuration * Check on order path existence * Fix error message * Creation of order collection * Merge of restricted users list * Added json.loads to convert string into json * Stub for zip merge * Debug on irods stream operation * Checks on upload operation * Bug fix to allow flower credentials * Switched put and post methods * Test to enable celery in debug mode * Removed celery stuffs in debug mode * Removed project_configuration from gitignore * Shifted the ingestion phase for restricted orders [not yet in add mode] Removed binary mode * Working on zip merge * Checking if partial zip exists * Checking if partial zip exists * Copying partial zip on local fs * Fix local path, added file name * Unzipping partial zip * Check unzip result * Check if final zip exists * Copy partial zip as final zip if still does not exist * Passing extra check parameters as input [checksum, size, file count] * add verify of file size and file count * Fix file count check * Added checksum to checks * Check to avoid overwrite of partial zip * User stresstest backdoor to upload two zip files * Working on zip merge * Completing filename with zip extention if missing * Adding files to file zip * Fix adding files to file zip * Fix zip file open mode from r to a * Uploading update final zip * Bug fix, i were using open instead of put * Multi-file download * Bug fix download * Added Back compatibility temporary fix * Fix back compatibility * Removed variables [should be inherited from backend conf] * Added new variables to backend conf * Removed debug code * Open port for adminer interface * Extended the restricted upload endpoint to specify the file name * Configurable qc label for rancher * changed var name. * Added more helpful log message in error case. * Logging to RabbitMQ updated (much code moved to rapydo repo). * Added docstring, changed comment. * Enabled logging to RabbitMQ in production mode. * In debug mode, rapydo handles logging to file instead of to RabbitMQ. * Renamed variable. * Allow customizing app_name. * Added log messages. * Added TODOs. * Cosmetics (logging start+end of enable+upload). * Log end of upload in case file existed. * Added log message for error if batch was not enabled. * Added two log messages. * Configure if we wait for rancher-tasks (#120) * Can now configure whether rancher should wait for container to be running or stopped. * Make sure waits until stopped if told so.
- Loading branch information
Showing
78 changed files
with
2,107 additions
and
638 deletions.
There are no files selected for viewing
This file contains 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 file contains 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 file contains 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 file contains 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 file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
vault_path="/mnt/data1/irods/Vault/cloud" | ||
irods_path="/sdcCineca/cloud" | ||
import_prefix="import30may_rabbithole_500000_" | ||
pid_prefix="21.T12995" | ||
out_file="./pids.txt" | ||
|
||
rm -f $out_file | ||
|
||
for dir in $(ls -1d ${vault_path}/${import_prefix}*); | ||
do | ||
for element in $(ls -1 $dir/*); | ||
do | ||
# echo $element | ||
fname=$(basename $element) | ||
dpath=$(dirname $element) | ||
dname=$(basename $dpath) | ||
pid=$(imeta ls -d $irods_path/$dname/$fname | grep $pid_prefix) | ||
echo -e "$dname\t$fname\t$pid" >> $out_file | ||
# break | ||
done | ||
# break | ||
done | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
|
||
############################################### | ||
# count current batch import | ||
|
||
import os | ||
import json | ||
# from datetime import datetime | ||
from glob import glob as find | ||
from plumbum.cmd import imeta, grep | ||
|
||
pid_prefix = '21.T12995' | ||
irods_path = "/sdcCineca/cloud" | ||
main_path = '/mnt/data1/irods/Vault/cloud' | ||
prefix_batches = 'import01june_rabbithole_500000_' | ||
os.chdir(main_path) | ||
|
||
files = find("./%s*/**.txt" % prefix_batches) | ||
# print(datetime.now(), len(files)) | ||
|
||
############### | ||
# Obtain pids (requires 'plumbum') | ||
counter = 0 | ||
data = {} | ||
for file in files: | ||
counter += 1 | ||
pieces = file.split('/') | ||
filename = pieces.pop() | ||
batch = pieces.pop() | ||
ipath = os.path.join(irods_path, batch, filename) | ||
chain = imeta['ls', '-d', ipath] | grep[pid_prefix] | ||
try: | ||
out = chain() | ||
except Exception as e: | ||
print('failed: %s [%s]' % (filename, batch)) | ||
continue | ||
pid = out.split(' ')[1].rstrip() | ||
# print(filename, pid.encode('ascii')) | ||
data[filename] = pid.encode('ascii') | ||
|
||
if counter % 100 == 0: | ||
print("Found: %s" % counter) | ||
# break | ||
if counter % 10000 == 0: | ||
print("saving what we have so far") | ||
with open('/tmp/test.json', 'w') as fh: | ||
json.dump(data, fh) | ||
|
||
with open('/tmp/test.json', 'w') as fh: | ||
json.dump(data, fh) | ||
|
||
""" | ||
(datetime.datetime(2018, 6, 1, 23, 36, 56, 304232), 37738) | ||
(datetime.datetime(2018, 6, 2, 6, 57, 35, 644743), 82849) | ||
(datetime.datetime(2018, 6, 2, 10, 12, 52, 812827), 103112) | ||
(datetime.datetime(2018, 6, 3, 10, 33, 53, 584727), 254153) | ||
""" | ||
|
||
# ############################################### | ||
# # Graceful shutdown of celery worker(s) | ||
|
||
# """ | ||
# http://docs.celeryproject.org/en/latest/userguide/workers.html#stopping-the-worker | ||
# """ | ||
|
||
# from restapi.flask_ext import get_debug_instance | ||
# from restapi.flask_ext.flask_celery import CeleryExt | ||
# obj = get_debug_instance(CeleryExt) | ||
# workers = obj.control.inspect() | ||
# workers.active().keys() | ||
# w = list(workers.active().keys()) | ||
|
||
# # https://stackoverflow.com/a/41885106 | ||
# # celery.control.broadcast('shutdown', destination=[<celery_worker_name>]) | ||
|
||
# for element in w: | ||
# print(element) # celery@worker-25d6b959aa91 ? | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
################################# | ||
import sys | ||
import random | ||
from datetime import datetime | ||
import better_exceptions as be | ||
# from utilities import helpers | ||
from utilities import apiclient | ||
|
||
################################# | ||
REMOTE_DOMAIN = 'seadata.cineca.it' | ||
URI = 'https://%s' % REMOTE_DOMAIN | ||
USERNAME = 'stresstest' | ||
PASSWORD = 'somepassword' | ||
# LOG_LEVEL = 'info' # or 'debug', 'verbose', 'very_verbose' | ||
LOG_LEVEL = 'verbose' | ||
|
||
################################# | ||
log = apiclient.setup_logger(__name__, level_name=LOG_LEVEL) | ||
log.very_verbose('init log: %s\nURI [%s]', be, URI) | ||
# apiclient.call(URI) | ||
|
||
################################# | ||
# log.pp(sys.argv) | ||
order_size = 100 | ||
if len(sys.argv) > 1: | ||
order_size = int(sys.argv[1]) | ||
log.debug("Order size: %s", order_size) | ||
|
||
################################# | ||
# read json | ||
with open('init.json') as f: | ||
import json | ||
myjson = json.load(f) | ||
log.info("Total PIDs: %s", len(myjson)) | ||
|
||
################################# | ||
pids = random.sample(list(myjson.values()), order_size) | ||
# log.pp(pids) | ||
|
||
################################# | ||
# login to HTTP API with B2SAFE credentials | ||
token, _ = apiclient.login(URI, USERNAME, PASSWORD) | ||
log.info("Logged in with token: %s...", token[:20]) | ||
|
||
# ################################# | ||
# pass | ||
order_id = 'pythonpaulie_00%s' % datetime.today().strftime("%H%M%S") | ||
now = datetime.today().strftime("%Y%m%dT%H:%M:%S") | ||
endpoint = '/api/orders' | ||
params = { | ||
"request_id": order_id, "edmo_code": 12345, "datetime": now, | ||
"version": "1", "api_function": "order_create_zipfile", | ||
"test_mode": "true", "parameters": { | ||
"login_code": "unknown", "restricted": "false", | ||
"file_name": "order_%s_unrestricted" % order_id, | ||
"order_number": order_id, "pids": pids, "file_count": len(pids), | ||
} | ||
} | ||
# log.pp(params) | ||
apiclient.call( | ||
URI, method='post', endpoint=endpoint, | ||
token=token, payload=params | ||
) | ||
# log.pp(res) |
This file contains 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 file contains 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 file contains 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 file contains 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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
Oops, something went wrong.