Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable QRMs as concrete solutions for augmentation and behavioral patterns #157

Merged
merged 76 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
67ea278
Improve logs in pattern transformator
wederbn May 14, 2024
598e41d
Remove unused code
wederbn May 14, 2024
d54bf7f
Inline pattern declaration
wederbn May 14, 2024
137ae8d
Add missing variable declaration
wederbn May 14, 2024
ee976fc
Move pattern removal to utils
wederbn May 14, 2024
2d60ba1
Add docs
wederbn May 14, 2024
57bdfab
Fix linting
wederbn May 14, 2024
66e24fa
Remove unused code
wederbn May 14, 2024
34a73c5
Add utility function to retrieve types in a generic manner
wederbn May 14, 2024
583aed0
Add utility method to check for QuantME subprocesses
wederbn May 14, 2024
cd4b74b
Remove redundant code
wederbn May 14, 2024
728ee15
Improve logging
wederbn May 14, 2024
1a0aa84
Simplify check for forbidden patterns
wederbn May 14, 2024
96220b1
Add constant for pattern prefix
wederbn May 14, 2024
d1a2df2
Switch to direct import
wederbn May 14, 2024
d57eecd
Fix headings
wederbn May 14, 2024
65c31a9
Add PatternId to pattern modeling constructs
wederbn May 14, 2024
b415439
Incorporate pattern ID when adding pattern modeling constructs for se…
wederbn May 14, 2024
fbcc971
Forward pattern ID during transformation
wederbn May 14, 2024
882a5b8
Remove faulty logging
wederbn May 14, 2024
d902210
Retrieve pattern ID by type
wederbn May 14, 2024
47a04de
Add IDs to test
wederbn May 14, 2024
13ed40d
Add QC atlas to test setup
wederbn May 14, 2024
263de27
Add environment and version for Pattern Atlas container
wederbn May 15, 2024
2f64814
Add QC Atlas
wederbn May 15, 2024
99c8b93
Fix ports for test setup
wederbn May 15, 2024
daf5b0f
Add version for WF engine
wederbn May 15, 2024
1da9882
Add database to test setup
wederbn May 15, 2024
37993d0
remove unused import
wederbn May 15, 2024
2e08201
remove unused import
wederbn May 15, 2024
8843d50
Fix equality checks
wederbn May 15, 2024
9ca4ff5
Fix unused declarations
wederbn May 15, 2024
afa7211
Remove unused code
wederbn May 15, 2024
624e311
Run linter
wederbn May 15, 2024
aba0736
Use constant for QuantumCircuitExecutionTask
wederbn May 15, 2024
afd513b
Use constant for REM
wederbn May 15, 2024
8e1e7c4
Move comment to correct position
wederbn May 15, 2024
9baffc4
Remove duplicate ajax method
wederbn May 15, 2024
c2c081b
Remove pattern IDs from test workflow
wederbn May 15, 2024
98a7a2f
Fix port mapping
wederbn May 15, 2024
57a8fb7
Bump DB version
wederbn May 15, 2024
c7291d3
Add DB env
wederbn May 15, 2024
e8761c3
Move env to corresct container
wederbn May 15, 2024
830884e
Add endpoint for Latex renderer
wederbn May 15, 2024
ed708c8
Log status code
wederbn May 15, 2024
1a1f9b5
Add log for wf deployment
wederbn May 15, 2024
1228ce5
Run linter
wederbn May 15, 2024
8c731a0
Adapt pattern endpoints
wederbn May 15, 2024
60788fc
Run linter
wederbn May 15, 2024
267636d
Add additional logging
wederbn May 15, 2024
8a4beca
Add logging
wederbn May 15, 2024
0f05be5
Add done statement
wederbn May 15, 2024
2881333
Increase timeout
wederbn May 15, 2024
63efa40
Remove done()
wederbn May 15, 2024
89cc77e
Remove log
wederbn May 15, 2024
0cb62fc
Add TODO for test case
wederbn May 15, 2024
60c7c5f
adding funcitionalty for inserting concrete solutions from qc-atlas f…
mbeisel May 16, 2024
12eb918
linting
mbeisel May 16, 2024
a1799a7
fix space removal bug
mbeisel May 17, 2024
e2fed94
linting
mbeisel May 17, 2024
620ae45
Remove solved TODOs
wederbn May 17, 2024
753ad71
update atlas version in compose
mbeisel May 17, 2024
f2e7dee
Merge branch 'improveLogging' of https://github.com/PlanQK/workflow-m…
mbeisel May 17, 2024
feb3e9b
Check cutting config within pattern test
wederbn May 17, 2024
55524d6
Improve logging
wederbn May 17, 2024
c16e72d
Use business object to check correct config
wederbn May 17, 2024
188ae95
update qrm retrieval to include patternsolutions
mbeisel May 17, 2024
60460f2
refactoring
mbeisel May 17, 2024
32d9d21
refactoring
mbeisel May 17, 2024
f844b5c
Merge branch 'improveLogging' of https://github.com/PlanQK/workflow-m…
mbeisel May 17, 2024
b1d5fb2
Only retrieve QRMs from repo within QuantME test
wederbn May 17, 2024
144c0b9
Linter
wederbn May 17, 2024
985a9e7
Fix second invocation of updateQRM
wederbn May 17, 2024
6aa346a
Add test case loading pattern-based QRMs
wederbn May 17, 2024
458d011
Activite new test file
wederbn May 17, 2024
554c9a9
fix visibility of variable
mbeisel May 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 47 additions & 2 deletions .github/workflows/run-npm-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,55 @@ jobs:
runs-on: ubuntu-latest

