This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Getting Started

What do you need to know to try SCOP Framework?

Information in this section helps you try SCOP Framework yourselves.

Prerequisites

Before starting, make sure that all of the necessary requirements listed below have been installed on the system.

  • Whatever operating system you are using, start by updating the package index.

> sudo apt update

> choco update

> brew update

  • Install the open source distributed version control system git.

> sudo apt install git

> choco install git

> brew install git

  • Install the dependency manager maven.

> sudo apt install maven

> choco install maven

> brew install maven

  • Install the free software package for retrieving files wget.

> sudo apt install wget

> choco install wget

> brew install wget

  • Install the JDK of Java 21 or later.

> sudo apt install openjdk-21-jdk

> choco install java

> brew install java

  • Install your favorite IDE for Java (e.g., Eclipse IDE, IntelliJ IDEA).

In this documentation, we use Eclipse IDE for the examples.

  • Install the open source MQTT broker Mosquitto.

If you want you can install another broker, however you need to give correctly to MAGE its URL.

> sudo apt install mosquitto

> choco install mosquitto

> brew install mosquitto

  • Moreover, it is highly recommended to have an account from an open source end-to-end software development platform with built-in version control like GitLab, Github and so on.

In this documentation, we use GitLab since it has built-in version control, issue tracking, code review, CI/CD, and more.

Installation & Setup

In this section, we describe how to create and set up your first MAGE project.

This section is prepared for Windows. If you using Windows, make sure that The Windows Subsystem for Linux (WSL) is activated. For Linux/MacOS, the instructions are very similar.

Create a project on GitLab

Using your browser, sign in to your GitLab account and click create a new blank project.

Give a name to your project such as ABMProject and set the project slug as mage.abmproject.

Note that, the project slug must not contain the character - as it will be used during project configuration.

Clone the project using git

On the project home page, click Clone and then click Clone with HTTP to copy the project git url to the clipboard.

Open a terminal window and go to the git folder.

> cd git

Type git clone and paste the url from the clipboard.

> git clone https://gitlab.com/ogurcan/mage.abmproject.git

This will fetch the empty project from GitLab. You will to see the following output:

Cloning into 'mage.abmproject'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), done.

Build your MAGE project

Enter inside the project’s folder.

> cd mage.abmproject

Fetch the project builder script using wget.

> wget https://gitlab.com/scop-framework/mage.template/-/raw/master/.mage-project-builder.sh

This will download .mage-project-builder.sh to the project’s root folder. You will to see the following output:

--2022-12-02 15:45:51--  https://gitlab.com/scop-framework/mage.template/-/raw/master/mage-project-builder.sh
Resolving gitlab.com (gitlab.com)... 172.65.251.78
Connecting to gitlab.com (gitlab.com)|172.65.251.78|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1866 (1.8K) [text/plain]
Saving to: 'mage-project-builder.sh'

mage-project-builder.sh       100%[=================================================>]   1.82K  --.-KB/s    in 0.004s

2022-12-02 15:45:51 (439 KB/s) - 'mage-project-builder.sh' saved [1866/1866]

Execute the script to configure your MAGE project:

> chmod +x .mage-project-builder.sh && ./.mage-project-builder.sh

> .mage-project-builder.sh

>.mage-project-builder.sh

This will download all necessary files, install the required mage.api dependency using Maven and configure the pom.xml file.

Note that it will take the parent folder’s name as artifactID in pom.xml.

Verify the project structure

To verify the configuration, first list the project folder contents using the dir command.

