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

default creativework status #59

Merged
merged 2 commits into from
Apr 12, 2024
Merged
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
25 changes: 16 additions & 9 deletions odabot/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ def update_workflow(last_commit,
build_engine,
cleanup,
gitlab_api_url,
extra_emails=[]):
extra_emails=[],
creative_work_status = "development"):
deployed_workflows = {}
deployment_info = None

Expand Down Expand Up @@ -404,14 +405,17 @@ def update_workflow(last_commit,


else:
sparql_obj.insert(f'''
kg_record = f'''
{rdflib.URIRef(project['http_url_to_repo']).n3()} a oda:WorkflowService;
oda:last_activity_timestamp "{last_commit_created_at}";
oda:last_deployed_timestamp "{datetime.now().timestamp()}";
oda:service_name "{project['name'].lower().replace(' ', '_').replace('-', '_')}";
oda:deployment_namespace "{deployment_namespace}";
oda:deployment_name "{deployment_info['deployment_name']}" .
''')
oda:last_activity_timestamp "{last_commit_created_at}";
oda:last_deployed_timestamp "{datetime.now().timestamp()}";
oda:service_name "{project['name'].lower().replace(' ', '_').replace('-', '_')}";
oda:deployment_namespace "{deployment_namespace}";
oda:deployment_name "{deployment_info['deployment_name']}";
<https://schema.org/creativeWorkStatus> "{creative_work_status}".
'''

sparql_obj.insert(kg_record)
set_commit_state(gitlab_api_url,
project['id'],
last_commit['id'],
Expand Down Expand Up @@ -460,6 +464,8 @@ def update_workflows(obj, dry_run, force, loop, pattern):
gitlab_api_url = obj['settings'].get('gitlab.api_url', "https://gitlab.renkulab.io/api/v4/")
gitlab_gid = obj['settings'].get('gitlab.gid', 5606)

default_creative_status = obj['settings'].get('nb2workflow.default_creative_status', 'development')

if obj['settings'].get('nb2workflow.state_storage.type', 'yaml') == 'yaml':
state_storage = obj['settings'].get('nb2workflow.state_storage.path', 'oda-bot-runtime-workflows.yaml')
else:
Expand Down Expand Up @@ -519,7 +525,8 @@ def update_workflows(obj, dry_run, force, loop, pattern):
build_engine,
cleanup=False if obj['debug'] else True,
gitlab_api_url=gitlab_api_url,
extra_emails=admin_emails)
extra_emails=admin_emails,
creative_work_status=default_creative_status)

logger.info('Workflow update status %s', workflow_update_status)
logger.info('Deployment info %s', deployment_info)
Expand Down
Loading