services:
### Workflow Deployment Test Setup ###
workflow-test-engine:
image: planqk/workflow-engine-test:latest
image: planqk/workflow-engine-test:v1.0.0
ports:
- 8090:8090
### End of Workflow Deployment Test Setup ###

### Pattern-based Test Setup ###
db:
image: planqk/db-test:v1.1.0
ports:
- 5060:5060
env:
POSTGRES_USERS: 'planqk:planqk|patternatlas:patternatlas|qprov:qprov'
POSTGRES_DATABASES: 'planqk:planqk|patternatlas:patternatlas|qprov:qprov'
QC_ATLAS_CONTENT_REPOSITORY_BRANCH: 'master'
ATLAS_DB: planqk
PATTERNATLAS_DB: patternatlas

pattern-atlas-api:
image: patternatlas/pattern-atlas-api:v1.9.0
ports:
- 1977:1977
env:
JDBC_DATABASE_URL: db
JDBC_DATABASE_USERNAME: patternatlas
JDBC_DATABASE_PASSWORD: patternatlas
JDBC_DATABASE_PORT: 5060
DB_INIT_USER: patternatlas
DB_INIT_PASSWORD: patternatlas
LATEX_RENDERER_HOST_NAME: latex-renderer
LATEX_RENDERER_PORT: 5030
JDBC_DATABASE_NAME: patternatlas
PATTERN_ATLAS_FETCH_INITIAL_DATA: 'true'
HAL_EXPLORER: 'false'
SPRING_PROFILES_ACTIVE: docker

qc-atlas:
image: planqk/atlas:v3.1.4
ports:
- 6626:6626
env:
POSTGRES_HOSTNAME: db
POSTGRES_PORT: 5060
POSTGRES_USER: planqk
POSTGRES_PASSWORD: planqk
POSTGRES_DB: planqk
### End of Pattern-based Test Setup ###


steps:
- uses: actions/checkout@v3
Expand All @@ -27,4 +72,4 @@ jobs:
npm ci
npm run build
npm test
working-directory: ./components/bpmn-q
working-directory: ./components/bpmn-q
1 change: 1 addition & 0 deletions components/bpmn-q/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module.exports = function (config) {
"test/tests/dataflow/data-flow-palette.spec.js",
"test/tests/dataflow/data-flow-replace-menu.spec.js",
"test/tests/pattern/pattern-config.spec.js",
"test/tests/pattern/pattern-qrms.spec.js",
"test/tests/pattern/pattern-transformation.spec.js",
],

