Skip to content

Latest commit

ย 

History

History
69 lines (59 loc) ยท 4.18 KB

File metadata and controls

69 lines (59 loc) ยท 4.18 KB

Repository Quick Guide (2025-10-01)

codex resume 01999fc7-4004-7500-8186-bb3ccf0a5390.

Current Focus โ€“ QueryGoal End-to-End Runtime

  • Natural language โ†’ QueryGoal ๋ณ€ํ™˜์€ querygoal/pipeline/ ๋ชจ๋“ˆ์ด ๋‹ด๋‹นํ•ฉ๋‹ˆ๋‹ค.
    • orchestrator.py๊ฐ€ ์—”ํŠธ๋ฆฌํฌ์ธํŠธ์ด๋ฉฐ, ํ•˜์œ„ ์ปดํฌ๋„ŒํŠธ๋Š” pattern_matcher.py, template_loader.py, parameter_filler.py, model_selector.py, validator.py ์ˆœ์œผ๋กœ ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค.
    • Goal3 ๋ชจ๋ธ ์„ ํƒ ์‹œ config/model_registry.json๊ณผ config/NSGA2Model_sources.yaml์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
  • ๋Ÿฐํƒ€์ž„ ์‹คํ–‰์€ querygoal/runtime/ ์ดํ•˜ Stage-Gate ๊ตฌ์กฐ๋กœ ๊ตฌํ˜„๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.
    • executor.py โ†’ handlers/swrl_selection_handler.py โ†’ handlers/yaml_binding_handler.py โ†’ handlers/simulation_handler.py ์ˆœ์œผ๋กœ ํ˜ธ์ถœ๋ฉ๋‹ˆ๋‹ค.
    • config/NSGA2Model_sources.yaml์€ ๋Ÿฐํƒ€์ž„ ์ „์šฉ data_sources + ๋ ˆ๊ฑฐ์‹œ sources๋ฅผ ํ•จ๊ป˜ ๊ฐ€์ง„ ํ•˜์ด๋ธŒ๋ฆฌ๋“œ manifest์ž…๋‹ˆ๋‹ค.
    • AAS ์—ฐ๋™์€ clients/aas_client.py(httpx ๊ธฐ๋ฐ˜), ์‹œ๋ฎฌ๋ ˆ์ด์…˜์€ clients/container_client.py(docker run)์—์„œ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
  • ์‹ค์ œ ์‹คํ–‰ ์‚ฐ์ถœ๋ฌผ์€ temp/runtime_executions/<goalId_timestamp>/ ์•„๋ž˜์— ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.
    • ์˜ˆ) goal3_test_024717_20251001_174717 ๋‚ด๋ถ€: yamlBinding JSON, my_case/ ์‹œ๋‚˜๋ฆฌ์˜ค, results/simulator_optimization_result.json, ์ปจํ…Œ์ด๋„ˆ ๋กœ๊ทธ ๋“ฑ.

Project Structure (์œ ์ง€ ์ค‘์ธ ์ฃผ์š” ๊ฒฝ๋กœ)

  • api/ โ€“ FastAPI ๋ฉ”์ธ ์„œ๋น„์Šค (main.py, schemas.py).
  • config/ โ€“ manifest, ๋ชจ๋ธ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ, ์˜จํ†จ๋กœ์ง€, SPARQL ๊ทœ์น™.
  • execution_engine/ โ€“ SWRL SelectionEngine ๋ฐ ์—์ด์ „ํŠธ ๋กœ์ง.
  • querygoal/ โ€“ Pipeline + Runtime (ํ˜„์žฌ ํ•ต์‹ฌ ์ž‘์—… ์˜์—ญ).
  • tests/ โ€“ ๊ณต์šฉ pytest ์ž์‚ฐ. ๋ฃจํŠธ์— ์žˆ๋Š” ๋‹ค์ˆ˜์˜ ํ…Œ์ŠคํŠธ ์Šคํฌ๋ฆฝํŠธ๋Š” ๋””๋ฒ„๊ทธ/์‹คํ—˜์šฉ์ž…๋‹ˆ๋‹ค (๊ณต์‹ ์‹œ๋‚˜๋ฆฌ์˜ค: test_goal1.py, test_goal3.py, test_goal4.py).
  • temp/runtime_executions/ โ€“ ์ตœ๊ทผ ์‹คํ–‰ ๊ฒฐ๊ณผ(์„ฑ๊ณต/์‹คํŒจ ๋ชจ๋‘) ๋กœ๊ทธ ์ €์žฅ์†Œ.

Build & Run

pip install -r requirements.txt
export USE_STANDARD_SERVER=true        # AAS ํ‘œ์ค€ ์„œ๋ฒ„ ์‚ฌ์šฉ ์‹œ
export AAS_SERVER_IP=127.0.0.1
export AAS_SERVER_PORT=5001

