IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
Browse Source

Automatic subproject creation for processes seems to work.

pull/1/head
parent
commit
2c95865e2e
1 changed files with 17 additions and 10 deletions
  1. +17
    -10
      frontend/src/js/arvados/process/wb-submit-container-request.js

+ 17
- 10
frontend/src/js/arvados/process/wb-submit-container-request.js View File

@@ -23,7 +23,7 @@ function wbParseWorkflowInputs(workflowDefinition, userInputs, errors) {
function ensureSubProject(arvHost, arvToken, projectUuid) { function ensureSubProject(arvHost, arvToken, projectUuid) {
const filters = [ const filters = [
[ 'type', '=', 'project' ],
[ 'group_class', '=', 'project' ],
[ 'owner_uuid', '=', projectUuid ], [ 'owner_uuid', '=', projectUuid ],
[ 'properties.type', '=', 'daily_process_subproject_container' ] [ 'properties.type', '=', 'daily_process_subproject_container' ]
]; ];
@@ -36,13 +36,14 @@ function ensureSubProject(arvHost, arvToken, projectUuid) {
let prom_1 = new Promise(accept => accept()); let prom_1 = new Promise(accept => accept());
prom_1 = prom_1.then(() => makeArvadosRequest(arvHost, arvToken, prom_1 = prom_1.then(() => makeArvadosRequest(arvHost, arvToken,
'/arvados/v1/groups', { method: 'POST', '/arvados/v1/groups', { method: 'POST',
data: { owner_uuid: projectUuid,
data: JSON.stringify({ owner_uuid: projectUuid,
group_class: 'project',
name: 'Container for daily sub-projects for processes', name: 'Container for daily sub-projects for processes',
properties: { type: 'daily_process_subproject_container' } } }));
properties: { type: 'daily_process_subproject_container' } }) }));
prom_1 = prom_1.then(xhr_1 => xhr_1.response.uuid); prom_1 = prom_1.then(xhr_1 => xhr_1.response.uuid);
return prom_1; return prom_1;
} }
return xhr.items[0].uuid;
return xhr.response.items[0].uuid;
}); });
let date = new Date(); let date = new Date();
@@ -50,29 +51,35 @@ function ensureSubProject(arvHost, arvToken, projectUuid) {
('00' + (date.getMonth() + 1)).slice(-2) + '-' + ('00' + (date.getMonth() + 1)).slice(-2) + '-' +
('00' + date.getDate()).slice(-2); ('00' + date.getDate()).slice(-2);
prom = prom.then(containerUuid => {
let containerUuid;
prom = prom.then(uuid => {
containerUuid = uuid;
const filters_1 = [ const filters_1 = [
[ 'type', '=', 'project'],
[ 'group_class', '=', 'project'],
[ 'owner_uuid', '=', containerUuid ], [ 'owner_uuid', '=', containerUuid ],
[ 'properties.type', '=', 'daily_process_subproject' ], [ 'properties.type', '=', 'daily_process_subproject' ],
[ 'properties.date', '=', date ] [ 'properties.date', '=', date ]
]; ];
return makeArvadosRequest(arvHost, arvToken, return makeArvadosRequest(arvHost, arvToken,
'/arvados/v1/groups?filters=' + encodeURIComponent(JSON.stringify(filters_1))); '/arvados/v1/groups?filters=' + encodeURIComponent(JSON.stringify(filters_1)));
}); });
prom = prom.then(xhr => { prom = prom.then(xhr => {
if (xhr.reponse.items.length === 0) {
if (xhr.response.items.length === 0) {
let prom_1 = new Promise(accept => accept()); let prom_1 = new Promise(accept => accept());
prom_1 = prom_1.then(() => makeArvadosRequest(arvHost, arvToken, prom_1 = prom_1.then(() => makeArvadosRequest(arvHost, arvToken,
'/arvados/v1/groups', { method: 'POST', '/arvados/v1/groups', { method: 'POST',
data: { owner_uuid: containerUuid,
data: JSON.stringify({ owner_uuid: containerUuid,
group_class: 'project',
name: 'Daily processes sub-project for ' + date, name: 'Daily processes sub-project for ' + date,
properties: { type: 'daily_process_subproject', date } } }));
properties: { type: 'daily_process_subproject', date } }) }));
prom_1 = prom_1.then(xhr => xhr.response.uuid); prom_1 = prom_1.then(xhr => xhr.response.uuid);
return prom_1; return prom_1;
} }
return xhr.items[0].uuid;
return xhr.response.items[0].uuid;
}); });
return prom; return prom;
} }


Loading…
Cancel
Save