> dir
13/12/2022  23:39    <DIR>          .
13/12/2022  23:39    <DIR>          ..
13/12/2022  23:39             1,478 .classpath
13/12/2022  23:39               178 .gitignore
13/12/2022  23:39               497 .gitlab-ci.yml
13/12/2022  23:39    <DIR>          .m2
13/12/2022  23:39               155 .mage-api-install.sh
13/12/2022  23:39               111 .mage-execute.sh
13/12/2022  23:38             2,072 .mage-project-builder.sh
13/12/2022  23:39               541 .project
13/12/2022  23:39    <DIR>          .settings
13/12/2022  23:39             4,909 pom.xml
13/12/2022  23:39             1,296 README.md
13/12/2022  23:39    <DIR>          src
               9 File(s)         11,237 bytes
               5 Dir(s)  329,697,140,736 bytes free

To have a detailed view, now list the tree structure of the project folder using the tree command.

> tree /a /f
Folder PATH listing
Volume serial number is B8B2-6F1E
C:.
|   .classpath
|   .gitignore
|   .gitlab-ci.yml
|   .mage-api-install.sh
|   .mage-execute.sh
|   .mage-project-builder.sh
|   .project
|   pom.xml
|   README.md
|
+---.m2
|       ci_settings.xml
|
+---.settings
|       org.eclipse.jdt.core.prefs
|       org.eclipse.m2e.core.prefs
|
\---src
    +---main
    |   +---java
    |   |   \---mage
    |   |       \---abmproject
    |   |               HelloWorldExperimenter.java
    |   |
    |   \---resources
    |       |   log4j.properties
    |       |   mage.api-1.0.0-a.1.jar
    |       |
    |       \---experiments
    |               DefaultExperimenter.xml
    |
    \---test
        +---java
        \---resources
                log4j.properties

We are done with the script. Delete it.

> rm .mage-project-builder.sh

> del .mage-project-builder.sh

> rm .mage-project-builder.sh

Try executing it out!

To try the default example experimenter, run the .mage-execute.sh script in the project’s root folder.

> ./.mage-execute.sh

> .mage-execute.sh

>.mage-execute.sh

This will execute the HelloWorldExperimenter and will generate the following output.

