-
Notifications
You must be signed in to change notification settings - Fork 10
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
link to postgres database with hibernate + import job on status succe… #137
Open
Samiasa
wants to merge
1
commit into
usnistgov:develop
Choose a base branch
from
Samiasa:feature/add-postgres-persistence
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,17 @@ [email protected]@ | |
# Data storage root folder configuration | ||
[email protected]@ | ||
|
||
|
||
#Postgres JPA | ||
spring.datasource.platform=postgres | ||
#spring.datasource.url= jdbc:postgresql://localhost:5432/postgres | ||
spring.datasource.url= jdbc:postgresql://localhost:7000/postgres | ||
spring.datasource.username=wipp | ||
spring.datasource.password=wipp | ||
spring.data.jpa.repositories.type = none | ||
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQL9Dialect | ||
|
||
|
||
# Workflow management configuration | ||
[email protected]@ | ||
[email protected]@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,5 +27,16 @@ | |
<artifactId>wipp-backend-core</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.json</groupId> | ||
<artifactId>json</artifactId> | ||
<version>20090211</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.json</groupId> | ||
<artifactId>json</artifactId> | ||
<version>20180813</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
Comment on lines
+30
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why two versions? |
||
</dependencies> | ||
</project> |
87 changes: 87 additions & 0 deletions
87
.../src/main/java/gov/nist/itl/ssd/wipp/backend/argo/workflows/persistence/ArgoWorkflow.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package gov.nist.itl.ssd.wipp.backend.argo.workflows.persistence; | ||
|
||
import java.util.Date; | ||
|
||
import javax.persistence.Entity; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.Table; | ||
|
||
|
||
@Entity | ||
@Table(name = "argo_workflows") | ||
public class ArgoWorkflow { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.AUTO) | ||
private String id; | ||
|
||
private String name; | ||
|
||
private String phase; | ||
|
||
private String namespace; | ||
|
||
private String workflow; | ||
|
||
private Date startedat; | ||
|
||
private Date finishedat; | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public void setId(String id) { | ||
this.id = id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getPhase() { | ||
return phase; | ||
} | ||
|
||
public void setPhase(String phase) { | ||
this.phase = phase; | ||
} | ||
|
||
public String getNamespace() { | ||
return namespace; | ||
} | ||
|
||
public void setNamespace(String namespace) { | ||
this.namespace = namespace; | ||
} | ||
|
||
public String getWorkflow() { | ||
return workflow; | ||
} | ||
|
||
public void setWorkflow(String workflow) { | ||
this.workflow = workflow; | ||
} | ||
|
||
public Date getStartedat() { | ||
return startedat; | ||
} | ||
|
||
public void setStartedat(Date startedat) { | ||
this.startedat = startedat; | ||
} | ||
|
||
public Date getFinishedat() { | ||
return finishedat; | ||
} | ||
|
||
public void setFinishedat(Date finishedat) { | ||
this.finishedat = finishedat; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...java/gov/nist/itl/ssd/wipp/backend/argo/workflows/persistence/ArgoWorkflowRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* | ||
*/ | ||
package gov.nist.itl.ssd.wipp.backend.argo.workflows.persistence; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.repository.query.Param; | ||
import org.springframework.data.rest.core.annotation.RepositoryRestResource; | ||
|
||
import java.util.List; | ||
|
||
|
||
/** | ||
* @author Mylene Simon <mylene.simon at nist.gov> | ||
* @author Mohamed Ouladi <mohamed.ouladi at nist.gov> | ||
* | ||
*/ | ||
@RepositoryRestResource | ||
public interface ArgoWorkflowRepository extends JpaRepository<ArgoWorkflow, Integer>{ | ||
|
||
List<ArgoWorkflow> findByNameContainingIgnoreCase(@Param("name") String name); | ||
|
||
ArgoWorkflow findByName(@Param("name") String name); | ||
|
||
ArgoWorkflow findById(@Param("id") String id); | ||
|
||
List<ArgoWorkflow> findAll(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ | |
@Component | ||
public class WorkflowConverter { | ||
private Workflow workflow; | ||
private gov.nist.itl.ssd.wipp.backend.argo.workflows.persistence.ArgoWorkflow argoWorkflow; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it used in this class? |
||
private Map<Job, List<String>> jobsDependencies; | ||
private Map<Job, Plugin> jobsPlugins; | ||
|
||
|
@@ -63,7 +64,7 @@ private HashMap<String, String> generateMetadata() { | |
|
||
private List<ArgoVolume> generateSpecVolumes() { | ||
ArrayList<ArgoVolume> argoVolumeList = new ArrayList<>(); | ||
ArgoVolume inputArgoVolume = new ArgoVolume(wippDataVolumeName, | ||
ArgoVolume inputArgoVolume = new ArgoVolume(wippDataVolumeName, | ||
coreConfig.getWippDataPVCName()); | ||
argoVolumeList.add(inputArgoVolume); | ||
|
||
|
@@ -226,7 +227,7 @@ private ArgoTemplateExitHandlerContainer generateTemplateExitHandlerContainer() | |
return container; | ||
} | ||
/** | ||
* Get and parse nodeSelector labels for all jobs within workflow. | ||
* Get and parse nodeSelector labels for all jobs within workflow. | ||
* Can be overridden by nodeSelector in container template. | ||
* Expects nodeSelector to be formatted as key-value pairs split by semi-colons (eg. "key1:value1;key2:value2;"). | ||
* @return nodeSelector labels as a Map | ||
|
@@ -339,12 +340,12 @@ public void convert(Workflow workflow, Map<Job, List<String>> jobsDependencies, | |
private String getOutputMountPath(String jobId){ | ||
return coreConfig.getContainerOutputsMountPath() + "/" + jobId; | ||
} | ||
|
||
/** | ||
* Get data volume mount sub path for job work folder | ||
* Get data volume mount sub path for job work folder | ||
* (relative to root in data volume) | ||
* @param jobId | ||
* @return the sub path of the data volume to mount | ||
* @return the sub path of the data volume to mount | ||
*/ | ||
private String getOutputMountSubPath(String jobId){ | ||
return new File(coreConfig.getJobsTempFolder(), jobId).getAbsolutePath() | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you create a new property in the pom to set the url?
Something like
@postgres.url@
that in then set in thewipp-backend-application
pom for both profiles