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

fix(job/control): modify runner from template #1100

Merged
merged 1 commit into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion e2e/tests/signalApp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ test('run Create job', async ({ page }) => {
await page.getByRole('button', { name: 'Open in new tab' }).click()
await page.getByRole('button', { name: 'Run' }).click()
await page.getByRole('button', { name: 'Show logs' }).click()
await expect(page.getByText('Job starting in 5 seconds...')).toBeVisible()
await expect(
page.getByText('Progress tracking not implemented')
).toBeVisible()
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "helloWorldLocalContainerRunner",
"type": "JOBCORE:LocalContainer",
"label": "Hello world",
"image": {
"type": "JOBCORE:ContainerImage",
"description": "Hello world test container",
"imageName": "hello-world",
"version": "latest",
"registryName": "library"
},
"network": "example_default",
"environmentVariables": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "reverseDescriptionRunner",
"type": "JOBCORE:ReverseDescription"
}
18 changes: 17 additions & 1 deletion example/app/data/DemoDataSource/recipes/job.recipe.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,23 @@
"recipe": {
"name": "job-control",
"type": "CORE:UiRecipe",
"plugin": "@development-framework/dm-core-plugins/job/controls"
"plugin": "@development-framework/dm-core-plugins/job/controls",
"config": {
"type": "PLUGINS:dm-core-plugins/job/ControlConfig",
"recurring": false,
"runnerTemplates": [
{
"type": "PLUGINS:dm-core-plugins/common/Template",
"path": "dmss://DemoDataSource/plugins/job/helloWorldLocalContainerRunner",
"label": "Hello world"
},
{
"type": "PLUGINS:dm-core-plugins/common/Template",
"path": "dmss://DemoDataSource/plugins/job/reverseDescriptionRunner",
"label": "Reverse description"
}
]
}
}
},
"gridArea": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"type": "PLUGINS:dm-core-plugins/list/ListPluginConfig",
"templates": [
{
"type": "PLUGINS:dm-core-plugins/table/Template",
"type": "PLUGINS:dm-core-plugins/common/Template",
"path": "~._template_",
"label": "Template1"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@
"type": "PLUGINS:dm-core-plugins/list/ListPluginConfig",
"templates": [
{
"type": "PLUGINS:dm-core-plugins/table/Template",
"type": "PLUGINS:dm-core-plugins/common/Template",
"path": "~._templates_[0]",
"label": "Template1"
},
{
"type": "PLUGINS:dm-core-plugins/table/Template",
"type": "PLUGINS:dm-core-plugins/common/Template",
"path": "~._templates_[1]",
"label": "Template2"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,17 @@
"type": "PLUGINS:dm-core-plugins/table/TablePluginConfig",
"templates": [
{
"type": "PLUGINS:dm-core-plugins/table/Template",
"type": "PLUGINS:dm-core-plugins/common/Template",
"path": "~._templates_[0]",
"label": "Template1"
},
{
"type": "PLUGINS:dm-core-plugins/table/Template",
"type": "PLUGINS:dm-core-plugins/common/Template",
"path": "~._templates_[1]",
"label": "Template2"
},
{
"type": "PLUGINS:dm-core-plugins/table/Template",
"type": "PLUGINS:dm-core-plugins/common/Template",
"path": "~._templates_[2]",
"label": "Template3"
}
Expand Down Expand Up @@ -154,7 +154,7 @@
"type": "PLUGINS:dm-core-plugins/table/TablePluginConfig",
"templates": [
{
"type": "PLUGINS:dm-core-plugins/table/Template",
"type": "PLUGINS:dm-core-plugins/common/Template",
"path": "~._templates_[0]",
"label": "Template1"
}
Expand Down Expand Up @@ -219,7 +219,7 @@
"type": "PLUGINS:dm-core-plugins/table/TablePluginConfig",
"templates": [
{
"type": "PLUGINS:dm-core-plugins/table/Template",
"type": "PLUGINS:dm-core-plugins/common/Template",
"path": "~._templates_[0]",
"label": "Template1"
}
Expand Down
2 changes: 1 addition & 1 deletion example/app/data_sources/DemoDataSource.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "mongo-db",
"host": "db",
"port": 27017,
"username": "root",
"username": "maf",
"password": "xd7wCEhEx4kszsecYFfC",
"tls": false,
"database": "DemoDataSource",
Expand Down
2 changes: 1 addition & 1 deletion example/app/data_sources/ExtraDataSource.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "mongo-db",
"host": "db",
"port": 27017,
"username": "root",
"username": "maf",
"password": "xd7wCEhEx4kszsecYFfC",
"tls": false,
"database": "ExtraDataSource",
Expand Down
28 changes: 15 additions & 13 deletions example/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,33 @@ version: '3.4'

services:
dmss:
image: datamodelingtool.azurecr.io/dmss:v1.15.3
image: datamodelingtool.azurecr.io/dmss:v1.16.2
platform: linux/amd64
restart: unless-stopped
environment:
AUTH_ENABLED: 0
ENVIRONMENT: local
# RESET_DATA_SOURCE: off
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: xd7wCEhEx4kszsecYFfC
# RESET_DATA_SOURCE: off
MONGO_USERNAME: maf
MONGO_PASSWORD: xd7wCEhEx4kszsecYFfC
SECRET_KEY: sg9aeUM5i1JO4gNN8fQadokJa3_gXQMLBjSGGYcfscs= # Don't reuse this in production...
DATA_SOURCE_FILES: '{ "name": "system", "repositories": { "db": { "type": "mongo-db", "host": "db", "port": 27017, "username": "root", "password": "xd7wCEhEx4kszsecYFfC", "tls": false, "database": "DMSS-core", "collection": "DMSS-core" } }}'
# volumes:
# - ../../data-modelling-storage-service/src:/code/src
# volumes:
# - ../../data-modelling-storage-service/src:/code/src
ports:
- '5000:5000'
depends_on:
- db

db:
image: mongo:3.4
command: mongod --quiet
volumes:
- ./dmss-data/db:/data/db
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_USERNAME: maf
MONGO_INITDB_ROOT_PASSWORD: xd7wCEhEx4kszsecYFfC
volumes:
- ./dmss-data/db:/data/db

job-api:
image: datamodelingtool.azurecr.io/dm-job:v1.4.2
image: datamodelingtool.azurecr.io/dm-job:v1.5.1
platform: linux/amd64
restart: unless-stopped
environment:
Expand All @@ -40,19 +38,23 @@ services:
SCHEDULER_REDIS_SSL: 'false'
DMSS_API: http://dmss:5000
API_DEBUG: 1
AUTH_ENABLED: 0
ENVIRONMENT: local
AZURE_JOB_SUBSCRIPTION: 14d57366-b2ae-4da8-8b75-e273c6fdabe2
AZURE_JOB_RESOURCE_GROUP: dmt-test-containers
AZURE_SP_SECRET: ${AZURE_SP_SECRET}
AZURE_JOB_TENANT_ID: 3aa4a235-b6e2-48d5-9195-7fcf05b459b0
AZURE_JOB_CLIENT_ID: 97a6b5bd-63fb-42c6-bb75-7e5de2394ba0
DATA_SOURCE_FILES: '{ "name": "WorkflowDS", "repositories": { "db": { "type": "mongo-db", "host": "db", "port": 27017, "username": "root", "password": "xd7wCEhEx4kszsecYFfC", "tls": false, "database": "workflowDS", "collection": "default", "data_types": [] } }}'
MONGO_PASSWORD: xd7wCEhEx4kszsecYFfC
#SIMA_LICENSE: |
depends_on:
- job-store
- db
volumes:
# - /var/run/docker.sock:/var/run/docker.sock # Needed for docker-in-docker jobs
- ./job_handlers:/code/src/job_handler_plugins
# - ../../dm-job/src/job_handler_plugins:/code/src/job_handler_plugins
# - ../../dm-job/src:/code/src
ports:
- '5001:5000'

Expand Down
4 changes: 2 additions & 2 deletions example/job_handlers/signal-app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ def start(self) -> str:
self.job.status = JobStatus.COMPLETED
return "OK"

def remove(self) -> str:
def remove(self) -> Tuple[JobStatus, str]:
logger.info("removing...")
self.job.status = JobStatus.REMOVED
self.job.job_uid=""
return f"removed job with id {self.job.job_uid}"
return JobStatus.REMOVED, f"removed job with id {self.job.job_uid}"

def result(self) -> Tuple[str, bytes]:
return "Done", b"12345"
Expand Down
25 changes: 25 additions & 0 deletions packages/dm-core-plugins/blueprints/common/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "common",
"type": "CORE:Package",
"isRoot": false,
"_meta_": {
"type": "CORE:Meta",
"version": "0.0.1",
"dependencies": [
{
"type": "CORE:Dependency",
"alias": "CORE",
"address": "system/SIMOS",
"version": "0.0.1",
"protocol": "dmss"
},
{
"type": "CORE:Dependency",
"alias": "PLUGINS",
"address": "system/Plugins",
"version": "0.0.1",
"protocol": "dmss"
}
]
}
}
25 changes: 25 additions & 0 deletions packages/dm-core-plugins/blueprints/job/ControlConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "ControlConfig",
"type": "CORE:Blueprint",
"description": "",
"attributes": [
{
"name": "type",
"type": "CORE:BlueprintAttribute",
"attributeType": "string"
},
{
"name": "recurring",
"type": "CORE:BlueprintAttribute",
"attributeType": "boolean",
"optional": true
},
{
"name": "runnerTemplates",
"type": "CORE:BlueprintAttribute",
"attributeType": "PLUGINS:dm-core-plugins/common/Template",
"optional": true,
"dimensions": "*"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"name": "templates",
"type": "CORE:BlueprintAttribute",
"description": "Attribute on parent (of same type as list) which should be used as template when instantiating new items. (e.g. 'template' will use the 'template' attribute on the parent.)",
"attributeType": "PLUGINS:dm-core-plugins/table/Template",
"attributeType": "PLUGINS:dm-core-plugins/common/Template",
"optional": true,
"dimensions": "*"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"name": "templates",
"type": "CORE:BlueprintAttribute",
"description": "Attribute on parent (of same type as list) which should be used as template when instantiating new items. (e.g. 'template' will use the 'template' attribute on the parent.)",
"attributeType": "PLUGINS:dm-core-plugins/table/Template",
"attributeType": "PLUGINS:dm-core-plugins/common/Template",
"optional": true,
"dimensions": "*"
},
Expand Down
4 changes: 4 additions & 0 deletions packages/dm-core-plugins/src/job/CronJob.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export function ConfigureSchedule(props: {
<InputWrapper>
{showAdvanced ? (
<TextField
style={{ maxWidth: '400px' }}
unit='cron'
id='advanced-schedule-syntax'
type='text'
Expand All @@ -129,6 +130,7 @@ export function ConfigureSchedule(props: {
<Autocomplete
options={Object.values(EInterval)}
label={'Interval'}
style={{ maxWidth: '200px' }}
initialSelectedOptions={[interval]}
onInputChange={(label: string) => {
const chosenIntervalType = Object.entries(EInterval)
Expand All @@ -143,6 +145,7 @@ export function ConfigureSchedule(props: {
/>
{interval !== EInterval.HOURLY && (
<Autocomplete
style={{ maxWidth: '200px' }}
options={generateSelectableTimes().map(
(value: string) => value
)}
Expand All @@ -157,6 +160,7 @@ export function ConfigureSchedule(props: {
)}
{interval === EInterval.HOURLY && (
<Autocomplete
style={{ maxWidth: '200px' }}
options={[...Array(12).keys()].map((i) => i + 1)}
initialSelectedOptions={[Number(hourStep)]}
label={'Hour step'}
Expand Down
Loading
Loading