[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< scop-framework:mage.abmproject >--------------------
[INFO] Building scop-framework.mage.abmproject 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The artifact org.slf4j:slf4j-log4j12:jar:2.0.3 has been relocated to org.slf4j:slf4j-reload4j:jar:2.0.3
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ mage.abmproject ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ mage.abmproject ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- exec-maven-plugin:3.1.0:java (default-cli) @ mage.abmproject ---
[INFO] Using the XML loader.
[INFO] Loading configuration
[INFO] Unable to load external configuration file experiments/DefaultExperimenter.xml, maybe it is internal ?
[INFO] Configuration loaded.
[INFO] [  0.00] Running experiment.
[INFO] [  0.00] ThePlatform/Role/ExperimenterAgent is ACTIVE now.
[INFO] [  0.00] ThePlatform/Role/ActionScheduler is ACTIVE now.
[INFO] [  0.00] ThePlatform/SchedulerRole/ActionScheduler is ACTIVE now.
[INFO] [  0.00] ThePlatform/ExperimenterRole/ExperimenterAgent is ACTIVE now.
[INFO] [  0.00] ThePlatform/Role/HW_Environment is ACTIVE now.
[INFO] [  0.00] HW_Environment/GroupManagerRole/HW_Environment is ACTIVE now.
[INFO] [  0.00] ThePlatform/Role/Bob is ACTIVE now.
[INFO] [  0.00] HW_Environment/BystanderRole/Bob is ACTIVE now.
[INFO] [  4.00] Bob says "Hello World !"
[INFO] [  9.00] Bob says "Hello World !"
[INFO] [ 14.00] Bob says "Hello World !"
[INFO] [ 19.00] Bob says "Hello World !"
[INFO] [ 24.00] Bob says "Hello World !"
[INFO] [ 29.00] Bob says "Hello World !"
[INFO] [ 34.00] Bob says "Hello World !"
[INFO] [ 39.00] Bob says "Hello World !"
[INFO] [ 44.00] Bob says "Hello World !"
[INFO] [ 49.00] Bob says "Hello World !"
[INFO] [101.00] Done.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  13.764 s
[INFO] Finished at: 2022-12-15T12:16:55+04:00
[INFO] ------------------------------------------------------------------------
Press any key to continue...

Commit your MAGE project to git

The initial configuration is done. Now you can make your first commit that create the main branch in your git repository.

First, list the untracked files using git status:

> git status
On branch main

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        .gitignore
        .gitlab-ci.yml
        .m2/
        .mage-api-install.sh
        .mage-execute.sh
        .mage-project-builder.sh
        README.md
        pom.xml
        src/

nothing added to commit but untracked files present (use "git add" to track)
>

Then, use git add . to track them all.

> git add .
warning: in the working copy of '.gitignore', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of '.gitlab-ci.yml', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of '.m2/ci_settings.xml', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of '.mage-execute.sh', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of '.mage-project-builder.sh', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'README.md', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'pom.xml', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'src/main/java/mage/abmproject/HelloWorldExperimenter.java', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'src/main/resources/experiments/DefaultExperimenter.xml', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'src/main/resources/log4j.properties', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'src/test/resources/log4j.properties', LF will be replaced by CRLF the next time Git touches it

Finally, commit all the staged files.

> git commit -m "Initial commit"
[main (root-commit) b47a2eb] Initial commit
 13 files changed, 483 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 .gitlab-ci.yml
 create mode 100644 .m2/ci_settings.xml
 create mode 100644 .mage-api-install.sh
 create mode 100644 .mage-execute.sh
 create mode 100644 .mage-project-builder.sh
 create mode 100644 README.md
 create mode 100644 pom.xml
 create mode 100644 src/main/java/mage/abmproject/HelloWorldExperimenter.java
 create mode 100644 src/main/resources/experiments/DefaultExperimenter.xml
 create mode 100644 src/main/resources/log4j.properties
 create mode 100644 src/main/resources/mage.api-1.0.0-a.1.jar
 create mode 100644 src/test/resources/log4j.properties

View your MAGE project in your IDE

View in Eclipse IDE

Open your Eclipse IDE.

Click Window > Show View > Other... and type git to filter options.

Choose Git Repositories from the list and click Open.

Go to the Git Repositories view and click Add an existing local Git Repository to this view.

From the pop-up window Add Git Repositories, find and add mage.abmproject.

From the Git Repositories view, right clich on the mage.abmproject repository and click Import Projects...

Eclipse IDE will automatically find your empty project. Just click Finish and your project will be added in the Project Explorer window.

Commit your MAGE project to git

Now, go back to Eclipse IDE, click on the project root on Project Explorer and press F5 to refresh it.

You will see the updated project content.

Click Window > Show View > Other... and type git to filter options.

Choose Git Staging from the list and click Open.

Go to the Git Staging view, click ++ to add all files to Staged Changes, type "Initial commit." as Commit Message, click Add Signed-off by and finally click Commit and Push.

Congratulations! You have created and configured your MAGE project. Now you can start developing.

Check-out and try the HelloWorld project

Before proceeding, let’s download and run the Hello World example.

Go to the GitLab project page of Hello World Tutorial in your browser.

On the project web page, click Clone and then click Clone with HTTP to copy the project git url to the clipboard.

https://gitlab.com/scop-framework/model-library/tutorial/mage.tutorial.helloworld.git

Go to the Git Repositories view in Eclipse IDE and click Clone a Git Repository and add the clone to this view.

Right click on the repository, click Import Projects... and then click Finish. This will import the project into your Project Explorer.

1 - SCOP Framework

Multi-AGent development and Experimentation (SCOP) Platform

SCOP Framework allows for building, experimenting and deploying multi-agent systems in Java!

With SCOP, just a few lines of code is all you need to start building agents like an expert.

Prerequisites

Before starting, make sure that all of the necessary requirements listed below have been installed on the system.

  • Whatever operating system you are using, start by updating the package index.

> sudo apt update

> choco update

> brew update

  • Install the open source distributed version control system git.

> sudo apt install git

> choco install git

> brew install git

  • Install the dependency manager maven.

> sudo apt install maven

> choco install maven

> brew install maven

  • Install the free software package for retrieving files wget.

> sudo apt install wget

> choco install wget

> brew install wget

  • Install the JDK of Java 21 or later.

> sudo apt install openjdk-21-jdk

> choco install java

> brew install java

  • Install your favorite IDE for Java (e.g., Eclipse IDE, IntelliJ IDEA).

In this documentation, we use Eclipse IDE for the examples.

  • Install the open source MQTT broker Mosquitto.

If you want you can install another broker, however you need to give correctly to SCOP its URL.

> sudo apt install mosquitto

> choco install mosquitto

> brew install mosquitto

  • Moreover, it is highly recommended to have an account from an open source end-to-end software development platform with built-in version control like GitLab, Github and so on.

In this documentation, we use GitLab since it has built-in version control, issue tracking, code review, CI/CD, and more.

Installation & Setup

In this section, we describe how to create and set up your first SCOP project.

This section is prepared for Windows. If you using Windows, make sure that The Windows Subsystem for Linux (WSL) is activated. For Linux/MacOS, the instructions are very similar.

Create a project on GitLab

Using your browser, sign in to your GitLab account and click create a new blank project.

Give a name to your project such as ABMProject and set the project slug as mage.abmproject.

Note that, the project slug must not contain the character - as it will be used during project configuration.

Clone the project using git

On the project home page, click Clone and then click Clone with HTTP to copy the project git url to the clipboard.

Open a terminal window and go to the git folder.

> cd git

Type git clone and paste the url from the clipboard.

> git clone https://gitlab.com/ogurcan/mage.abmproject.git

This will fetch the empty project from GitLab. You will to see the following output:

Cloning into 'mage.abmproject'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), done.

