Skip to content

Commit

Permalink
Merge pull request #70 from AI-Planning/manifest-new-version
Browse files Browse the repository at this point in the history
Allow compact manifest without the filename change.
  • Loading branch information
haz authored May 6, 2022
2 parents 56f3fca + 5e8ba38 commit d62b4d2
Show file tree
Hide file tree
Showing 19 changed files with 73 additions and 197 deletions.
21 changes: 12 additions & 9 deletions planutils/manifest_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import glob
import os
import copy
import shutil


def load_json(f_name):
Expand Down Expand Up @@ -54,14 +55,16 @@ def generate_manifest():
for conf_file in glob.glob(os.path.join(PACKAGE_DIR, '*')):
base = os.path.basename(conf_file)
if base not in ['README.md', 'TEMPLATE']:
manifest_compact_loc=os.path.join(conf_file, 'manifest_compact.json')
manifest_full_loc=os.path.join(conf_file, 'manifest.json')
if os.path.exists(manifest_compact_loc):
manifest_compact=load_json(manifest_compact_loc)
manifest_loc=os.path.join(conf_file, 'manifest.json')
# Check if "template" is in manifest.json
with open(manifest_loc, 'r') as f:
contents = f.read()
if "template" in contents:
manifest_loc_bak=os.path.join(conf_file, 'manifest.json.bak')
if os.path.exists(manifest_loc_bak):
os.remove(manifest_loc_bak)
shutil.copy(manifest_loc, manifest_loc_bak)
manifest_compact=load_json(manifest_loc)
manifest_full=generate_full_manifest(service_templates,manifest_compact,base)
save_json(manifest_full_loc,manifest_full)
save_json(manifest_loc,manifest_full)





1 change: 0 additions & 1 deletion planutils/package_installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

CUR_DIR = os.path.dirname(os.path.abspath(__file__))

manifest_converter.generate_manifest()

def check_package(target, manifest):
assert os.path.exists(manifest), "Error: Manifest must be defined for %s" % target
Expand Down
39 changes: 11 additions & 28 deletions planutils/packages/cerberus-sat/manifest.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,14 @@
{
"name": "Cerberus planner for satisficing planning",
"description": "https://github.com/ctpelok77/fd-red-black-postipc2018",
"install-size": "20K",
"dependencies": [
"cerberus"
],
"endpoint": {
"services": {
"solve": {
"args": [
{
"name": "domain",
"type": "file",
"description": "domain file"
},
{
"name": "problem",
"type": "file",
"description": "problem file"
}
],
"call": "cerberus-sat {domain} {problem}",
"return": {
"type": "generic",
"files": "*plan*"
}
}
}
"name": "Cerberus planner for satisficing planning",
"description": "https://github.com/ctpelok77/fd-red-black-postipc2018",
"install-size": "20K",
"dependencies": ["cerberus"],
"endpoint": {
"services": {
"solve": {
"template": "planner"
}

}
}
}
14 changes: 0 additions & 14 deletions planutils/packages/cerberus-sat/manifest_compact.json

This file was deleted.

File renamed without changes.
File renamed without changes.
55 changes: 23 additions & 32 deletions planutils/packages/forbiditerative-topk/manifest.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,27 @@
{
"name": "Forbid-Iterative top-k planner",
"description": "https://github.com/IBM/forbiditerative",
"install-size": "20K",
"dependencies": [
"forbiditerative"
],
"endpoint": {
"services": {
"solve": {
"args": [
{
"name": "domain",
"type": "file",
"description": "domain file"
},
{
"name": "problem",
"type": "file",
"description": "problem file"
},
{
"name": "number_of_plans",
"type": "int",
"description": "Number of Plans"
}
],
"call": "forbiditerative-topk {domain} {problem} {number_of_plans}",
"return": {
"type": "generic",
"files": "found_plans/done/sas_plan.*"
}
}
"name": "Forbid-Iterative top-k planner",
"description": "https://github.com/IBM/forbiditerative",
"install-size": "20K",
"dependencies": ["forbiditerative"],
"endpoint": {
"services": {
"solve": {
"template": "planner",
"args":[
{
"name": "number_of_plans",
"type": "int",
"description": "Number of Plans",
"default":3
}
],
"call":"{package_name} {domain} {problem} {number_of_plans}",
"return": {
"type": "generic",
"files": "found_plans/done/sas_plan.*"
}
}

}
}
}
27 changes: 0 additions & 27 deletions planutils/packages/forbiditerative-topk/manifest_compact.json

This file was deleted.

File renamed without changes.
40 changes: 12 additions & 28 deletions planutils/packages/lama-first/manifest.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,15 @@
{
"name": "LAMA-FIRST",
"description": "http://fast-downward.org/",
"install-size": "20K",
"dependencies": [
"downward"
],
"endpoint": {
"services": {
"solve": {
"args": [
{
"name": "domain",
"type": "file",
"description": "domain file"
},
{
"name": "problem",
"type": "file",
"description": "problem file"
}
],
"call": "lama-first {domain} {problem}",
"return": {
"type": "generic",
"files": "*plan*"
}
}
}
"name": "LAMA-FIRST",
"description": "http://fast-downward.org/",
"install-size": "20K",
"dependencies": [
"downward"
],
"endpoint": {
"services": {
"solve": {
"template": "planner"
}
}
}
}
15 changes: 0 additions & 15 deletions planutils/packages/lama-first/manifest_compact.json

This file was deleted.

40 changes: 12 additions & 28 deletions planutils/packages/lama/manifest.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,15 @@
{
"name": "LAMA",
"description": "http://fast-downward.org/",
"install-size": "20K",
"dependencies": [
"downward"
],
"endpoint": {
"services": {
"solve": {
"args": [
{
"name": "domain",
"type": "file",
"description": "domain file"
},
{
"name": "problem",
"type": "file",
"description": "problem file"
}
],
"call": "lama {domain} {problem}",
"return": {
"type": "generic",
"files": "*plan*"
}
}
}
"name": "LAMA",
"description": "http://fast-downward.org/",
"install-size": "20K",
"dependencies": [
"downward"
],
"endpoint": {
"services": {
"solve": {
"template": "planner"
}
}
}
}
15 changes: 0 additions & 15 deletions planutils/packages/lama/manifest_compact.json

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions planutils/settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

import json, os

from planutils import manifest_converter

# This should eventually be changed once the prefix is customizable
PLANUTILS_PREFIX = os.path.join(os.path.expanduser('~'), '.planutils')

Expand All @@ -14,3 +16,4 @@ def load():
def save(s):
with open(SETTINGS_FILE, 'w') as f:
f.write(json.dumps(s))
manifest_converter.generate_manifest()

0 comments on commit d62b4d2

Please sign in to comment.