# FastAPI ์„œ๋ฒ„
uvicorn api.main:app --reload --port 8000

# Goal3 ํŒŒ์ดํ”„๋ผ์ธ+๋Ÿฐํƒ€์ž„ ์‹คํ–‰ ์˜ˆ์‹œ
python - <<'PY'
import asyncio
from querygoal.pipeline.orchestrator import PipelineOrchestrator
from querygoal.runtime.executor import QueryGoalExecutor

async def main():
    orch = PipelineOrchestrator()
    qg = orch.process_natural_language(
        "Predict production time for product TEST quantity 5"
    )
    executor = QueryGoalExecutor()
    result = await executor.execute_querygoal(qg)
    print(result["executionLog"]["status"], result["workDirectory"])

asyncio.run(main())
PY

Runtime ์„ฑ๊ณต ์ฒดํฌ ๋ฆฌ์ŠคํŠธ

  1. http://<AAS_SERVER_IP>:<PORT>/shells ์š”์ฒญ์ด 200์„ ๋ฐ˜ํ™˜ํ•˜๋Š”์ง€ ํ™•์ธ.
  2. config/NSGA2Model_sources.yaml์˜ URN/idShort๊ฐ€ AAS ๋ฐ์ดํ„ฐ์™€ ์ผ์น˜ํ•˜๋Š”์ง€ ๊ฒ€์ฆ.
  3. Docker ์ด๋ฏธ์ง€ factory-nsga2:latest๊ฐ€ ๋กœ์ปฌ์— ์กด์žฌํ•˜๋Š”์ง€ ํ™•์ธ (docker images).
  4. ์‹คํ–‰ ํ›„ temp/runtime_executions/<goal>/results/์— simulator_optimization_result.json, job_info.csv, operation_info.csv๊ฐ€ ์ƒ์„ฑ๋๋Š”์ง€ ํ™•์ธ.
  5. ์‹คํŒจ ์‹œ failure.log์™€ container_logs_*.txt์—์„œ StageGate ์ด์œ  ๋ฐ ์ปจํ…Œ์ด๋„ˆ ๋กœ๊ทธ ํ™•์ธ.

Coding & Contribution Tips

  • PEP 8, ํƒ€์ž… ํžŒํŠธ ๊ถŒ์žฅ. ๋ณต์žกํ•œ Stage ๋กœ์ง์€ ๊ฐ„๊ฒฐํ•œ ์ฃผ์„์œผ๋กœ ๋ฌธ์„œํ™”.
  • Manifest/JSON/YAML ํฌ๋งท์€ ์ž๋™ํ™” ์˜์กด๋„๊ฐ€ ๋†’์œผ๋ฏ€๋กœ ์ˆ˜๋™ ์ˆ˜์ • ์‹œ data_sources์™€ sources๊ฐ€ ๋™๊ธฐํ™”๋˜์—ˆ๋Š”์ง€ ๋‘ ๋ฒˆ ํ™•์ธ.
  • ์ƒˆ ํ…Œ์ŠคํŠธ๋Š” tests/ ๊ตฌ์กฐ๋ฅผ ์žฌ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜, ๋ฃจํŠธ ํ…Œ์ŠคํŠธ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์ตœ์†Œํ™”ํ•ฉ๋‹ˆ๋‹ค.
  • ์ปค๋ฐ‹ ๋ฉ”์‹œ์ง€๋Š” [์˜์—ญ] ๋™์‚ฌํ˜• ํ˜•์‹์„ ์œ ์ง€ํ•˜๊ณ , PR์—๋Š” ๋ฌธ์ œ/ํ•ด๊ฒฐ/ํ…Œ์ŠคํŠธ ์š”์•ฝ์„ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค.

์ฐธ๊ณ  ๋ฌธ์„œ

  • docs/Goal3_E2E_Complete_Flow.md โ€“ Goal3 ์—”๋“œํˆฌ์—”๋“œ ํ”Œ๋กœ์šฐ(์‹คํ–‰ ๊ฒฐ๊ณผ ๊ธฐ๋ฐ˜).
  • docs/Runtime_Executor_Flow.md โ€“ ๋Ÿฐํƒ€์ž„ Stage-Gate ์„ค๊ณ„ ๊ฐœ์š”.
  • docs/QueryGoal_Runtime_Executor_Implementation_Plan.md โ€“ ๊ตฌํ˜„ ๊ณ„ํš ๋ฐ ์„ธ๋ถ€ ๋‚ด์—ญ.

์ถ”๊ฐ€ ์งˆ๋ฌธ์ด๋‚˜ ํ™˜๊ฒฝ ์ด์Šˆ๋Š” ์ด ํŒŒ์ผ์„ ์ตœ์‹ ์œผ๋กœ ์œ ์ง€ํ•˜๋ฉด์„œ ์ฃผ์„/์ด์Šˆ์— ๊ณต์œ ํ•ด ์ฃผ์„ธ์š”.