Build your SCOP project

Enter inside the project’s folder.

> cd mage.abmproject

Fetch the project builder script using wget.

> wget https://gitlab.com/scop-framework/mage.template/-/raw/master/.mage-project-builder.sh

This will download .mage-project-builder.sh to the project’s root folder. You will to see the following output:

--2022-12-02 15:45:51--  https://gitlab.com/scop-framework/mage.template/-/raw/master/mage-project-builder.sh
Resolving gitlab.com (gitlab.com)... 172.65.251.78
Connecting to gitlab.com (gitlab.com)|172.65.251.78|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1866 (1.8K) [text/plain]
Saving to: 'mage-project-builder.sh'

mage-project-builder.sh       100%[=================================================>]   1.82K  --.-KB/s    in 0.004s

2022-12-02 15:45:51 (439 KB/s) - 'mage-project-builder.sh' saved [1866/1866]

Execute the script to configure your SCOP project:

> chmod +x .mage-project-builder.sh && ./.mage-project-builder.sh

> .mage-project-builder.sh

>.mage-project-builder.sh

This will download all necessary files, install the required mage.api dependency using Maven and configure the pom.xml file.

Note that it will take the parent folder’s name as artifactID in pom.xml.

Verify the project structure

To verify the configuration, first list the project folder contents using the dir command.

> dir
13/12/2022  23:39    <DIR>          .
13/12/2022  23:39    <DIR>          ..
13/12/2022  23:39             1,478 .classpath
13/12/2022  23:39               178 .gitignore
13/12/2022  23:39               497 .gitlab-ci.yml
13/12/2022  23:39    <DIR>          .m2
13/12/2022  23:39               155 .mage-api-install.sh
13/12/2022  23:39               111 .mage-execute.sh
13/12/2022  23:38             2,072 .mage-project-builder.sh
13/12/2022  23:39               541 .project
13/12/2022  23:39    <DIR>          .settings
13/12/2022  23:39             4,909 pom.xml
13/12/2022  23:39             1,296 README.md
13/12/2022  23:39    <DIR>          src
               9 File(s)         11,237 bytes
               5 Dir(s)  329,697,140,736 bytes free

