Files
aitbc/scripts/deployment/create-job.sh
aitbc 3897bcbf24
Some checks failed
CLI Tests / test-cli (push) Failing after 4s
Deploy to Testnet / deploy-testnet (push) Successful in 1m40s
Documentation Validation / validate-docs (push) Failing after 12s
Documentation Validation / validate-policies-strict (push) Successful in 4s
Integration Tests / test-service-integration (push) Successful in 2m42s
Package Tests / Python package - aitbc-agent-sdk (push) Failing after 34s
Package Tests / Python package - aitbc-core (push) Successful in 27s
Package Tests / Python package - aitbc-crypto (push) Successful in 13s
Package Tests / Python package - aitbc-sdk (push) Successful in 16s
Package Tests / JavaScript package - aitbc-sdk-js (push) Successful in 8s
Package Tests / JavaScript package - aitbc-token (push) Successful in 18s
Python Tests / test-python (push) Failing after 50s
Security Scanning / security-scan (push) Failing after 43s
Multi-Node Stress Testing / stress-test (push) Successful in 12s
Cross-Node Transaction Testing / transaction-test (push) Successful in 9s
refactor: move version to separate module and improve logging
- Created aitbc/_version.py with centralized version definition
- Updated aitbc/__init__.py to import __version__ from _version module
- Updated constants.py to use __version__ for PACKAGE_VERSION
- Replaced print() calls with logger in decorators.py, events.py, queue_manager.py, and state.py
- Added logger initialization using get_logger(__name__) in config.py, decorators.py, events.py, queue_manager.py, and state.py
- Added cli/commands
2026-05-11 20:12:01 +02:00

102 lines
2.8 KiB
Bash
Executable File

#!/bin/bash
# ============================================================================
# AITBC Mesh Network - Create Job Script
# ============================================================================
set -e
# Colors for output
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
AITBC_ROOT="${AITBC_ROOT:-/opt/aitbc}"
VENV_DIR="$AITBC_ROOT/venv"
PYTHON_CMD="$VENV_DIR/bin/python"
# Get arguments
JOB_TITLE="$1"
BUDGET="$2"
if [[ -z "$JOB_TITLE" || -z "$BUDGET" ]]; then
echo -e "${YELLOW}Usage: $0 <job_title> <budget>${NC}"
echo ""
echo "Example: $0 'Data Analysis Project' 500.0"
exit 1
fi
# Validate budget is numeric
if ! [[ "$BUDGET" =~ ^[0-9]+\.?[0-9]*$ ]]; then
echo -e "${RED}Error: Budget must be a numeric value${NC}"
exit 1
fi
echo -e "${BLUE}💼 Creating New Job${NC}"
echo "=================="
echo "Title: $JOB_TITLE"
echo "Budget: $BUDGET AITBC"
echo ""
# Create job
cd "$AITBC_ROOT"
"$PYTHON_CMD" -c "
import sys
import json
import time
import random
# Load job marketplace
with open('/opt/aitbc/data/job_marketplace.json', 'r') as f:
marketplace = json.load(f)
# Generate unique job ID
job_id = marketplace['total_jobs'] + 1
job_address = f'job_{job_id:03d}'
# Create new job
new_job = {
'id': job_address,
'client': f'0xclient_{job_id:03d}',
'title': '$JOB_TITLE',
'description': f'This is job {job_id}: $JOB_TITLE',
'category': random.choice(['content_creation', 'data_analysis', 'research', 'development']),
'requirements': ['Python', 'AI/ML', 'Problem Solving'],
'budget': float('$BUDGET'),
'deadline': time.time() + (7 * 24 * 60 * 60), # 7 days from now
'status': 'open',
'applications': [],
'selected_agent': None,
'created_at': time.time()
}
# Add job to marketplace
marketplace['jobs'][job_address] = new_job
marketplace['job_categories'][new_job['category']].append(job_address)
marketplace['total_jobs'] += 1
marketplace['active_jobs'] += 1
marketplace['last_updated'] = time.time()
# Save updated marketplace
with open('/opt/aitbc/data/job_marketplace.json', 'w') as f:
json.dump(marketplace, f, indent=2)
print(f'✅ Job Created Successfully')
print(f' Job ID: {new_job[\"id\"]}')
print(f' Title: {new_job[\"title\"]}')
print(f' Budget: {new_job[\"budget\"]:.2f} AITBC')
print(f' Category: {new_job[\"category\"]}')
print(f' Status: {new_job[\"status\"]}')
print(f' Deadline: {time.strftime(\"%Y-%m-%d %H:%M:%S\", time.gmtime(new_job[\"deadline\"]))}')
"
echo ""
echo -e "${GREEN}🎉 Job '$JOB_TITLE' has been created on the AITBC marketplace!${NC}"
echo ""
echo -e "${BLUE}Next Steps:${NC}"
echo "1. View all jobs: ./scripts/list-jobs.sh"
echo "2. View agent dashboard: ./scripts/agent-dashboard.sh"
echo "3. Add more agents: ./scripts/add-agent.sh <name> <capability>"