Expand Down
28 changes: 0 additions & 28 deletions components/bpmn-q/modeler-component/editor/ModelerHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,6 @@ export function createModeler(containerId, propertiesParentId) {
return modeler;
}

/**
* Create a new modeler object with the Camunda extensions but no custom extensions
*
* @return the created modeler
*/
export function createPlainModeler() {
return new BpmnModeler({
additionalModules: [CamundaExtensionModule],
keyboard: {
bindTo: document,
},
moddleExtensions: {
camunda: camundaModdleDescriptor,
},
});
}

/**
* Creates a modeler with all additional modules and extension moddles from all active plugins which is not
* saved in as the current modeler instance
Expand All @@ -85,17 +68,6 @@ export function createTempModeler() {
});
}

/**
* Create a Modeler with only Camunda native extensions and no additional modules
*
* @returns the created bpmn-js modeler
*/
export function createLightweightModeler() {
return new BpmnModeler({
moddleExtensions: getExtensions(),
});
}

/**
* Creates a modeler with all additional modules and extension moddles from all active plugins which is not
* saved in as the current modeler instance and load the given xml into it.
Expand Down
10 changes: 5 additions & 5 deletions components/bpmn-q/modeler-component/editor/ui/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ export default function Toolbar(props) {
// retrieve all active plugins to identify also the dependency plugins
const activePlugins = getActivePlugins();
const patternEnabled = activePlugins.some(
(p) => p.name == consts.pluginNames.PATTERN
(p) => p.name === consts.pluginNames.PATTERN
);
const quantmeEnabled = activePlugins.some(
(p) => p.name == consts.pluginNames.QUANTME
(p) => p.name === consts.pluginNames.QUANTME
);
const qhanaEnabled = activePlugins.some(
(p) => p.name == consts.pluginNames.QHANA
(p) => p.name === consts.pluginNames.QHANA
);
const opentoscaEnabled = activePlugins.some(
(p) => p.name == consts.pluginNames.OPENTOSCA
(p) => p.name === consts.pluginNames.OPENTOSCA
);
const dataflowEnabled = activePlugins.some(
(p) => p.name == consts.pluginNames.DATAFLOW
(p) => p.name === consts.pluginNames.DATAFLOW
);

const handleShortcutClick = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function XMLViewerButton() {

// Dynamically set the value of the editor
let xml = getModeler().xml;
if (xml.xml != undefined) {
if (xml.xml !== undefined) {
xml = xml.xml;
}
aceEditor.setValue(xml);
Expand Down
30 changes: 28 additions & 2 deletions components/bpmn-q/modeler-component/editor/util/HttpUtilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,25 @@
* SPDX-License-Identifier: Apache-2.0
*/

import $ from "jquery";