To have a detailed view, now list the tree structure of the project folder using the tree command.

> tree /a /f
Folder PATH listing
Volume serial number is B8B2-6F1E
C:.
|   .classpath
|   .gitignore
|   .gitlab-ci.yml
|   .mage-api-install.sh
|   .mage-execute.sh
|   .mage-project-builder.sh
|   .project
|   pom.xml
|   README.md
|
+---.m2
|       ci_settings.xml
|
+---.settings
|       org.eclipse.jdt.core.prefs
|       org.eclipse.m2e.core.prefs
|
\---src
    +---main
    |   +---java
    |   |   \---mage
    |   |       \---abmproject
    |   |               HelloWorldExperimenter.java
    |   |
    |   \---resources
    |       |   log4j.properties
    |       |   mage.api-1.0.0-a.1.jar
    |       |
    |       \---experiments
    |               DefaultExperimenter.xml
    |
    \---test
        +---java
        \---resources
                log4j.properties

We are done with the script. Delete it.

> rm .mage-project-builder.sh

> del .mage-project-builder.sh

> rm .mage-project-builder.sh

Try executing it out!

To try the default example experimenter, run the .mage-execute.sh script in the project’s root folder.

> ./.mage-execute.sh

> .mage-execute.sh

>.mage-execute.sh

This will execute the HelloWorldExperimenter and will generate the following output.

[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< scop-framework:mage.abmproject >--------------------
[INFO] Building scop-framework.mage.abmproject 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The artifact org.slf4j:slf4j-log4j12:jar:2.0.3 has been relocated to org.slf4j:slf4j-reload4j:jar:2.0.3
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ mage.abmproject ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ mage.abmproject ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- exec-maven-plugin:3.1.0:java (default-cli) @ mage.abmproject ---
[INFO] Using the XML loader.
[INFO] Loading configuration
[INFO] Unable to load external configuration file experiments/DefaultExperimenter.xml, maybe it is internal ?
[INFO] Configuration loaded.
[INFO] [  0.00] Running experiment.
[INFO] [  0.00] ThePlatform/Role/ExperimenterAgent is ACTIVE now.
[INFO] [  0.00] ThePlatform/Role/ActionScheduler is ACTIVE now.
[INFO] [  0.00] ThePlatform/SchedulerRole/ActionScheduler is ACTIVE now.
[INFO] [  0.00] ThePlatform/ExperimenterRole/ExperimenterAgent is ACTIVE now.
[INFO] [  0.00] ThePlatform/Role/HW_Environment is ACTIVE now.
[INFO] [  0.00] HW_Environment/GroupManagerRole/HW_Environment is ACTIVE now.
[INFO] [  0.00] ThePlatform/Role/Bob is ACTIVE now.
[INFO] [  0.00] HW_Environment/BystanderRole/Bob is ACTIVE now.
[INFO] [  4.00] Bob says "Hello World !"
[INFO] [  9.00] Bob says "Hello World !"
[INFO] [ 14.00] Bob says "Hello World !"
[INFO] [ 19.00] Bob says "Hello World !"
[INFO] [ 24.00] Bob says "Hello World !"
[INFO] [ 29.00] Bob says "Hello World !"
[INFO] [ 34.00] Bob says "Hello World !"
[INFO] [ 39.00] Bob says "Hello World !"
[INFO] [ 44.00] Bob says "Hello World !"
[INFO] [ 49.00] Bob says "Hello World !"
[INFO] [101.00] Done.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  13.764 s
[INFO] Finished at: 2022-12-15T12:16:55+04:00
[INFO] ------------------------------------------------------------------------
Press any key to continue...

Commit your SCOP project to git

The initial configuration is done. Now you can make your first commit that create the main branch in your git repository.

First, list the untracked files using git status:

> git status
On branch main

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        .gitignore
        .gitlab-ci.yml
        .m2/
        .mage-api-install.sh
        .mage-execute.sh
        .mage-project-builder.sh
        README.md
        pom.xml
        src/

nothing added to commit but untracked files present (use "git add" to track)
>

Then, use git add . to track them all.

> git add .
warning: in the working copy of '.gitignore', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of '.gitlab-ci.yml', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of '.m2/ci_settings.xml', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of '.mage-execute.sh', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of '.mage-project-builder.sh', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'README.md', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'pom.xml', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'src/main/java/mage/abmproject/HelloWorldExperimenter.java', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'src/main/resources/experiments/DefaultExperimenter.xml', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'src/main/resources/log4j.properties', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'src/test/resources/log4j.properties', LF will be replaced by CRLF the next time Git touches it

Finally, commit all the staged files.

> git commit -m "Initial commit"
[main (root-commit) b47a2eb] Initial commit
 13 files changed, 483 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 .gitlab-ci.yml
 create mode 100644 .m2/ci_settings.xml
 create mode 100644 .mage-api-install.sh
 create mode 100644 .mage-execute.sh
 create mode 100644 .mage-project-builder.sh
 create mode 100644 README.md
 create mode 100644 pom.xml
 create mode 100644 src/main/java/mage/abmproject/HelloWorldExperimenter.java
 create mode 100644 src/main/resources/experiments/DefaultExperimenter.xml
 create mode 100644 src/main/resources/log4j.properties
 create mode 100644 src/main/resources/mage.api-1.0.0-a.1.jar
 create mode 100644 src/test/resources/log4j.properties

View your SCOP project in your IDE

View in Eclipse IDE

Open your Eclipse IDE.

Click Window > Show View > Other... and type git to filter options.

Choose Git Repositories from the list and click Open.

Go to the Git Repositories view and click Add an existing local Git Repository to this view.

From the pop-up window Add Git Repositories, find and add mage.abmproject.

From the Git Repositories view, right clich on the mage.abmproject repository and click Import Projects...

Eclipse IDE will automatically find your empty project. Just click Finish and your project will be added in the Project Explorer window.

Commit your SCOP project to git

Now, go back to Eclipse IDE, click on the project root on Project Explorer and press F5 to refresh it.

You will see the updated project content.

Click Window > Show View > Other... and type git to filter options.

Choose Git Staging from the list and click Open.

Go to the Git Staging view, click ++ to add all files to Staged Changes, type "Initial commit." as Commit Message, click Add Signed-off by and finally click Commit and Push.

Congratulations! You have created and configured your SCOP project. Now you can start developing.

Check-out and try the HelloWorld project

Before proceeding, let’s download and run the Hello World example.

Go to the GitLab project page of Hello World Tutorial in your browser.

On the project web page, click Clone and then click Clone with HTTP to copy the project git url to the clipboard.

https://gitlab.com/scop-framework/model-library/tutorial/mage.tutorial.helloworld.git

Go to the Git Repositories view in Eclipse IDE and click Clone a Git Repository and add the clone to this view.

Right click on the repository, click Import Projects... and then click Finish. This will import the project into your Project Explorer.

2 - Running on Docker

Guide for running SCOP Framework on Docker.

Running on Docker

This guide provides instructions for building and running simulations using Docker for the SCOP Framework.

Prerequisites

Before you begin, make sure you have the following installed on your system:

  • Docker (tested on version 4.35.0)
  • An active internet connection to pull base images and dependencies.

Required Files

Ensure that the following file is present in your working directory:

  • Dockerfile (located in the root directory of your project)

The Dockerfile contains the instructions necessary to build the Docker image that will run your simulation.

Build the Docker Image

To build the Docker image, run the following command in your terminal:

docker build --no-cache -t model-name .
  • --no-cache: Ensures that the build process does not use any cached layers.
  • Replace model-name with the desired name for your Docker image.

This process may take some time depending on the complexity of your Dockerfile and the dependencies required.

Run the Docker Image as a Detached Container

After building the image, run it as a detached container using:

docker run -d --name model-name-container model-name
  • -d: Runs the container in detached mode (in the background).
  • --name model-name-container: Sets the name of the running container to model-name-container (you can change this to any name you prefer).
  • model-name: Refers to the Docker image you built earlier.

Verify the Running Container

To verify that your container is running, use:

docker ps
  • This command lists all active containers. Look for model-name-container in the output to confirm that your container is running.

View Container Logs

To view the logs generated by your running container, use:

docker logs model-name-container
  • This command helps you monitor the output of your simulation and is useful for debugging any issues.

Stop the Running Container

When you need to stop the container, use:

docker stop model-name-container
  • This will gracefully stop the container named model-name-container.

Additional Tips

  • Restart a Stopped Container: If you want to restart a stopped container, use:

    docker start model-name-container
    
  • Remove a Container: To remove a container after it has stopped, use:

    docker rm model-name-container
    
  • Remove an Image: If you need to remove the Docker image, use:

    docker rmi model-name
    

By following these steps, you will be able to build, run, monitor, and manage Docker containers for the SCOP Framework simulations. Adjust the commands and options as needed to suit your specific project requirements.

3 - Running on HPC

Guide for running SCOP Framework on HPC systems using SLURM.

This guide covers three scenarios for running the SCOP Framework on HPC systems using SLURM:

  1. Java and Maven are available on the HPC system.
  2. Maven is not available on the HPC system (requiring a locally built fat JAR).
  3. Both Java and Maven are not available on the HPC system (requiring Java installation with EasyBuild).

Checking Available Modules

To verify if the required modules (Java/21.0.2 and Maven/3.9.9) are installed on the HPC, follow these steps:

Check for Java

module avail Java

This command will list all available Java modules. Look for Java/21.0.2 in the output.

Check for Maven

module avail Maven

This command will list all available Maven modules. Look for Maven/3.9.9 in the output.

Case 1: Java and Maven Are Available on the HPC System

In this scenario, both Java and Maven are installed on the HPC environment, allowing you to build and run the SCOP Framework directly on the cluster.

Clone the Repository and Build the Project

  • Clone the repository of your model and build it using Maven:
    git clone https://github.com/your-repo/your-model.git
    cd your-model
    mvn clean install
    
  • This step compiles the Java code and packages the application into a runnable JAR file (typically target/your-model.jar).

Create a SLURM Job Script

  • Write a job script to run the application, specifying the Java JAR file:
    #!/bin/bash
    
    ## Set up the job  
    # Note: Adjust the sbatch settings as needed 
    #SBATCH --nodes=8
    #SBATCH --time=00:05:00
    #SBATCH --qos=devel
    #SBATCH --account=account_name
    
    # Load Java and Maven modules
    module --quiet purge    # Reset the modules to the system default
    module load Java/21.0.2 # Loading Java 21
    module load Maven/3.9.9 # Loading Maven 3.9.9
    
    # Navigate to the your model's directory
    cd /path/to/your-model
    
    # Run the simulation using the JAR file
    # Note: Adjust the memory settings (-Xms and -Xmx) as needed
    java -Xms1g -Xmx32g -jar target/your-model.jar exec-cli
    
    echo $SLURM_SUBMIT_DIR
    
    exit 0
    
  • Save this script as run_your_model_on_hpc.sh.

Submit the Job

  • Submit the job using the sbatch command:
    sbatch run_your_model_on_hpc.sh
    

Check the Job

  • Check the status of the job using the squeue command:
    squeue -u your_username
    

Case 2: Maven Is Not Available on the HPC System

In this scenario, Maven is not available on the HPC, so the build process must be done locally (on a development machine), and then the resulting “fat JAR” is transferred to the HPC system.

Build a Fat JAR Locally

  • On your local machine (with Maven installed), navigate to the project repository and build a fat JAR that includes all dependencies:
    mvn clean compile package -Pshade -DskipTests
    
  • This will generate a “fat JAR” file that includes all required libraries and dependencies, typically found in the target folder, e.g., target/your-model-version-fat.jar.

Transfer the Fat JAR to the HPC

  • Use scp or rsync to copy the fat JAR to the HPC machine:
    scp target/your-model-version-fat.jar your_username@hpc.server.com:/path/to/hpc/folder
    

Create a SLURM Job Script

  • On the HPC, write a job script to run the fat JAR:
    #!/bin/bash
    
    ## Set up the job  
    # Note: Adjust the sbatch settings as needed 
    #SBATCH --nodes=8
    #SBATCH --time=00:05:00
    #SBATCH --qos=devel
    #SBATCH --account=account_name
    
    # Load Java and Maven modules
    module --quiet purge    # Reset the modules to the system default
    module load Java/21.0.2 # Loading Java 21
    
    # Navigate to the your model's directory
    cd /path/to/your-model
    
    # Run the simulation using the JAR file
    # Note: Adjust the memory settings (-Xms and -Xmx) as needed
    java -Xms1g -Xmx32g -jar target/your-model-version-fat.jar exec-cli
    
    echo $SLURM_SUBMIT_DIR
    
    exit 0
    
  • Save this script as run_your_model_on_hpc.sh.

Submit the Job

  • Submit the job using the sbatch command:
    sbatch run_your_model_on_hpc.sh
    

Check the Job

  • Check the status of the job using the squeue command:
    squeue -u your_username
    

Case 3: Java and Maven Are Not Available on the HPC System

In this scenario, neither Java nor Maven is available on the HPC system, so Java needs to be installed using EasyBuild, and a fat JAR must be generated locally.

Create an EasyBuild Script to in Java 21

  • On the HPC, create an EasyBuild script to install Java 21:
    easyblock = 'Binary'
    
    name = 'JDK'
    version = '21'
    toolchain = {'name': 'foss', 'version': '2023b'}  # Adjust based on your available toolchains.
    
    homepage = 'https://www.oracle.com/java/'
    description = "Oracle JDK 21 - Java Development Kit"
    
    source_urls = ['https://download.oracle.com/java/23/latest/']
    sources = ['jdk-21_linux-x64_bin.tar.gz']
    
    # Adjust the installation prefix as necessary
    #install_path = '/cluster/home/ogurcan/software/OracleJDK-23'
    
    # Dependencies if needed
    dependencies = []
    
    # License (if applicable)
    license_file = 'LICENCE'
    
    # Adjust this to ensure proper extraction and installation
    install_cmd = 'tar -xzf jdk-21_linux-x64_bin.tar.gz -C %(installdir)s'
    
    sanity_check_paths = {
         'files': ['jdk-21.0.1/bin/java', 'jdk-21.0.1/bin/javac'],
         'dirs': ['jdk-21.0.1/lib']
    }
    
    moduleclass = 'lang'
    
  • Save this script as JDK-21.eb.

Install Java 21 Using EasyBuild

  • Use the EasyBuild script to generate the module file:
    eb JDK-21.eb --prefix=/path/to/install/directory
    

Load the Installed Java Module

  • Load the newly installed Java 21 module:
    module use /path/to/install/directory/modules/all
    module load Java/21
    

Add Java to your PATH

  • Manually add the JDK 23 bin directory to your PATH: bash export PATH=/path/to/install/directory/JDK/21.0.1/jdk-21.0.1/bin/:$PATH
  • Verify that Java is installed correctly:
    java -version
    

Continue from Case 2

  • Now that Java loaded, go to Case 2, and follow the steps.

Conclusion

In all cases, adjust paths and module names according to the specific setup of your HPC environment.

For more information on SLURM, refer to the SLURM documentation.