/**
* Retrieves the Json data from the given endpoint.
*
* @param endpoint the endpoint to retrieve the data form
* @param method
* @returns
*/
export async function fetchDataFromEndpoint(endpoint, method = "GET") {
export async function fetchDataFromEndpoint(
endpoint,
method = "GET",
acceptHeader = ["application/json", "application/hal+json"]
) {
try {
const response = await fetch(endpoint, {
method: method,
headers: {
Accept: ["application/json", "application/hal+json"],
Accept: acceptHeader,
},
});
if (!response.ok) {
Expand All @@ -47,3 +53,23 @@ export async function fetchSolutionFromEndpoint(endpoint) {
return {};
}
}

export function performAjax(targetUrl, dataToSend) {
return new Promise(function (resolve, reject) {
$.ajax({
type: "POST",
url: targetUrl,
data: dataToSend,
processData: false,
crossDomain: true,
contentType: false,
beforeSend: function () {},
success: function (data) {
resolve(data);
},
error: function (err) {
reject(err);
},
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,10 @@ export async function deployWorkflowToCamunda(

// make the request and wait for the response of the deployment endpoint
try {
console.log(
"Deploying to Camunda Engine: ",
editorConfig.getCamundaEndpoint() + "/deployment/create"
);
const response = await fetch(
editorConfig.getCamundaEndpoint() + "/deployment/create",
{
Expand Down
113 changes: 4 additions & 109 deletions components/bpmn-q/modeler-component/editor/util/ModellingUtilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,117 +7,12 @@ import {
import { is } from "bpmn-js/lib/util/ModelUtil";

/**
* Returns all start events of the workflow defined by the process businessObject
* Get the type of a given element
*
* @param processBo The process businessObject containing the workflow
* @returns {*[]} All found start event elements of the workflow.
* @param element the element to retrieve the type for
*/
export function getStartEvents(processBo) {
return processBo.flowElements.filter(
(element) => element.$type === "bpmn:StartEvent"
);
}

/**
* Adds a Camunda execution listener to the given element which creates the given process variable.
*
* @param element The element to add the execution listener to.
* @param moddle The moddle module of the current bpmn-js modeler.
* @param processVariable The process variable which should be created through the executionn listener
*/
export function addExecutionListener(element, moddle, processVariable) {
// create the execution listener for the process variable
const listener = {
event: "start",
expression:
'${execution.setVariable("' +
processVariable.name +
'", ' +
processVariable.value +
")}",
};

const elementBo = element.businessObject;
let extensionElements = elementBo.extensionElements;

// create new extension element if needed
if (!extensionElements) {
extensionElements = moddle.create("bpmn:ExtensionElements");
}

if (!extensionElements.values) {
extensionElements.values = [];
}

// add execution listener to the extension element of the element
extensionElements.values.push(
moddle.create("camunda:ExecutionListener", listener)
);
elementBo.extensionElements = extensionElements;
}

/**
* Add the data of the given key value map as properties to a created Camunda form field. The form field is added to the given
* element.
*
* @param elementID The ID of the given element.
* @param name Name of the form field
* @param keyValueMap The key value map
* @param elementRegistry The elementRegistry of the bpmn-js modeler
* @param moddle The moddle module of the bpmn-js modeler
* @param modeling The modeling module of the bpmn-js modeler
*/
export function addFormFieldForMap(
elementID,
name,
keyValueMap,
elementRegistry,
moddle,
modeling
) {
// create the properties of the form field
let formFieldData = {
defaultValue: "",
id: name.replace(/\s+/g, "_"),
label: name,
type: "string",
};

// create the form field for the key value map
addFormFieldDataForMap(
elementID,
formFieldData,
keyValueMap,
elementRegistry,
moddle,
modeling
);
}

/**
* Add the data of the given key value map as properties to a created Camunda form field defined by the given form field
* data. The form field is added to the given element.
*
* @param elementID The ID of the given element.
* @param formFieldData The given form field data.
* @param keyValueMap The key value map
* @param elementRegistry The elementRegistry of the bpmn-js modeler
* @param moddle The moddle module of the bpmn-js modeler
* @param modeling The modeling module of the bpmn-js modeler
*/
export function addFormFieldDataForMap(
elementID,
formFieldData,
keyValueMap,
elementRegistry,
moddle,
modeling
) {
// create camunda properties for each entry of the key value map
formFieldData.properties = createCamundaProperties(keyValueMap, moddle);

// create form field for form field data
addFormField(elementID, formFieldData, elementRegistry, moddle, modeling);
export function getType(element) {
return element.$type ? element.$type : element.type;
}

/**
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

import { fetch } from "whatwg-fetch";
import { performAjax } from "../utilities/Utilities";
import { performAjax } from "../../../editor/util/HttpUtilities";

/**
* Upload the CSAR located at the given URL to the connected OpenTOSCA Container and return the corresponding URL and required input parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default class OpenTOSCARules extends RuleProvider {
function canMove(context) {
let target = context.target;

if (target != undefined) {
if (target !== undefined) {
if (context.shapes[0].type.includes("Policy")) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ export function Connector({ element, translate, filteredUrls, methodUrlList }) {
inputParameters.push(urlInputParameter);
inputParameters.push(payloadInputParameter);

let outputParameters = [];

outputParameters = determineOutputParameters(element.businessObject.yaml);
let outputParameters = determineOutputParameters(
element.businessObject.yaml
);
let camundaOutputParameters =
constructCamundaOutputParameters(outputParameters);

Expand Down
Loading
Loading